On Thu, Feb 19, 2015 at 12:57 PM, Haggai Eran <hagg...@mellanox.com> wrote:
> On 20/02/2015 00:02, Somnath Kotur wrote:
>> From: Matan Barak <mat...@mellanox.com>
>>
>> Previously. we used device_mutex lock in order to protect
>> the device's list. That means that in order to guarantee a
>> device isn't freed while we use it, we had to lock all
>> devices.
>>
>> Adding a kref per IB device. Before an IB device
>> is unregistered, we wait before its not held anymore.
>
> Maybe I'm missing something, but IB device already has a struct device
> embedded in it, which has a kobject with a kref. Wouldn't it be better
> to simply move the operations that need to wait to the ib_device_release
> function?

You're correct, but in ib_unregister_device we delete all client's related data.
We would like to ensure that all references were released before this
data is being deleted and the device is still functioning rather than
when the IB device's
memory is freed.
ib_device_get and ib_device_hold are APIs for the clients, similar to
dev_hold and dev_put.

Regards,
Matan

>
> Regards,
> Haggai
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to