On Mon, Apr 08, 2019 at 08:46:27PM +0530, Selvin Xavier wrote: > Jason, > > While working on the bnxt_re patches for implementing the new > un-register APIs, I see a problem when the driver is unloaded while > RoCE devices created over VFs and VF attached to the hypervisor > itself. > > ib_unregister_driver call driver_dealloc in the order in which the > devices are created. VFs gets added after PF. During unload, PFs gets > cleared first. But since the PF provisioned the VF, destroying the PF > device cleans up the VFs resources in the HW. When VF get > de-allocated, device operations fails as the resources are already > removed. > > Should the ib_unregister_driver invoke the de-alloc hooks in the > reverse order No. > or is the vendor drivers expected to handle this internally? Yes. Any device can become detached at any time by user action (ie via sysfs). Drivers must handle any cross dependencies internally. One possible way might be to have the PF destroy the child VFs as well, depending on what your actual cross linkage is. We may need to adjust some thing to make that possible though.. Jason