mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] acpi/battery: fix async boot oops
@ 2009-04-07  9:10 Vegard Nossum
  2009-04-07 10:17 ` Alessandro Suardi
  2009-04-07 19:16 ` Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Vegard Nossum @ 2009-04-07  9:10 UTC (permalink / raw)
  To: Len Brown; +Cc: Arkadiusz Miskiewicz, Arjan van de Ven, linux-kernel

>From 85a2a4447ce6b206d9ad20719ed8ac7cc707931c Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Tue, 7 Apr 2009 10:55:38 +0200
Subject: [PATCH] acpi/battery: fix async boot oops

2009/4/6 Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>:
>
> Pulled Linus git few minutes ago and new oops at boot (happens on every boot).
> Yesterday git version was fine. Oopsed just while/after udev started.

[...]

> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [<ffffffffa00fd040>] 0xffffffffa00fd040
> PGD 13998a067 PUD 139979067 PMD 0
> Oops: 0002 [#1] PREEMPT SMP
> last sysfs file: /sys/devices/platform/i8042/modalias
> CPU 0
> Modules linked in: evdev(+) cfg80211(+) battery ac button crc_itu_t xfs exportfs scsi_wait_scan sd_mod crc_t10dif ahci libata scsi_mod
> Pid: 3167, comm: async/0 Not tainted 2.6.29 #12 2764CTO
> RIP: 0010:[<ffffffffa00fd040>]  [<ffffffffa00fd040>] 0xffffffffa00fd040

What happens is that the battery module's init sections are being freed
before the async callback (which was marked __init) has run. This theory
is supported by the fact that the bad RIP value is a vmalloc address.

The immediate fix is to make this a non-init call.

(A better long-term fix is of course to wait with init-section unloading
until a module's async initcalls have been run, which would allow us to
discard this function which is still only run once, after all. Perhaps a
new async_initcall() function for the async/module API, if this is needed
for other modules in the future?)

Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 drivers/acpi/battery.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index b0de631..3c7d894 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = {
 		},
 };
 
-static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
+static void acpi_battery_init_async(void *unused, async_cookie_t cookie)
 {
 	if (acpi_disabled)
 		return;
-- 
1.6.0.6


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

* Re: [PATCH] acpi/battery: fix async boot oops
  2009-04-07  9:10 [PATCH] acpi/battery: fix async boot oops Vegard Nossum
@ 2009-04-07 10:17 ` Alessandro Suardi
  2009-04-07 19:16 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Alessandro Suardi @ 2009-04-07 10:17 UTC (permalink / raw)
  To: Vegard Nossum
  Cc: Len Brown, Arkadiusz Miskiewicz, Arjan van de Ven, linux-kernel

On Tue, Apr 7, 2009 at 11:10 AM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> From 85a2a4447ce6b206d9ad20719ed8ac7cc707931c Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <vegard.nossum@gmail.com>
> Date: Tue, 7 Apr 2009 10:55:38 +0200
> Subject: [PATCH] acpi/battery: fix async boot oops
>
> 2009/4/6 Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>:
>>
>> Pulled Linus git few minutes ago and new oops at boot (happens on every boot).
>> Yesterday git version was fine. Oopsed just while/after udev started.
>
> [...]
>
>> BUG: unable to handle kernel NULL pointer dereference at (null)
>> IP: [<ffffffffa00fd040>] 0xffffffffa00fd040
>> PGD 13998a067 PUD 139979067 PMD 0
>> Oops: 0002 [#1] PREEMPT SMP
>> last sysfs file: /sys/devices/platform/i8042/modalias
>> CPU 0
>> Modules linked in: evdev(+) cfg80211(+) battery ac button crc_itu_t xfs exportfs scsi_wait_scan sd_mod crc_t10dif ahci libata scsi_mod
>> Pid: 3167, comm: async/0 Not tainted 2.6.29 #12 2764CTO
>> RIP: 0010:[<ffffffffa00fd040>]  [<ffffffffa00fd040>] 0xffffffffa00fd040
>
> What happens is that the battery module's init sections are being freed
> before the async callback (which was marked __init) has run. This theory
> is supported by the fact that the bad RIP value is a vmalloc address.
>
> The immediate fix is to make this a non-init call.
>
> (A better long-term fix is of course to wait with init-section unloading
> until a module's async initcalls have been run, which would allow us to
> discard this function which is still only run once, after all. Perhaps a
> new async_initcall() function for the async/module API, if this is needed
> for other modules in the future?)
>
> Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
> Cc: Arjan van de Ven <arjan@linux.intel.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
> ---
>  drivers/acpi/battery.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index b0de631..3c7d894 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = {
>                },
>  };
>
> -static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
> +static void acpi_battery_init_async(void *unused, async_cookie_t cookie)
>  {
>        if (acpi_disabled)
>                return;
> --
> 1.6.0.6


Just to add a Tested-by: <alessandro.suardi@gmail.com>

 (I had the same problem since -git13 on my Dell E6400, and
 this patch on top of -git14 gives me back a bootable laptop)

thanks,

--alessandro

 "Sun keeps rising in the west / I keep on waking fully confused"

   (The Replacements, "Within Your Reach")

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

* Re: [PATCH] acpi/battery: fix async boot oops
  2009-04-07  9:10 [PATCH] acpi/battery: fix async boot oops Vegard Nossum
  2009-04-07 10:17 ` Alessandro Suardi
@ 2009-04-07 19:16 ` Rafael J. Wysocki
  2009-04-07 20:22   ` Len Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2009-04-07 19:16 UTC (permalink / raw)
  To: Vegard Nossum
  Cc: Len Brown, Arkadiusz Miskiewicz, Arjan van de Ven, linux-kernel,
	Linus Torvalds, ACPI Devel Maling List

On Tuesday 07 April 2009, Vegard Nossum wrote:
> From 85a2a4447ce6b206d9ad20719ed8ac7cc707931c Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <vegard.nossum@gmail.com>
> Date: Tue, 7 Apr 2009 10:55:38 +0200
> Subject: [PATCH] acpi/battery: fix async boot oops
> 
> 2009/4/6 Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>:
> >
> > Pulled Linus git few minutes ago and new oops at boot (happens on every boot).
> > Yesterday git version was fine. Oopsed just while/after udev started.
> 
> [...]
> 
> > BUG: unable to handle kernel NULL pointer dereference at (null)
> > IP: [<ffffffffa00fd040>] 0xffffffffa00fd040
> > PGD 13998a067 PUD 139979067 PMD 0
> > Oops: 0002 [#1] PREEMPT SMP
> > last sysfs file: /sys/devices/platform/i8042/modalias
> > CPU 0
> > Modules linked in: evdev(+) cfg80211(+) battery ac button crc_itu_t xfs exportfs scsi_wait_scan sd_mod crc_t10dif ahci libata scsi_mod
> > Pid: 3167, comm: async/0 Not tainted 2.6.29 #12 2764CTO
> > RIP: 0010:[<ffffffffa00fd040>]  [<ffffffffa00fd040>] 0xffffffffa00fd040
> 
> What happens is that the battery module's init sections are being freed
> before the async callback (which was marked __init) has run. This theory
> is supported by the fact that the bad RIP value is a vmalloc address.
> 
> The immediate fix is to make this a non-init call.
> 
> (A better long-term fix is of course to wait with init-section unloading
> until a module's async initcalls have been run, which would allow us to
> discard this function which is still only run once, after all. Perhaps a
> new async_initcall() function for the async/module API, if this is needed
> for other modules in the future?)
> 
> Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
> Cc: Arjan van de Ven <arjan@linux.intel.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>

This patch is necessary to fix a boot oops on my test box(es).

Tested-by: Rafael J. Wysocki <rjw@sisk.pl>

> ---
>  drivers/acpi/battery.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index b0de631..3c7d894 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = {
>  		},
>  };
>  
> -static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
> +static void acpi_battery_init_async(void *unused, async_cookie_t cookie)
>  {
>  	if (acpi_disabled)
>  		return;

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

* Re: [PATCH] acpi/battery: fix async boot oops
  2009-04-07 19:16 ` Rafael J. Wysocki
@ 2009-04-07 20:22   ` Len Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2009-04-07 20:22 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Vegard Nossum, Arkadiusz Miskiewicz, Arjan van de Ven,
	Linux Kernel Mailing List, Linus Torvalds,
	ACPI Devel Maling List

applied

thanks,
Len Brown, Intel Open Source Technology Center


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

end of thread, other threads:[~2009-04-07 20:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-07  9:10 [PATCH] acpi/battery: fix async boot oops Vegard Nossum
2009-04-07 10:17 ` Alessandro Suardi
2009-04-07 19:16 ` Rafael J. Wysocki
2009-04-07 20:22   ` Len Brown

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®