mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ming Lei <ming.lei@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] driver core: fix possible missing of device probe
Date: Fri, 28 Sep 2012 09:46:52 +0100	[thread overview]
Message-ID: <20120928084652.GC7916@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1348793563-19186-1-git-send-email-ming.lei@canonical.com>

On Fri, Sep 28, 2012 at 08:52:43AM +0800, Ming Lei wrote:
> Inside bus_add_driver(), one device might be added into
> the bus or probed which is triggered by deferred probe
> just after completing of driver_attach() and before
> 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)',
> so the device won't be probed by this driver.
> 
> This patch moves the below line
> 
> 	'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'
> 
> before driver_attach() inside bus_add_driver().
> 
> So fixes the problem since the below way can guarantee that
> no probe(dev) may be lost.
> 
> CPU0                            	CPU1
> driver_register
> 	...
> 	write(bus->driver_list)
> 	smp_mb()
> 	read(bus->device_list)
> 	...
> 					device_add
> 						/* bus_add_device */
> 						write(bus->device_list)
> 						smp_mb()
> 						/* bus_probe_device*/
> 						read(bus->driver_list)
> 
> And the smp_mb() has been implicit by UNLOCK+LOCK
> of 'klist' according to 'VARIETIES OF MEMORY BARRIER' part
> of Documentation/memory-barriers.txt.
> 
> Reported-and-Tested-by: Russell King <linux@arm.linux.org.uk>

Please use rmk+kernel@arm.linux.org.uk here, thanks.

      parent reply	other threads:[~2012-09-28  8:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28  0:52 Ming Lei
2012-09-28  3:31 ` anish singh
2012-09-28  8:46   ` Russell King - ARM Linux
2012-09-28 10:50     ` anish singh
2012-09-28 13:42     ` Ming Lei
2012-09-28 13:55       ` Russell King - ARM Linux
2012-09-28 14:07         ` Ming Lei
2012-09-28 14:13           ` Russell King - ARM Linux
2012-09-28 14:22             ` Ming Lei
2012-09-28 13:53   ` Ming Lei
2012-09-28 14:31     ` anish kumar
2012-09-28 14:44       ` Ming Lei
2012-09-28 15:00         ` anish kumar
2012-09-28 15:05         ` Russell King - ARM Linux
2012-09-28 15:17           ` Ming Lei
2012-09-28  8:46 ` Russell King - ARM Linux [this message]

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=20120928084652.GC7916@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=stable@vger.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

all inboxes | Powered by JetHome®