linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yong Wang <yong.y.wang@linux.intel.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	mingo@elte.hu, akpm@linux-foundation.org,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH 4/6] fastboot: make ACPI bus drivers probe asynchronous
Date: Wed, 7 Jan 2009 22:12:56 +0800	[thread overview]
Message-ID: <20090107141256.GA22902@ywang-moblin2.bj.intel.com> (raw)
In-Reply-To: <20090105201239.0784606e@infradead.org>

On Mon, Jan 05, 2009 at 08:12:39PM -0800, Arjan van de Ven wrote:
> 
> >From 34c47dd38f49e29eb7cd7fa2078efc6b8b258bb9 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@linux.intel.com>
> Date: Sun, 4 Jan 2009 05:32:28 -0800
> Subject: [PATCH] fastboot: make ACPI bus drivers probe asynchronous
> 
> the various ACPI bus drivers have non-overlapping devices and can
> each be run asynchronous. Some of the ACPI drivers (especially the
> battery one, but others as well) can take quite a long time to probe.
> 
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> ---
>  drivers/acpi/scan.c |   23 ++++++++++++++++-------
>  1 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 39b7233..a9e542d 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -8,6 +8,7 @@
>  #include <linux/acpi.h>
>  #include <linux/signal.h>
>  #include <linux/kthread.h>
> +#include <linux/async.h>
>  
>  #include <acpi/acpi_drivers.h>
>  #include <acpi/acinterp.h>	/* for acpi_ex_eisa_id_to_string() */
> @@ -578,6 +579,19 @@ static int acpi_start_single_object(struct acpi_device *device)
>  	return result;
>  }
>  
> +static void acpi_bus_register_async(void *data, async_cookie_t cookie)
> +{
> +	int ret;
> +	struct acpi_driver *driver = data;
> +	driver->drv.name = driver->name;
> +	driver->drv.bus = &acpi_bus_type;
> +	driver->drv.owner = driver->owner;
> +
> +	async_synchronize_cookie(cookie);
> +
> +	ret = driver_register(&driver->drv);
> +	WARN_ON(ret != 0);
> +}
>  /**
>   * acpi_bus_register_driver - register a driver with the ACPI bus
>   * @driver: driver being registered
> @@ -588,16 +602,11 @@ static int acpi_start_single_object(struct acpi_device *device)
>   */
>  int acpi_bus_register_driver(struct acpi_driver *driver)
>  {
> -	int ret;
>  
>  	if (acpi_disabled)
>  		return -ENODEV;
> -	driver->drv.name = driver->name;
> -	driver->drv.bus = &acpi_bus_type;
> -	driver->drv.owner = driver->owner;
> -
> -	ret = driver_register(&driver->drv);
> -	return ret;
> +	async_schedule(acpi_bus_register_async, driver);
> +	return 0;
>  }
>  
>  EXPORT_SYMBOL(acpi_bus_register_driver);

For ACPI battery, button and thermal drivers whose init funtion immediately ends
right after calling acpi_bus_register_driver, it might be OK. But for other drivers
whose init function has more work to do and depends on acpi_bus_register_driver
having *really* done its job, it is certainly not OK. In the latter case, the
'return 0' in acpi_bus_register_driver is effectively cheating those drivers that
acpi_bus_register_driver has already done its job which is unfortunately not
the case. Example drivers include eeepc_laptop and asus_laptop. At least I am
seeing a kernel oops on eeepc because of that.

-Yong

  reply	other threads:[~2009-01-07 14:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090105200959.04a626ac@infradead.org>
2009-01-06  4:10 ` [PATCH 1/6] fastboot: Asynchronous function calls to speed up kernel boot Arjan van de Ven
2009-01-06  4:25   ` Andrew Morton
2009-01-06  4:37     ` Arjan van de Ven
2009-01-06 13:57     ` Arjan van de Ven
2009-01-14  5:32   ` Zhang Rui
2009-01-14  9:04     ` Arjan van de Ven
2009-01-15  5:55   ` Zhang Rui
2009-01-06  4:11 ` [PATCH 2/6] fastboot: make scsi probes asynchronous Arjan van de Ven
2009-01-09 18:17   ` Mark Lord
2009-01-06  4:12 ` [PATCH 3/6] fastboot: make the libata port scan asynchronous Arjan van de Ven
2009-01-07  9:12   ` Bert Wesarg
2009-01-06  4:12 ` [PATCH 4/6] fastboot: make ACPI bus drivers probe asynchronous Arjan van de Ven
2009-01-07 14:12   ` Yong Wang [this message]
2009-01-07 17:25     ` Arjan van de Ven
2009-01-06  4:13 ` [PATCH 5/6] bootchart: improve output Arjan van de Ven
2009-01-06  4:13 ` [PATCH 6/6] fastboot: Make libata initialization even more async Arjan van de Ven

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=20090107141256.GA22902@ywang-moblin2.bj.intel.com \
    --to=yong.y.wang@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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).