2009-06-17 15:11:27

by Vegard Nossum

[permalink] [raw]
Subject: WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

Hi,

I just saw this warning on latest mainline when shutting down a box:

[ 503.576724] ACPI: Preparing to enter system sleep state S5
[ 503.710857] Disabling non-boot CPUs ...
[ 503.716853] Power down.
[ 503.717770] ------------[ cut here ]------------
[ 503.717770] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_du)
[ 503.717770] Hardware name: OptiPlex GX100
[ 503.717770] Modules linked in:
[ 503.717770] Pid: 2136, comm: halt Not tainted 2.6.30 #443
[ 503.717770] Call Trace:
[ 503.717770] [<c154d327>] ? printk+0x18/0x1a
[ 503.717770] [<c1017358>] ? native_apic_write_dummy+0x38/0x50
[ 503.717770] [<c10360fc>] warn_slowpath_common+0x6c/0xc0
[ 503.717770] [<c1017358>] ? native_apic_write_dummy+0x38/0x50
[ 503.717770] [<c1036165>] warn_slowpath_null+0x15/0x20
[ 503.717770] [<c1017358>] native_apic_write_dummy+0x38/0x50
[ 503.717770] [<c1017173>] disconnect_bsp_APIC+0x63/0x100
[ 503.717770] [<c1019e48>] disable_IO_APIC+0xb8/0xc0
[ 503.717770] [<c1214231>] ? acpi_power_off+0x0/0x29
[ 503.717770] [<c1015e55>] native_machine_shutdown+0x65/0x80
[ 503.717770] [<c1015c36>] native_machine_power_off+0x26/0x30
[ 503.717770] [<c1015c49>] machine_power_off+0x9/0x10
[ 503.717770] [<c1046596>] kernel_power_off+0x36/0x40
[ 503.717770] [<c104680d>] sys_reboot+0xfd/0x1f0
[ 503.717770] [<c109daa0>] ? perf_swcounter_event+0xb0/0x130
[ 503.717770] [<c109db7d>] ? perf_counter_task_sched_out+0x5d/0x120
[ 503.717770] [<c102dfc6>] ? finish_task_switch+0x56/0xd0
[ 503.717770] [<c154da1e>] ? schedule+0x49e/0xb40
[ 503.717770] [<c10444b0>] ? sys_kill+0x70/0x160
[ 503.717770] [<c119d9db>] ? selinux_file_ioctl+0x3b/0x50
[ 503.717770] [<c10dd443>] ? sys_ioctl+0x63/0x70
[ 503.717770] [<c1003024>] sysenter_do_call+0x12/0x22
[ 503.717770] ---[ end trace 8157b5d0ed378f15 ]---
[ 503.717770] acpi_power_off called

That's including this commit:

commit 103428e57be323c3c5545db8ad12667099bc6005
Author: Cyrill Gorcunov <[email protected]>
Date: Sun Jun 7 16:48:40 2009 +0400

x86, apic: Fix dummy apic read operation together with broken MP handling


Vegard


2009-06-17 15:14:48

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

[Vegard Nossum - Wed, Jun 17, 2009 at 05:11:20PM +0200]
| Hi,
|
| I just saw this warning on latest mainline when shutting down a box:
|
| [ 503.576724] ACPI: Preparing to enter system sleep state S5
| [ 503.710857] Disabling non-boot CPUs ...
| [ 503.716853] Power down.
| [ 503.717770] ------------[ cut here ]------------
| [ 503.717770] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_du)
| [ 503.717770] Hardware name: OptiPlex GX100
| [ 503.717770] Modules linked in:
| [ 503.717770] Pid: 2136, comm: halt Not tainted 2.6.30 #443
| [ 503.717770] Call Trace:
| [ 503.717770] [<c154d327>] ? printk+0x18/0x1a
| [ 503.717770] [<c1017358>] ? native_apic_write_dummy+0x38/0x50
| [ 503.717770] [<c10360fc>] warn_slowpath_common+0x6c/0xc0
| [ 503.717770] [<c1017358>] ? native_apic_write_dummy+0x38/0x50
| [ 503.717770] [<c1036165>] warn_slowpath_null+0x15/0x20
| [ 503.717770] [<c1017358>] native_apic_write_dummy+0x38/0x50
| [ 503.717770] [<c1017173>] disconnect_bsp_APIC+0x63/0x100
| [ 503.717770] [<c1019e48>] disable_IO_APIC+0xb8/0xc0
| [ 503.717770] [<c1214231>] ? acpi_power_off+0x0/0x29
| [ 503.717770] [<c1015e55>] native_machine_shutdown+0x65/0x80
| [ 503.717770] [<c1015c36>] native_machine_power_off+0x26/0x30
| [ 503.717770] [<c1015c49>] machine_power_off+0x9/0x10
| [ 503.717770] [<c1046596>] kernel_power_off+0x36/0x40
| [ 503.717770] [<c104680d>] sys_reboot+0xfd/0x1f0
| [ 503.717770] [<c109daa0>] ? perf_swcounter_event+0xb0/0x130
| [ 503.717770] [<c109db7d>] ? perf_counter_task_sched_out+0x5d/0x120
| [ 503.717770] [<c102dfc6>] ? finish_task_switch+0x56/0xd0
| [ 503.717770] [<c154da1e>] ? schedule+0x49e/0xb40
| [ 503.717770] [<c10444b0>] ? sys_kill+0x70/0x160
| [ 503.717770] [<c119d9db>] ? selinux_file_ioctl+0x3b/0x50
| [ 503.717770] [<c10dd443>] ? sys_ioctl+0x63/0x70
| [ 503.717770] [<c1003024>] sysenter_do_call+0x12/0x22
| [ 503.717770] ---[ end trace 8157b5d0ed378f15 ]---
| [ 503.717770] acpi_power_off called
|
| That's including this commit:
|
| commit 103428e57be323c3c5545db8ad12667099bc6005
| Author: Cyrill Gorcunov <[email protected]>
| Date: Sun Jun 7 16:48:40 2009 +0400
|
| x86, apic: Fix dummy apic read operation together with broken MP handling
|
|
| Vegard
|

Thanks Vegard, will take a look.

-- Cyrill

2009-06-17 15:46:31

by Vegard Nossum

[permalink] [raw]
Subject: Re: WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

2009/6/17 Cyrill Gorcunov <[email protected]>:
> [Vegard Nossum - Wed, Jun 17, 2009 at 05:11:20PM +0200]
> | Hi,
> |
> | I just saw this warning on latest mainline when shutting down a box:
[...]

> Thanks Vegard, will take a look.

I've attached full boot log (it's a different boot though).


Vegard


Attachments:
minicom162.txt (92.12 kB)

2009-06-17 15:53:47

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

[Vegard Nossum - Wed, Jun 17, 2009 at 05:46:18PM +0200]
| 2009/6/17 Cyrill Gorcunov <[email protected]>:
| > [Vegard Nossum - Wed, Jun 17, 2009 at 05:11:20PM +0200]
| > | Hi,
| > |
| > | I just saw this warning on latest mainline when shutting down a box:
| [...]
|
| > Thanks Vegard, will take a look.
|
| I've attached full boot log (it's a different boot though).
|
|
| Vegard
...

Vegard, could you test the patch?

-- Cyrill
---

If we have apic disabled we don't even switch to APIC mode and do not
calling for connect_bsp_APIC. Though on SMP compiled kernel the
native_machine_shutdown does try to write the apic register anyway.
Fix it with explicit check if we really should touch apic registers.

Reported-by: Vegard Nossum <[email protected]>
Signed-off-by: Cyrill Gorcunov <[email protected]>
---
arch/x86/kernel/apic/io_apic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/io_apic.c
@@ -2003,7 +2003,9 @@ void disable_IO_APIC(void)
/*
* Use virtual wire A mode when interrupt remapping is enabled.
*/
- disconnect_bsp_APIC(!intr_remapping_enabled && ioapic_i8259.pin != -1);
+ if (cpu_has_apic)
+ disconnect_bsp_APIC(!intr_remapping_enabled &&
+ ioapic_i8259.pin != -1);
}

#ifdef CONFIG_X86_32

2009-06-17 16:37:27

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

[Vegard Nossum - Wed, Jun 17, 2009 at 06:33:31PM +0200]
| 2009/6/17 Cyrill Gorcunov <[email protected]>:
| > Vegard, could you test the patch?
| >
| > ? ? ? ?-- Cyrill
| > ---
| >
| > If we have apic disabled we don't even switch to APIC mode and do not
| > calling for connect_bsp_APIC. Though on SMP compiled kernel the
| > native_machine_shutdown does try to write the apic register anyway.
| > Fix it with explicit check if we really should touch apic registers.
| >
| > Reported-by: Vegard Nossum <[email protected]>
| > Signed-off-by: Cyrill Gorcunov <[email protected]>
| > ---
| > ?arch/x86/kernel/apic/io_apic.c | ? ?4 +++-
| > ?1 file changed, 3 insertions(+), 1 deletion(-)
| >
| > Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
| > =====================================================================
| > --- linux-2.6.git.orig/arch/x86/kernel/apic/io_apic.c
| > +++ linux-2.6.git/arch/x86/kernel/apic/io_apic.c
| > @@ -2003,7 +2003,9 @@ void disable_IO_APIC(void)
| > ? ? ? ?/*
| > ? ? ? ? * Use virtual wire A mode when interrupt remapping is enabled.
| > ? ? ? ? */
| > - ? ? ? disconnect_bsp_APIC(!intr_remapping_enabled && ioapic_i8259.pin != -1);
| > + ? ? ? if (cpu_has_apic)
| > + ? ? ? ? ? ? ? disconnect_bsp_APIC(!intr_remapping_enabled &&
| > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ioapic_i8259.pin != -1);
| > ?}
| >
| > ?#ifdef CONFIG_X86_32
| >
|
| Seems to work here:
|
| [ 317.596743] ACPI: Preparing to enter system sleep state S5
| [ 317.633421] Disabling non-boot CPUs ...
| [ 317.637493] Power down.
| [ 317.638305] acpi_power_off called
|
| and no warning.
|
| Thanks!
|
|
| Vegard
|

Thanks for testing Vegard! I'll recheck again and send
properly formed patch a bit later.

-- Cyrill

2009-06-17 16:38:53

by Vegard Nossum

[permalink] [raw]
Subject: Re: WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

2009/6/17 Cyrill Gorcunov <[email protected]>:
> Vegard, could you test the patch?
>
>        -- Cyrill
> ---
>
> If we have apic disabled we don't even switch to APIC mode and do not
> calling for connect_bsp_APIC. Though on SMP compiled kernel the
> native_machine_shutdown does try to write the apic register anyway.
> Fix it with explicit check if we really should touch apic registers.
>
> Reported-by: Vegard Nossum <[email protected]>
> Signed-off-by: Cyrill Gorcunov <[email protected]>
> ---
>  arch/x86/kernel/apic/io_apic.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
> =====================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/apic/io_apic.c
> +++ linux-2.6.git/arch/x86/kernel/apic/io_apic.c
> @@ -2003,7 +2003,9 @@ void disable_IO_APIC(void)
>        /*
>         * Use virtual wire A mode when interrupt remapping is enabled.
>         */
> -       disconnect_bsp_APIC(!intr_remapping_enabled && ioapic_i8259.pin != -1);
> +       if (cpu_has_apic)
> +               disconnect_bsp_APIC(!intr_remapping_enabled &&
> +                               ioapic_i8259.pin != -1);
>  }
>
>  #ifdef CONFIG_X86_32
>

Seems to work here:

[ 317.596743] ACPI: Preparing to enter system sleep state S5
[ 317.633421] Disabling non-boot CPUs ...
[ 317.637493] Power down.
[ 317.638305] acpi_power_off called

and no warning.

Thanks!


Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036