public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver core: remove polling for driver_probe_done(v3)
@ 2009-01-30 12:48 tom.leiming
  2009-01-30 13:31 ` Cornelia Huck
  2009-01-30 14:52 ` Arjan van de Ven
  0 siblings, 2 replies; 10+ messages in thread
From: tom.leiming @ 2009-01-30 12:48 UTC (permalink / raw)
  To: kay.sievers, greg; +Cc: cornelia.huck, arjan, linux-kernel, Ming Lei

From: Ming Lei <tom.leiming@gmail.com>

This patch adds a function : driver_wait_probe_done,
which waits on condition of probing done to replace
polling for driver_probe_done in fs initialization.

There is no better way to avoid polling for
driver_probe_done _and_ existence of the root device,
so we does not replace the driver_probe_done with
driver_wait_probe_done in such special case.

Removing polling in fs initialization may lead to
a faster boot.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/base/dd.c      |   12 ++++++++++++
 include/linux/device.h |    1 +
 init/do_mounts.c       |    4 ++--
 init/do_mounts_md.c    |    3 +--
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 9b721d3..8f9f6fb 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -168,6 +168,18 @@ int driver_probe_done(void)
 }
 
 /**
+ * driver_wait_probe_done
+ * Wait until the probe sequence is finished.
+ *
+ */
+void driver_wait_probe_done(void)
+{
+	pr_debug("%s: probe_count = %d\n", __func__,
+		 atomic_read(&probe_count));
+	wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);
+}
+
+/**
  * driver_probe_device - attempt to bind device & driver together
  * @drv: driver to bind a device to
  * @dev: device to try to bind to the driver
diff --git a/include/linux/device.h b/include/linux/device.h
index 45e5b19..c53cdbf 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -147,6 +147,7 @@ extern void put_driver(struct device_driver *drv);
 extern struct device_driver *driver_find(const char *name,
 					 struct bus_type *bus);
 extern int driver_probe_done(void);
+extern void driver_wait_probe_done(void);
 
 /* sysfs interface for exporting driver attributes */
 
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 708105e..9cb1985 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -371,8 +371,8 @@ void __init prepare_namespace(void)
 	}
 
 	/* wait for the known devices to complete their probing */
-	while (driver_probe_done() != 0)
-		msleep(100);
+	driver_wait_probe_done();
+
 	async_synchronize_full();
 
 	md_run_setup();
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index ff95e31..63b77f0 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -281,8 +281,7 @@ static void __init autodetect_raid(void)
 	 */
 	printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
 	printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
-	while (driver_probe_done() < 0)
-		msleep(100);
+	driver_wait_probe_done();
 	fd = sys_open("/dev/md0", 0, 0);
 	if (fd >= 0) {
 		sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
-- 
1.6.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-01-30 12:48 [PATCH] driver core: remove polling for driver_probe_done(v3) tom.leiming
@ 2009-01-30 13:31 ` Cornelia Huck
  2009-01-30 14:52 ` Arjan van de Ven
  1 sibling, 0 replies; 10+ messages in thread
From: Cornelia Huck @ 2009-01-30 13:31 UTC (permalink / raw)
  To: tom.leiming; +Cc: kay.sievers, greg, arjan, linux-kernel, Ming Lei

On Fri, 30 Jan 2009 20:48:35 +0800,
tom.leiming@gmail.com wrote:

> From: Ming Lei <tom.leiming@gmail.com>
> 
> This patch adds a function : driver_wait_probe_done,
> which waits on condition of probing done to replace
> polling for driver_probe_done in fs initialization.
> 
> There is no better way to avoid polling for
> driver_probe_done _and_ existence of the root device,
> so we does not replace the driver_probe_done with
> driver_wait_probe_done in such special case.
> 
> Removing polling in fs initialization may lead to
> a faster boot.
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  drivers/base/dd.c      |   12 ++++++++++++
>  include/linux/device.h |    1 +
>  init/do_mounts.c       |    4 ++--
>  init/do_mounts_md.c    |    3 +--
>  4 files changed, 16 insertions(+), 4 deletions(-)

Looks good and also survived a quick test on my s390 LPAR.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-01-30 12:48 [PATCH] driver core: remove polling for driver_probe_done(v3) tom.leiming
  2009-01-30 13:31 ` Cornelia Huck
@ 2009-01-30 14:52 ` Arjan van de Ven
  2009-02-04 23:08   ` Greg KH
  1 sibling, 1 reply; 10+ messages in thread
From: Arjan van de Ven @ 2009-01-30 14:52 UTC (permalink / raw)
  To: tom.leiming; +Cc: kay.sievers, greg, cornelia.huck, linux-kernel, Ming Lei

On Fri, 30 Jan 2009 20:48:35 +0800
tom.leiming@gmail.com wrote:

> From: Ming Lei <tom.leiming@gmail.com>
> 
> This patch adds a function : driver_wait_probe_done,
> which waits on condition of probing done to replace
> polling for driver_probe_done in fs initialization.
> 
> There is no better way to avoid polling for
> driver_probe_done _and_ existence of the root device,
> so we does not replace the driver_probe_done with
> driver_wait_probe_done in such special case.
> 
> Removing polling in fs initialization may lead to
> a faster boot.
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>

ok this one will work fine ;)

Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>

thanks for fixing this up 
(it will clash with the patch that moves this to one place, but the
same cleanup can be done there)


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-01-30 14:52 ` Arjan van de Ven
@ 2009-02-04 23:08   ` Greg KH
  2009-02-05  1:08     ` Arjan van de Ven
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2009-02-04 23:08 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: tom.leiming, kay.sievers, cornelia.huck, linux-kernel

On Fri, Jan 30, 2009 at 06:52:24AM -0800, Arjan van de Ven wrote:
> On Fri, 30 Jan 2009 20:48:35 +0800
> tom.leiming@gmail.com wrote:
> 
> > From: Ming Lei <tom.leiming@gmail.com>
> > 
> > This patch adds a function : driver_wait_probe_done,
> > which waits on condition of probing done to replace
> > polling for driver_probe_done in fs initialization.
> > 
> > There is no better way to avoid polling for
> > driver_probe_done _and_ existence of the root device,
> > so we does not replace the driver_probe_done with
> > driver_wait_probe_done in such special case.
> > 
> > Removing polling in fs initialization may lead to
> > a faster boot.
> > 
> > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> 
> ok this one will work fine ;)
> 
> Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
> 
> thanks for fixing this up 
> (it will clash with the patch that moves this to one place, but the
> same cleanup can be done there)

What patch is that?  Should i be taking this?  Or are they in some other
tree?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-02-04 23:08   ` Greg KH
@ 2009-02-05  1:08     ` Arjan van de Ven
  2009-02-05 18:08       ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Arjan van de Ven @ 2009-02-05  1:08 UTC (permalink / raw)
  To: Greg KH; +Cc: tom.leiming, kay.sievers, cornelia.huck, linux-kernel

On Wed, 4 Feb 2009 15:08:51 -0800
Greg KH <greg@kroah.com> wrote:

> On Fri, Jan 30, 2009 at 06:52:24AM -0800, Arjan van de Ven wrote:
> > On Fri, 30 Jan 2009 20:48:35 +0800
> > tom.leiming@gmail.com wrote:
> > 
> > > From: Ming Lei <tom.leiming@gmail.com>
> > > 
> > > This patch adds a function : driver_wait_probe_done,
> > > which waits on condition of probing done to replace
> > > polling for driver_probe_done in fs initialization.
> > > 
> > > There is no better way to avoid polling for
> > > driver_probe_done _and_ existence of the root device,
> > > so we does not replace the driver_probe_done with
> > > driver_wait_probe_done in such special case.
> > > 
> > > Removing polling in fs initialization may lead to
> > > a faster boot.
> > > 
> > > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> > 
> > ok this one will work fine ;)
> > 
> > Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
> > 
> > thanks for fixing this up 
> > (it will clash with the patch that moves this to one place, but the
> > same cleanup can be done there)
> 
> What patch is that?  Should i be taking this?  Or are they in some
> other tree?

it's the suspend-resume regression fixes that either you already have
or that raphael sent to you

> 
> thanks,
> 
> greg k-h


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-02-05  1:08     ` Arjan van de Ven
@ 2009-02-05 18:08       ` Greg KH
  2009-02-17  1:14         ` Ming Lei
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2009-02-05 18:08 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: tom.leiming, kay.sievers, cornelia.huck, linux-kernel

On Wed, Feb 04, 2009 at 05:08:58PM -0800, Arjan van de Ven wrote:
> On Wed, 4 Feb 2009 15:08:51 -0800
> Greg KH <greg@kroah.com> wrote:
> 
> > On Fri, Jan 30, 2009 at 06:52:24AM -0800, Arjan van de Ven wrote:
> > > On Fri, 30 Jan 2009 20:48:35 +0800
> > > tom.leiming@gmail.com wrote:
> > > 
> > > > From: Ming Lei <tom.leiming@gmail.com>
> > > > 
> > > > This patch adds a function : driver_wait_probe_done,
> > > > which waits on condition of probing done to replace
> > > > polling for driver_probe_done in fs initialization.
> > > > 
> > > > There is no better way to avoid polling for
> > > > driver_probe_done _and_ existence of the root device,
> > > > so we does not replace the driver_probe_done with
> > > > driver_wait_probe_done in such special case.
> > > > 
> > > > Removing polling in fs initialization may lead to
> > > > a faster boot.
> > > > 
> > > > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> > > 
> > > ok this one will work fine ;)
> > > 
> > > Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
> > > 
> > > thanks for fixing this up 
> > > (it will clash with the patch that moves this to one place, but the
> > > same cleanup can be done there)
> > 
> > What patch is that?  Should i be taking this?  Or are they in some
> > other tree?
> 
> it's the suspend-resume regression fixes that either you already have
> or that raphael sent to you

Hm, ok, I don't see any left in my tree, or queue, so perhaps someone
might want to resend them to me?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-02-05 18:08       ` Greg KH
@ 2009-02-17  1:14         ` Ming Lei
  2009-02-17  3:19           ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Ming Lei @ 2009-02-17  1:14 UTC (permalink / raw)
  To: Greg KH; +Cc: Arjan van de Ven, kay.sievers, cornelia.huck, linux-kernel

Hi, Greg
Would you mind queuing this patch into your tree?
Thanks!

2009/2/6 Greg KH <greg@kroah.com>:
> On Wed, Feb 04, 2009 at 05:08:58PM -0800, Arjan van de Ven wrote:
>> On Wed, 4 Feb 2009 15:08:51 -0800
>> Greg KH <greg@kroah.com> wrote:
>>
>> > On Fri, Jan 30, 2009 at 06:52:24AM -0800, Arjan van de Ven wrote:
>> > > On Fri, 30 Jan 2009 20:48:35 +0800
>> > > tom.leiming@gmail.com wrote:
>> > >
>> > > > From: Ming Lei <tom.leiming@gmail.com>
>> > > >
>> > > > This patch adds a function : driver_wait_probe_done,
>> > > > which waits on condition of probing done to replace
>> > > > polling for driver_probe_done in fs initialization.
>> > > >
>> > > > There is no better way to avoid polling for
>> > > > driver_probe_done _and_ existence of the root device,
>> > > > so we does not replace the driver_probe_done with
>> > > > driver_wait_probe_done in such special case.
>> > > >
>> > > > Removing polling in fs initialization may lead to
>> > > > a faster boot.
>> > > >
>> > > > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>> > >
>> > > ok this one will work fine ;)
>> > >
>> > > Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
>> > >
>> > > thanks for fixing this up
>> > > (it will clash with the patch that moves this to one place, but the
>> > > same cleanup can be done there)
>> >
>> > What patch is that?  Should i be taking this?  Or are they in some
>> > other tree?
>>
>> it's the suspend-resume regression fixes that either you already have
>> or that raphael sent to you
>
> Hm, ok, I don't see any left in my tree, or queue, so perhaps someone
> might want to resend them to me?
>
> thanks,
>
> greg k-h
>



-- 
Lei Ming

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-02-17  1:14         ` Ming Lei
@ 2009-02-17  3:19           ` Greg KH
  2009-02-17  4:07             ` Ming Lei
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2009-02-17  3:19 UTC (permalink / raw)
  To: Ming Lei; +Cc: Arjan van de Ven, kay.sievers, cornelia.huck, linux-kernel

On Tue, Feb 17, 2009 at 09:14:34AM +0800, Ming Lei wrote:
> Hi, Greg
> Would you mind queuing this patch into your tree?

What patch?  Did anyone resend it to me like I asked?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-02-17  3:19           ` Greg KH
@ 2009-02-17  4:07             ` Ming Lei
  2009-02-17  4:12               ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Ming Lei @ 2009-02-17  4:07 UTC (permalink / raw)
  To: Greg KH; +Cc: Arjan van de Ven, kay.sievers, cornelia.huck, linux-kernel

2009/2/17 Greg KH <greg@kroah.com>:
> On Tue, Feb 17, 2009 at 09:14:34AM +0800, Ming Lei wrote:
>> Hi, Greg
>> Would you mind queuing this patch into your tree?
>
> What patch?  Did anyone resend it to me like I asked?

I mean the patch in the mail list,with the following subject:

         [PATCH] driver core: remove polling for driver_probe_done(v3)

Thanks!

>
> confused,
>
> greg k-h
>



-- 
Lei Ming

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] driver core: remove polling for driver_probe_done(v3)
  2009-02-17  4:07             ` Ming Lei
@ 2009-02-17  4:12               ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2009-02-17  4:12 UTC (permalink / raw)
  To: Ming Lei; +Cc: Arjan van de Ven, kay.sievers, cornelia.huck, linux-kernel

On Tue, Feb 17, 2009 at 12:07:44PM +0800, Ming Lei wrote:
> 2009/2/17 Greg KH <greg@kroah.com>:
> > On Tue, Feb 17, 2009 at 09:14:34AM +0800, Ming Lei wrote:
> >> Hi, Greg
> >> Would you mind queuing this patch into your tree?
> >
> > What patch?  Did anyone resend it to me like I asked?
> 
> I mean the patch in the mail list,with the following subject:
> 
>          [PATCH] driver core: remove polling for driver_probe_done(v3)

Care to resend it?

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-02-17  4:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-30 12:48 [PATCH] driver core: remove polling for driver_probe_done(v3) tom.leiming
2009-01-30 13:31 ` Cornelia Huck
2009-01-30 14:52 ` Arjan van de Ven
2009-02-04 23:08   ` Greg KH
2009-02-05  1:08     ` Arjan van de Ven
2009-02-05 18:08       ` Greg KH
2009-02-17  1:14         ` Ming Lei
2009-02-17  3:19           ` Greg KH
2009-02-17  4:07             ` Ming Lei
2009-02-17  4:12               ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox