From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Fix off-by-one comparison when using apic_flat mode Date: Thu, 22 Mar 2012 10:20:28 +0100 Message-ID: <1332408028-3727-1-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org 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. Signed-off-by: Andrew Jones --- arch/x86_64/kernel/genapic-xen.c | 2 +- arch/x86_64/kernel/genapic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86_64/kernel/genapic-xen.c b/arch/x86_64/kernel/genapic-xen.c --- a/arch/x86_64/kernel/genapic-xen.c +++ b/arch/x86_64/kernel/genapic-xen.c @@ -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; diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c --- a/arch/x86_64/kernel/genapic.c +++ b/arch/x86_64/kernel/genapic.c @@ -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;