[PATCH v7 10/20] gunyah: rsc_mgr: Add resource manager RPC core

Greg Kroah-Hartman gregkh at linuxfoundation.org
Mon Dec 12 22:26:30 PST 2022


On Mon, Dec 12, 2022 at 03:46:53PM -0800, Elliot Berman wrote:
> 
> 
> On 11/21/2022 7:24 AM, Greg Kroah-Hartman wrote:
> > On Mon, Nov 21, 2022 at 05:59:59AM -0800, Elliot Berman wrote:
> > > +struct gh_rm_rpc {
> > > +	struct device *dev;
> > > +	struct gunyah_resource tx_ghrsc, rx_ghrsc;
> > > +	struct gh_msgq msgq;
> > > +	struct mbox_client msgq_client;
> > > +	struct gh_rm_connection *active_rx_connection;
> > > +	int last_tx_ret;
> > > +
> > > +	struct idr call_idr;
> > > +	struct mutex call_idr_lock;
> > > +
> > > +	struct mutex send_lock;
> > > +
> > > +	struct work_struct recv_work;
> > > +};
> > 
> > What handles the reference counting for this object?  Shouldn't this be
> > a real 'struct device' and just have a pointer to the parent?  Otherwise
> > how do you know when to free this?
> > 
> 
> Reference counting is not needed on the gh_rm_rpc object because its only
> client (the VM manager) is torn down before the gh_rm_rpc.

So again, who controls the lifecycle of it?  Where is the reference
count for the structure as it is pointing to reference counted memory?

thanks,

greg k-h



More information about the linux-arm-kernel mailing list