From: Alexander Duyck <alexander.h.duyck-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "Brown, Len" <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
bvanassche-HInyCGIudOg@public.gmane.org,
linux-nvdimm
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>,
Greg KH
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Linux-pm mailing list
<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
jiangshanlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"Luis R. Rodriguez"
<mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
zwisler-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
"Rafael J. Wysocki"
<rafael-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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:24:10 -0800 [thread overview]
Message-ID: <00810f93b199c524378b5c963d49bd798c5d9843.camel@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4hrML3SKnFP9UANC-hdTrpnOx4nWX=b-yhLsLuujL5oAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >
> > On Mon, Dec 10, 2018 at 12:58 PM Alexander Duyck
> > <alexander.h.duyck-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> 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. 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.
next prev parent reply other threads:[~2018-12-10 22:24 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
[not found] ` <CAPcyv4jH_Op-xHTd2FwQizPaWFx_2FE-pVsOLLmZAEK8EVPrYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-10 19:35 ` Alexander Duyck
2018-12-10 19:43 ` Dan Williams
[not found] ` <CAPcyv4i1RTrKYX0YpyCRE=pqt3pHBRiCGQq1wYUriLjKKTVA7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-10 20:57 ` Alexander Duyck
[not found] ` <bd92d0a3ff60097bf4424ff4c556a5369e66da6d.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-12-10 21:15 ` Dan Williams
2018-12-10 21:23 ` Dan Williams
[not found] ` <CAPcyv4hrML3SKnFP9UANC-hdTrpnOx4nWX=b-yhLsLuujL5oAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-10 22:24 ` Alexander Duyck [this message]
[not found] ` <00810f93b199c524378b5c963d49bd798c5d9843.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-12-10 22:41 ` Dan Williams
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
[not found] ` <dd0b44d5dd9d19ac6735f80ae66bb437ec55b2cf.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
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=00810f93b199c524378b5c963d49bd798c5d9843.camel@linux.intel.com \
--to=alexander.h.duyck-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=bvanassche-HInyCGIudOg@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=jiangshanlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
--cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=pavel-+ZI9xUNit7I@public.gmane.org \
--cc=rafael-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=zwisler-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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