> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Monday, March 1, 2021 11:36 AM > To: Bob Pearson <rpearsonhpe@xxxxxxxxx> > Cc: Leon Romanovsky <leon@xxxxxxxxxx>; zyjzyj2000@xxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx; Zago, Frank <frank.zago@xxxxxxx> > Subject: Re: [PATCH for-next] RDMA/rxe: Fix ib_device reference counting (again) > On Mon, Mar 01, 2021 at 10:54:21AM -0600, Bob Pearson wrote: >> I agree that ib_device_get/put is attempting to solve a problem that >> it not really very critical since ib_device is very unlikely to be >> shut down in the middle of a data transfer. The driver never worried about this for years. >> But now that it's been put on the table it should be done right. A >> data packet arriving is completely independent of the verbs API which >> *could* delete all the QPs and shut down the HCA while it was >> wondering around the universe or worse yet while the packet is being processed. > If driver shutdown can guarentee that all pointers involved in multicast are revoked before shutdown can finish then you don't need this > refcounting. > It was only brought up because the API that returns the ib_device from the netdev requires the refcounts as it is general purpose > Jason Unfortunately what you ask for is exactly what the refcounting code accomplishes and I don't see a simpler way to get there. This also applies to the non-multicast packets as well but all the debate has been about the code in rxe_rcv_mcast_pkt() because it is more blatant there or because I haven't been able to explain how it works well enough. Bob