Re: [PATCH RFC 01/12] RDMA/rtrs-srv: Remove ib_dev_count from rtrs_srv_ib_ctx

Guoqing Jiang
2022-11-15T10:23:07Z

Hi Haris,

On 11/14/22 9:36 PM, Haris Iqbal wrote:
>
>>> The change was introduced due to a bug report, you can follow the
>>> discussion here for the history and reason:
>>> https://lore.kernel.org/linux-rdma/20200617103732.10356-1-haris.iqbal@cloud.ionos.com/
>> Thanks for the link.
>>
>> I probably missed something but I don't know how rnbd_server module can be
>> initialized before cma module since we have the dependency chain as
>> follows.
> Hi Guoqing,
>
> One of the ways this was happening was, when one builds the RNBD/RTRS
> module into the kernel bzImage and then boots up the kernel. Depending
> on the module init sequence, if the RNBD/RTRS modules are picked
> before the RDMA one, then this issue would hit.

This is what I missed since I usually build RNBD with M.

> With the changes, RNBD/RTRS just register itself to ib. If any devices
> are present at that moment, for example when the module is modprob'ed
> later into the kernel, then .add gets called through
> ib_register_client. If no devices are present, for example in case if
> the module is built into the bzImage, and is inserted before RDMA
> module, then ib_register_client simply registers RTRS, and returns
> without calling .add
> Now, when RDMA gets initialized, and it detects devices, then .add is
> called for each device, which will land into rtrs_srv_add_one

Thanks for the details! It explains well why ib_register_client is added,
and rtrs_srv_rdma_init is guaranteed to be called once too. Will drop
this one.

Thanks,
Guoqings