Fix off-by-one comparison when using apic_flat mode
This patch fixes an off-by-one error in the genapic code so that apic_flat is only used when the maximum APIC ID is less than 8, not also 8 (9 IDs).
Without this patch the kernel may hang when it attempts to process interrupts, if there are exactly 9 cpus assigned.
--- arch/x86_64/kernel/genapic-xen.c | 2 +- arch/x86_64/kernel/genapic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86_64/kernel/genapic-xen.c +1 -1
@@ -85,7 +85,7 @@we have ACPI platform support for CPU hotplug we should detect hotplug capablity from ACPI tables and only do this when really needed. -AK */ -if (max_apic <=8 ) +if (max_apic <8 ) genapic = &apic_flat;#endif goto print;
arch/x86_64/kernel/genapic.c +1 -1
@@ -79,7 +79,7 @@we have ACPI platform support for CPU hotplug we should detect hotplug capablity from ACPI tables and only do this when really needed. -AK */ -if (max_apic <=8 ) +if (max_apic <8 ) genapic = &apic_flat;#endif goto print;
Quoted 1 line
Quoted 1 line
Quoted 1 line · Andrew Jones
First of all, assuming this is intended for the 2.6.18 tree, please in the future indicate so in the subject.
Quoted 17 lines
This patch fixes an off-by-one error in the genapic code so that
apic_flatis only used when the maximum APIC ID is less than 8, not also 8 (9 IDs).Without this patch the kernel may hang when it attempts to process interrupts,
if there are exactly 9 cpus assigned.Signed-off-by Andrew Jones <[email protected]>--- arch/x86_64/kernel/genapic-xen.c | 2 +- arch/x86_64/kernel/genapic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86_64/kernel/genapic-xen.c line 88
Quoted 5 lines
arch/x86_64/kernel/genapic-xen.c +1
-1@@ -85,7 +85,7 @@we have ACPI platform support for CPU hotplug we should detect hotplug capablity from ACPI tables and only do this when really needed. -AK */ -if (max_apic <=8 ) +if (max_apic <8 )
This is inside an #ifndef CONFIG_XEN block, and hence benign.
arch/x86_64/kernel/genapic.c line 82
Quoted 12 lines
arch/x86_64/kernel/genapic-xen.c +0
-0genapic = &apic_flat;#endif goto print;arch/x86_64/kernel/genapic.c +1
-1@@ -79,7 +79,7 @@we have ACPI platform support for CPU hotplug we should detect hotplug capablity from ACPI tables and only do this when really needed. -AK */ -if (max_apic <=8 ) +if (max_apic <8 )
And this is for native code, so irrelevant for the Xen tree.
arch/x86_64/kernel/genapic.c line 85
Quoted 3 lines
arch/x86_64/kernel/genapic.c +0
-0genapic = &apic_flat;#endif goto print;
Please clarify your intentions with this patch.
Jan
----- Original Message -----
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · Andrew Jones
First of all, assuming this is intended for the 2.6.18 tree, please in
the future indicate so in the subject.
Yeah, I thought of that right after hitting send. Sorry about that.
Quoted 2 lines
Please clarify your intentions with this patch.
The problem was hit with the bare-metal kernel in another virt environment. Someone else posted a patch that patched both the bare-metal and the -xen files for RHEL, and when I saw the off-by-one was an obvious problem, I didn't look close enough to see that it was #ifndef XEN. So I guess my intentions now are there are no intentions. Please disregard, sorry for the noise.
Drew