All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] floppy: Run floppy initialization asynchronous
@ 2012-07-03  0:27 Andi Kleen
  2012-07-04 12:03 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2012-07-03  0:27 UTC (permalink / raw)
  To: jkosina; +Cc: linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

floppy_init is quite slow, 3s on my test system to determine
that there is no floppy. Run it asynchronous to the other
init calls to improve boot time.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 drivers/block/floppy.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index cce7df3..8b5769b 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -191,6 +191,7 @@ static int print_unex = 1;
 #include <linux/mutex.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
+#include <linux/async.h>
 
 /*
  * PS/2 floppies have much slower step rates than regular floppies.
@@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
 	return get_disk(disks[drive]);
 }
 
-static int __init floppy_init(void)
+static int __init do_floppy_init(void)
 {
 	int i, unit, drive;
 	int err, dr;
@@ -4337,6 +4338,24 @@ out_put_disk:
 	return err;
 }
 
+#ifndef MODULE
+static __init void floppy_async_init(void *data, async_cookie_t cookie)
+{
+	do_floppy_init();
+}
+#endif
+
+static int __init floppy_init(void)
+{
+#ifdef MODULE
+	return do_floppy_init(void);
+#else
+	/* Don't hold up the bootup by the floppy initialization */
+	async_schedule(floppy_async_init, NULL);
+	return 0;
+#endif
+}
+
 static const struct io_region {
 	int offset;
 	int size;
-- 
1.7.7.6


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

* Re: [PATCH] floppy: Run floppy initialization asynchronous
  2012-07-03  0:27 [PATCH] floppy: Run floppy initialization asynchronous Andi Kleen
@ 2012-07-04 12:03 ` Jiri Kosina
  2012-07-04 12:31   ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2012-07-04 12:03 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, Andi Kleen

On Mon, 2 Jul 2012, Andi Kleen wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> floppy_init is quite slow, 3s on my test system to determine
> that there is no floppy. Run it asynchronous to the other
> init calls to improve boot time.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  drivers/block/floppy.c |   21 ++++++++++++++++++++-
>  1 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index cce7df3..8b5769b 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -191,6 +191,7 @@ static int print_unex = 1;
>  #include <linux/mutex.h>
>  #include <linux/io.h>
>  #include <linux/uaccess.h>
> +#include <linux/async.h>
>  
>  /*
>   * PS/2 floppies have much slower step rates than regular floppies.
> @@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
>  	return get_disk(disks[drive]);
>  }
>  
> -static int __init floppy_init(void)
> +static int __init do_floppy_init(void)
>  {
>  	int i, unit, drive;
>  	int err, dr;
> @@ -4337,6 +4338,24 @@ out_put_disk:
>  	return err;
>  }
>  
> +#ifndef MODULE
> +static __init void floppy_async_init(void *data, async_cookie_t cookie)
> +{
> +	do_floppy_init();
> +}
> +#endif
> +
> +static int __init floppy_init(void)
> +{
> +#ifdef MODULE
> +	return do_floppy_init(void);

This isn't really a valid C.

I have fixed that and applied.

-- 
Jiri Kosina
SUSE Labs

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

* Re: [PATCH] floppy: Run floppy initialization asynchronous
  2012-07-04 12:03 ` Jiri Kosina
@ 2012-07-04 12:31   ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2012-07-04 12:31 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Andi Kleen, linux-kernel, Andi Kleen

On Wed, Jul 04, 2012 at 02:03:07PM +0200, Jiri Kosina wrote:
> On Mon, 2 Jul 2012, Andi Kleen wrote:
> 
> > From: Andi Kleen <ak@linux.intel.com>
> > 
> > floppy_init is quite slow, 3s on my test system to determine
> > that there is no floppy. Run it asynchronous to the other
> > init calls to improve boot time.
> > 
> > Signed-off-by: Andi Kleen <ak@linux.intel.com>
> > ---
> >  drivers/block/floppy.c |   21 ++++++++++++++++++++-
> >  1 files changed, 20 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> > index cce7df3..8b5769b 100644
> > --- a/drivers/block/floppy.c
> > +++ b/drivers/block/floppy.c
> > @@ -191,6 +191,7 @@ static int print_unex = 1;
> >  #include <linux/mutex.h>
> >  #include <linux/io.h>
> >  #include <linux/uaccess.h>
> > +#include <linux/async.h>
> >  
> >  /*
> >   * PS/2 floppies have much slower step rates than regular floppies.
> > @@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
> >  	return get_disk(disks[drive]);
> >  }
> >  
> > -static int __init floppy_init(void)
> > +static int __init do_floppy_init(void)
> >  {
> >  	int i, unit, drive;
> >  	int err, dr;
> > @@ -4337,6 +4338,24 @@ out_put_disk:
> >  	return err;
> >  }
> >  
> > +#ifndef MODULE
> > +static __init void floppy_async_init(void *data, async_cookie_t cookie)
> > +{
> > +	do_floppy_init();
> > +}
> > +#endif
> > +
> > +static int __init floppy_init(void)
> > +{
> > +#ifdef MODULE
> > +	return do_floppy_init(void);
> 
> This isn't really a valid C.
> 
> I have fixed that and applied.

Thanks.

It would be also good to figure out how to move floppy_init 
earlier in the init sequence. I think then you could hide more 
of the 3s latency than just 1s.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

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

end of thread, other threads:[~2012-07-04 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03  0:27 [PATCH] floppy: Run floppy initialization asynchronous Andi Kleen
2012-07-04 12:03 ` Jiri Kosina
2012-07-04 12:31   ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.