[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR11MB2841DDF7EEA187B368FFDE53DD130@DM6PR11MB2841.namprd11.prod.outlook.com>
Date: Thu, 20 Feb 2020 18:55:28 +0000
From: "Ertman, David M" <david.m.ertman@...el.com>
To: Greg KH <gregkh@...uxfoundation.org>,
Jason Gunthorpe <jgg@...pe.ca>
CC: "Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"nhorman@...hat.com" <nhorman@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>,
"parav@...lanox.com" <parav@...lanox.com>,
"galpress@...zon.com" <galpress@...zon.com>,
"selvin.xavier@...adcom.com" <selvin.xavier@...adcom.com>,
"sriharsha.basavapatna@...adcom.com"
<sriharsha.basavapatna@...adcom.com>,
"benve@...co.com" <benve@...co.com>,
"bharat@...lsio.com" <bharat@...lsio.com>,
"xavier.huwei@...wei.com" <xavier.huwei@...wei.com>,
"yishaih@...lanox.com" <yishaih@...lanox.com>,
"leonro@...lanox.com" <leonro@...lanox.com>,
"mkalderon@...vell.com" <mkalderon@...vell.com>,
"aditr@...are.com" <aditr@...are.com>,
"Patil, Kiran" <kiran.patil@...el.com>,
"Bowers, AndrewX" <andrewx.bowers@...el.com>
Subject: RE: [RFC PATCH v4 01/25] virtual-bus: Implementation of Virtual Bus
> -----Original Message-----
> From: Greg KH <gregkh@...uxfoundation.org>
> Sent: Friday, February 14, 2020 12:45 PM
> To: Jason Gunthorpe <jgg@...pe.ca>
> Cc: Kirsher, Jeffrey T <jeffrey.t.kirsher@...el.com>; davem@...emloft.net;
> Ertman, David M <david.m.ertman@...el.com>; netdev@...r.kernel.org;
> linux-rdma@...r.kernel.org; nhorman@...hat.com;
> sassmann@...hat.com; parav@...lanox.com; galpress@...zon.com;
> selvin.xavier@...adcom.com; sriharsha.basavapatna@...adcom.com;
> benve@...co.com; bharat@...lsio.com; xavier.huwei@...wei.com;
> yishaih@...lanox.com; leonro@...lanox.com; mkalderon@...vell.com;
> aditr@...are.com; Patil, Kiran <kiran.patil@...el.com>; Bowers, AndrewX
> <andrewx.bowers@...el.com>
> Subject: Re: [RFC PATCH v4 01/25] virtual-bus: Implementation of Virtual Bus
>
> On Fri, Feb 14, 2020 at 04:34:55PM -0400, Jason Gunthorpe wrote:
> > On Fri, Feb 14, 2020 at 09:02:40AM -0800, Greg KH wrote:
> > > > + put_device(&vdev->dev);
> > > > + ida_simple_remove(&virtbus_dev_ida, vdev->id);
> > >
> > > You need to do this before put_device().
> >
> > Shouldn't it be in the release function? The ida index should not be
> > re-used until the kref goes to zero..
The IDA should not be reused until the virtbus_device is unregistered. We
don't want another device with the same name and same IDA to be registered,
so the IDA has to remain unique until the device is unregistered, that is why
I am moving it to before put_device, but remember, this index is just to
ensure unique naming among the devices registered on the bus. There could
(and will) be several foo_rdma devices created (one per PF) and we need to keep
them all straight.
>
> Doesn't really matter, once you have unregistered it, you can reuse it.
> But yes, putting it in release() is the safest thing to do.
>
> > > > +struct virtbus_device {
> > > > + struct device dev;
> > > > + const char *name;
> > > > + void (*release)(struct virtbus_device *);
> > > > + int id;
> > > > + const struct virtbus_dev_id *matched_element;
> > > > +};
> > >
> > > Any reason you need to make "struct virtbus_device" a public structure
> > > at all?
> >
> > The general point of this scheme is to do this in a public header:
> >
> > +struct iidc_virtbus_object {
> > + struct virtbus_device vdev;
> > + struct iidc_peer_dev *peer_dev;
> > +};
> >
> > And then this when the driver binds:
>
> Ah, yes, nevermind, I missed that.
>
> greg k-h
-DaveE
Powered by blists - more mailing lists