> Subject: Re: [PATCH 04/22] ice: Register auxiliary device to provide RDMA > > > @@ -1254,20 +1282,37 @@ int ice_init_peer_devices(struct ice_pf *pf) > > * |--> iidc_peer_obj > > * |--> *ice_peer_drv_int > > * > > + * iidc_auxiliary_object (container_of parent for adev) > > + * |--> auxiliary_device > > + * |--> *iidc_peer_obj (pointer from internal struct) > > + * > > * ice_peer_drv_int (internal only peer_drv struct) > > */ > > peer_obj_int = kzalloc(sizeof(*peer_obj_int), GFP_KERNEL); > > - if (!peer_obj_int) > > + if (!peer_obj_int) { > > + ida_simple_remove(&ice_peer_ida, id); > > return -ENOMEM; > > + } > > Why is this allocated memory with a lifetime different from the aux device? This ice_peer_obj_int is the PCI driver internal only info about the peer_obj (not exposed externally) like the state machine, per PF. But Dave is re-writing all of this with the feedback about getting rid of state machine, and this peer_obj_int will likely be culled. I think what we will end up with is an iidc_peer_obj per PF which is exported to aux driver with lifetime as described below. /* structure layout needed for container_of's looks like: * iidc_auxiliary_dev (container_of parent for adev) * |--> auxiliary_device * |--> *iidc_peer_obj (pointer from peer_obj struct) * * The iidc_auxiliary device has a lifespan as long as it is * on the bus. Once removed it will be freed and a new * one allocated if needed to re-add. * * The peer_obj is tied to the life of the PF, and will * exist as long as the PF driver is loaded. It will be * freed in the remove flow for the PF driver. */