Bug 1641

Summary: "nosmp" or "maxcpus=0" fails if ACPI+IOAPIC
Product: ACPI Reporter: Len Brown (lenb)
Component: Config-ProcessorsAssignee: ykzhao (yakui.zhao)
Status: CLOSED CODE_FIX    
Severity: normal CC: acpi-bugzilla, okir
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.4.23 Subsystem:
Regression: --- Bisected commit-id:
Attachments: a patch
an update
dmesg 2.4.28 "nosmp"
dmesg 2.4.28 "maxcpus=0"
dmesg 2.4.28 "maxcpus=1"
dmesg-2.6.20-nosmp
disable ioapic when parsing nosmp
disable ioapic when parsing nosmp
disable ioapic when parsing nosmp
patch vs 2.6.23-rc3

Description Len Brown 2003-12-03 21:59:36 UTC
The "nosmp" option causes the SMP kernel to skip setup_IO_APIC(). 
 
ACPI doesn't get the word and still enables PCI interrupts on the uninitialized IOAPIC, 
which doesn't work. 
 
One would think that disabling the IOAPIC would be the domain of "noapic", 
and that one should be able to run an SMP max_cpus=0 kernel 
with the APIC still enabled... 
 
Example in bug 1607 attachment 1610 [details] and attachment 1611 [details]
Comment 1 Luming Yu 2004-01-06 22:44:58 UTC
Created attachment 1807 [details]
a patch 

a patch for fixing this issue
Comment 2 Luming Yu 2004-01-06 23:26:51 UTC
Created attachment 1808 [details]
an update

an update
Comment 3 Len Brown 2004-06-17 19:51:41 UTC
proposed patch looks like it includes code from another fix -- reopening. 
Comment 4 Zhu Yi 2004-06-23 18:56:26 UTC
Patch for arch/i386/kernel/smpboot.c should be the intended fix.
Patch for kernel/power/Kconfig should be removed from this patch.
I don't know what the patch for drivers/acpi/executer/exmisc.c fixes?

Luming, could you confirm?
Comment 5 Len Brown 2004-11-17 14:27:26 UTC
Created attachment 4069 [details]
dmesg 2.4.28 "nosmp"
Comment 6 Len Brown 2004-11-17 14:29:39 UTC
Created attachment 4070 [details]
dmesg 2.4.28 "maxcpus=0"

$ diff dmesg-2.4.28-nosmp dmesg-2.4.28-maxcpus=0
35a36
> WARNING: maxcpus limit of 0 reached. Processor ignored.
37a39
> WARNING: maxcpus limit of 0 reached. Processor ignored.
39a42
> WARNING: maxcpus limit of 0 reached. Processor ignored.
41a45
> WARNING: maxcpus limit of 0 reached. Processor ignored.
58c62
< Kernel command line: root=/dev/hda2 console=tty0 console=ttyS0,115200n8 debug
nosmp
---
> Kernel command line: root=/dev/hda2 console=tty0 console=ttyS0,115200n8 debug
maxcpus=0
60c64
< Detected 2790.780 MHz processor.
---
> Detected 2790.802 MHz processor.
92a97
> weird, boot CPU (#0) not listed by the BIOS.
Comment 7 Len Brown 2004-11-17 14:32:36 UTC
Created attachment 4071 [details]
dmesg 2.4.28 "maxcpus=1"
Comment 8 Len Brown 2004-11-17 14:35:09 UTC
maxcpus=1 works, and enables the IOAPIC: 
 
$ diff dmesg-2.4.28-maxcpus=0 dmesg-2.4.28-maxcpus=1 
36d35 
< WARNING: maxcpus limit of 0 reached. Processor ignored. 
39c38 
< WARNING: maxcpus limit of 0 reached. Processor ignored. 
--- 
> WARNING: maxcpus limit of 1 reached. Processor ignored. 
42c41 
< WARNING: maxcpus limit of 0 reached. Processor ignored. 
--- 
> WARNING: maxcpus limit of 1 reached. Processor ignored. 
45c44 
< WARNING: maxcpus limit of 0 reached. Processor ignored. 
--- 
> WARNING: maxcpus limit of 1 reached. Processor ignored. 
62c61 
< Kernel command line: root=/dev/hda2 console=tty0 console=ttyS0,115200n8 debug 
maxcpus=0 
--- 
> Kernel command line: root=/dev/hda2 console=tty0 console=ttyS0,115200n8 debug 
maxcpus=1 
64c63 
< Detected 2790.802 MHz processor. 
--- 
> Detected 2790.748 MHz processor. 
97,98c96,110 
< weird, boot CPU (#0) not listed by the BIOS. 
< SMP mode deactivated, forcing use of dummy APIC emulation. 
--- 
> enabled ExtINT on CPU#0 
> ESR value before enabling vector: 00000000 
> ESR value after enabling vector: 00000000 
> Error: only one processor found. 
> WARNING: No sibling found for CPU 0. 
> ENABLING IO-APIC IRQs 
> init IO_APIC IRQs 
>  IO-APIC (apicid-pin) 2-0, 2-16, 2-17, 2-18, 2-19, 2-20, 2-21, 2-22, 2-23, 3-0, 3-1, 3-2, 3-3, 3-4, 
3-5, 3-6, 3-7, 3-8, 3-9, 3-10, 3-11, 3-12, 3-13. 
> ..TIMER: vector=0x31 pin1=2 pin2=-1 
> Using local APIC timer interrupts. 
> calibrating APIC timer ... 
> ..... CPU clock speed is 2790.7935 MHz. 
> ..... host bus clock speed is 132.8948 MHz. 
> cpu: 0, clocks: 1328948, slice: 664474 
> CPU0<T0:1328944,T1:664464,D:6,S:664474,C:1328948> 
153,155c165,167 
< number of IO-APIC #2 registers: 0. 
< number of IO-APIC #3 registers: 0. 
< number of IO-APIC #4 registers: 0. 
--- 
> number of IO-APIC #2 registers: 24. 
> number of IO-APIC #3 registers: 24. 
> number of IO-APIC #4 registers: 24. 
... 
 
Comment 9 Olaf Kirch 2007-03-12 04:32:34 UTC
This hasn't seen any activity in over 2 years. Okay to close?
Comment 10 Len Brown 2007-03-30 19:53:41 UTC
Created attachment 11004 [details]
dmesg-2.6.20-nosmp

"nosmp" still fails on this box with 2.6.20
Comment 11 Len Brown 2007-03-30 20:06:25 UTC
maxcpus=0 is a synonym for "nosmp", and fails the same way:

< 15200n8 debug apic=debug nosmp
---
> 15200n8 debug apic=debug maxcpus=0
61a64
> WARNING: maxcpus limit of 0 reached. Processor ignored.
63a67
> WARNING: maxcpus limit of 0 reached. Processor ignored.
65a70
> WARNING: maxcpus limit of 0 reached. Processor ignored.
67a73
> WARNING: maxcpus limit of 0 reached. Processor ignored.
86c92
< Detected 2790.814 MHz processor.
---
> Detected 2790.848 MHz processor.
88c94
< Kernel command line: root=/dev/hda2 console=tty0 console=ttyS0,115200n8 debug 
apic=debug nosmp
---
> Kernel command line: root=/dev/hda2 console=tty0 console=ttyS0,115200n8 debug 
apic=debug maxcpus=0
101c107
< Memory: 513496k/523712k available (3149k kernel code, 9648k reserved, 1223k 
data, 228k init, 0k highmem)
---
> Memory: 513624k/523712k available (3149k kernel code, 9552k reserved, 1223k 
data, 228k init, 0k highmem)
111c117
< Calibrating delay using timer specific routine.. 5586.08 BogoMIPS 
(lpj=11172173)
---
> Calibrating delay using timer specific routine.. 5586.04 BogoMIPS 
(lpj=11172096)
124a131
> Freeing SMP alternatives: 17k freed
1320,1324d1326
< hda: lost interrupt
< hda: 78165360 sectors (40020 MB) w/2048KiB Cache, CHS=16383/255/63, UDMA(100)
< hda: lost interrupt
< hda: cache flushes supported
<  hda:<4>hda: dma_timer_expiry: dma status == 0x24
Comment 12 ykzhao 2007-08-06 00:53:51 UTC
Created attachment 12268 [details]
disable ioapic when parsing nosmp

     That maxcpus is zero means that the system will disable ioapic and only use one processor. When nosmp is declared in the command-line the system 
will skip setup_io_apic and the secondary 8259 interrupt controller can't be configured correctly. Unfortunately some external interrupt sources are connected with the secondary 8259 controller. So the system will report the loss of interrupt, for example IDE controller.

    The proposed solution is that the system should disable ioapic by setting skip_ioapic_setup to one when parsing nosmp. And it is noted that 
the flag of skip_ioapic_setup should be set before parsing the configuration of Local and IO apic. Because maxcpus=0 is the synonym for nosmp,the ioapic should also be disabled according to the valule of maxcpus when parsing  maxcpus
Comment 13 ykzhao 2007-08-06 01:47:12 UTC
Created attachment 12269 [details]
disable ioapic when parsing nosmp

   That maxcpus is zero means that the system will disable ioapic and only
use one processor. When nosmp is declared in the command-line the system 
will skip setup_io_apic and the secondary 8259 interrupt controller can't be
configured correctly. Unfortunately some external interrupt sources are
connected with the secondary 8259 controller. So the system will report the
loss of interrupt, for example IDE controller.

    The proposed solution is that the system should disable ioapic by setting
skip_ioapic_setup to one when parsing nosmp. And it is noted that 
the flag of skip_ioapic_setup should be set before parsing the configuration of
Local and IO apic. Because maxcpus=0 is the synonym for nosmp,the ioapic should
also be disabled according to the valule of maxcpus when parsing  maxcpus
Comment 14 ykzhao 2007-08-06 04:35:25 UTC
Created attachment 12270 [details]
disable ioapic when parsing nosmp

That maxcpus is zero means that the system will disable ioapic and only
use one processor. When nosmp is declared in the command-line the system 
will skip setup_io_apic and the secondary 8259 interrupt controller can't be
configured correctly. Unfortunately some external interrupt sources are
connected with the secondary 8259 controller. So the system will report the
loss of interrupt, for example IDE controller.

    The proposed solution is that the system should disable ioapic by setting
skip_ioapic_setup to one when parsing nosmp. And it is noted that the flag of skip_ioapic_setup should be set before parsing the configuration of Local and IO apic.
Comment 15 Len Brown 2007-08-08 18:02:35 UTC
Why isn't the fix to simply imply "noapic" when "nosmp" or "maxcpus=0" is set?

ie. invoke disable_ioapic_setup() from nosmp()
and from maxcpus() as appropriate?
Comment 16 ykzhao 2007-08-08 19:42:00 UTC
    It is necessary to disable ioapic when "nosmp" or "maxcpus=0" is set in the command-line. There are several methods to fix this bug. Of course the simple way is that the "noapic" is also included in the command-line when "nosmp" or "maxcpus=0" is set.
    
Comment 17 Len Brown 2007-08-16 00:36:29 UTC
Created attachment 12399 [details]
patch vs 2.6.23-rc3

this patch has been applied to acpi-test
Comment 18 Len Brown 2007-08-25 21:02:56 UTC
shipped in linux-2.6.23-rc3-git9, closed.