linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: alexander.h.duyck@linux.intel.com
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	"Luis R. Rodriguez" <mcgrof@kernel.org>,
	linux-nvdimm <linux-nvdimm@lists.01.org>,
	Tejun Heo <tj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-pm mailing list <linux-pm@vger.kernel.org>,
	jiangshanlai@gmail.com, "Rafael J. Wysocki" <rafael@kernel.org>,
	"Brown, Len" <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	zwisler@kernel.org, Dave Jiang <dave.jiang@intel.com>,
	bvanassche@acm.org
Subject: Re: [driver-core PATCH v8 2/9] driver core: Establish order of operations for device_add and device_del via bitflag
Date: Mon, 10 Dec 2018 14:41:07 -0800	[thread overview]
Message-ID: <CAPcyv4h0hk3VCCDSMNR72S9BWVMP514byGf3TWwp1Z7bQ2wi5g@mail.gmail.com> (raw)
In-Reply-To: <00810f93b199c524378b5c963d49bd798c5d9843.camel@linux.intel.com>

On Mon, Dec 10, 2018 at 2:24 PM Alexander Duyck
<alexander.h.duyck@linux.intel.com> wrote:
>
> On Mon, 2018-12-10 at 13:23 -0800, Dan Williams wrote:
> > On Mon, Dec 10, 2018 at 1:15 PM Dan Williams <dan.j.williams@intel.com> wrote:
> > >
> > > On Mon, Dec 10, 2018 at 12:58 PM Alexander Duyck
> > > <alexander.h.duyck@linux.intel.com> wrote:
> >
> > [..]
> > > > Also the context for the two functions seems to be a bit different. In
> > > > the case of __device_attach_driver the device_lock is already held. In
> > > > __driver_attach the lock on the device isn't taken until after a match
> > > > has been found.
> > >
> > > Yes, I was only pattern matching when looking at the context of where
> > > dev->dead is checked in __driver_attach() and wondering why it was
> > > checked outside of __device_attach_driver()
> >
> > ...and now I realize the bigger point of your concern, we need to
> > check dev->dead after acquiring the device_lock otherwise the race is
> > back. We can defer that consolidation, but the larger concern of
> > making it internal to __device_attach_driver() still stands.
>
> I'm still not a fan of moving it into __device_attach_driver. I would
> much rather pull out the dev->driver check and instead place that in
> __device_attach_async_helper.
>
> The __device_attach function as I said took the device_lock and had
> already checked dev->driver. So in the non-async path it shouldn't be
> possible for dev->driver to ever be set anyway.

True.

> In addition
> __device_attach_driver is called once for each driver on a given bus,
> so dropping the test should reduce driver load time since it is one
> less test that has to be performed per driver.

Ok. You can add my Reviewed-by.

  reply	other threads:[~2018-12-10 22:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 17:25 [driver-core PATCH v8 0/9] Add NUMA aware async_schedule calls Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 1/9] driver core: Move async_synchronize_full call Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 2/9] driver core: Establish order of operations for device_add and device_del via bitflag Alexander Duyck
2018-12-10 18:58   ` Dan Williams
2018-12-10 19:35     ` Alexander Duyck
2018-12-10 19:43       ` Dan Williams
2018-12-10 20:57         ` Alexander Duyck
2018-12-10 21:15           ` Dan Williams
2018-12-10 21:23             ` Dan Williams
2018-12-10 22:24               ` Alexander Duyck
2018-12-10 22:41                 ` Dan Williams [this message]
2018-12-05 17:25 ` [driver-core PATCH v8 3/9] device core: Consolidate locking and unlocking of parent and device Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 4/9] driver core: Probe devices asynchronously instead of the driver Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 5/9] workqueue: Provide queue_work_node to queue work near a given NUMA node Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 6/9] async: Add support for queueing on specific " Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 7/9] driver core: Attach devices on CPU local to device node Alexander Duyck
2018-12-05 17:25 ` [driver-core PATCH v8 8/9] PM core: Use new async_schedule_dev command Alexander Duyck
2018-12-05 17:26 ` [driver-core PATCH v8 9/9] libnvdimm: Schedule device registration on node local to the device Alexander Duyck
2018-12-10 19:22 ` [driver-core PATCH v8 0/9] Add NUMA aware async_schedule calls Luis Chamberlain
2018-12-10 23:25   ` Alexander Duyck
2018-12-10 23:35     ` Luis Chamberlain

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=CAPcyv4h0hk3VCCDSMNR72S9BWVMP514byGf3TWwp1Z7bQ2wi5g@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=bvanassche@acm.org \
    --cc=dave.jiang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiangshanlai@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=tj@kernel.org \
    --cc=zwisler@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).