xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Fix off-by-one comparison when using apic_flat mode
@ 2012-03-22  9:20 Andrew Jones
  2012-03-22 10:52 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2012-03-22  9:20 UTC (permalink / raw)
  To: xen-devel; +Cc: JBeulich

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 <drjones@redhat.com>
---
 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;

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

* Re: Fix off-by-one comparison when using apic_flat mode
  2012-03-22  9:20 Fix off-by-one comparison when using apic_flat mode Andrew Jones
@ 2012-03-22 10:52 ` Jan Beulich
  2012-03-22 11:01   ` Andrew Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2012-03-22 10:52 UTC (permalink / raw)
  To: Andrew Jones; +Cc: xen-devel

>>> On 22.03.12 at 10:20, Andrew Jones <drjones@redhat.com> wrote:

First of all, assuming this is intended for the 2.6.18 tree, please in
the future indicate so in the subject.

> 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 <drjones@redhat.com>
> ---
>  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)

This is inside an #ifndef CONFIG_XEN block, and hence benign.

>  			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)

And this is for native code, so irrelevant for the Xen tree.

>  			genapic = &apic_flat;
>  #endif
>   		goto print;

Please clarify your intentions with this patch.

Jan

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

* Re: Fix off-by-one comparison when using apic_flat mode
  2012-03-22 10:52 ` Jan Beulich
@ 2012-03-22 11:01   ` Andrew Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2012-03-22 11:01 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel



----- Original Message -----
> >>> On 22.03.12 at 10:20, Andrew Jones <drjones@redhat.com> wrote:
> 
> 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.

> 
> 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

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

end of thread, other threads:[~2012-03-22 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22  9:20 Fix off-by-one comparison when using apic_flat mode Andrew Jones
2012-03-22 10:52 ` Jan Beulich
2012-03-22 11:01   ` Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).