From: Greg KH <gregkh@linuxfoundation.org>
To: "Gangurde, Abhijit" <abhijit.gangurde@amd.com>
Cc: "masahiroy@kernel.org" <masahiroy@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Simek, Michal" <michal.simek@amd.com>,
"git (AMD-Xilinx)" <git@amd.com>,
"Agarwal, Nikhil" <nikhil.agarwal@amd.com>,
"Gupta, Nipun" <Nipun.Gupta@amd.com>
Subject: Re: [PATCH v2 1/4] cdx: Introduce lock to protect controller ops and controller list
Date: Tue, 1 Aug 2023 10:40:38 +0200 [thread overview]
Message-ID: <2023080105-eggnog-probably-9ff3@gregkh> (raw)
In-Reply-To: <DM4PR12MB7765398763E00B565AB1C6DB8F0AA@DM4PR12MB7765.namprd12.prod.outlook.com>
On Tue, Aug 01, 2023 at 08:34:00AM +0000, Gangurde, Abhijit wrote:
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Monday, July 31, 2023 5:55 PM
> > To: Gangurde, Abhijit <abhijit.gangurde@amd.com>
> > Cc: masahiroy@kernel.org; linux-kernel@vger.kernel.org; Simek, Michal
> > <michal.simek@amd.com>; git (AMD-Xilinx) <git@amd.com>; Agarwal, Nikhil
> > <nikhil.agarwal@amd.com>; Gupta, Nipun <Nipun.Gupta@amd.com>
> > Subject: Re: [PATCH v2 1/4] cdx: Introduce lock to protect controller ops and
> > controller list
> >
> > On Mon, Jul 31, 2023 at 05:38:10PM +0530, Abhijit Gangurde wrote:
> > > Add a mutex lock to prevent race between controller ops initiated by
> > > the bus subsystem and the controller registration/unregistration.
> > >
> > > Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
> > > ---
> > > drivers/cdx/cdx.c | 14 ++++++++++++++
> > > 1 file changed, 14 insertions(+)
> > >
> > > diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
> > > index d2cad4c670a0..66797c8fe400 100644
> > > --- a/drivers/cdx/cdx.c
> > > +++ b/drivers/cdx/cdx.c
> > > @@ -72,6 +72,8 @@
> > >
> > > /* CDX controllers registered with the CDX bus */
> > > static DEFINE_XARRAY_ALLOC(cdx_controllers);
> > > +/* Lock to protect controller ops and controller list */
> > > +static DEFINE_MUTEX(cdx_controller_lock);
> >
> > Wait, why do you have a local list and not just rely on the list the
> > driver core has for you already? Isn't this a duplicate list where you
> > have objects on two different lists with a lifespan controlled only by
> > one of them?
>
> cdx_controllers list is holding just the controllers registered on the cdx bus system.
Which are devices on the bus, so why do you need a separate list?
> CDX devices are still maintained by driver core list. Controller list is used by rescan
> which triggers rescan on all the controllers.
Again, why a separate list? The driver core already tracks these,
right?
thanks,
greg k-h
next prev parent reply other threads:[~2023-08-01 8:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 12:08 [PATCH v2 0/4] cdx: provide sysfs interface for cdx device resources Abhijit Gangurde
2023-07-31 12:08 ` [PATCH v2 1/4] cdx: Introduce lock to protect controller ops and controller list Abhijit Gangurde
2023-07-31 12:24 ` Greg KH
2023-08-01 8:34 ` Gangurde, Abhijit
2023-08-01 8:40 ` Greg KH [this message]
2023-08-02 11:20 ` Gangurde, Abhijit
2023-08-02 11:49 ` Greg KH
2023-08-04 11:11 ` Gangurde, Abhijit
2023-07-31 12:08 ` [PATCH v2 2/4] cdx: add support for bus enable and disable Abhijit Gangurde
2023-07-31 12:08 ` [PATCH v2 3/4] cdx: add sysfs for bus reset Abhijit Gangurde
2023-07-31 12:08 ` [PATCH v2 4/4] cdx: add sysfs for subsystem, class and revision Abhijit Gangurde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023080105-eggnog-probably-9ff3@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Nipun.Gupta@amd.com \
--cc=abhijit.gangurde@amd.com \
--cc=git@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.simek@amd.com \
--cc=nikhil.agarwal@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox