The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] i386: fix early usage of atomic_add_return and local_add_return on real i386
@ 2007-05-22  9:48 Thomas Gleixner
  2007-05-22 10:34 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2007-05-22  9:48 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Ingo Molnar, Andi Kleen

The check (boot_cpu_data.x86 == 3) in atomic_add_return() and
local_add_return() fails, when those operations are used before
boot_cpu_data is filled in.

Change the check to (boot_cpu_data.x86 <= 3) to fix this.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


Index: linux-2.6/include/asm-i386/atomic.h
===================================================================
--- linux-2.6.orig/include/asm-i386/atomic.h
+++ linux-2.6/include/asm-i386/atomic.h
@@ -182,7 +182,7 @@ static __inline__ int atomic_add_return(
 	int __i;
 #ifdef CONFIG_M386
 	unsigned long flags;
-	if(unlikely(boot_cpu_data.x86==3))
+	if(unlikely(boot_cpu_data.x86 <= 3))
 		goto no_xadd;
 #endif
 	/* Modern 486+ processor */
Index: linux-2.6/include/asm-i386/local.h
===================================================================
--- linux-2.6.orig/include/asm-i386/local.h
+++ linux-2.6/include/asm-i386/local.h
@@ -135,7 +135,7 @@ static __inline__ long local_add_return(
 	long __i;
 #ifdef CONFIG_M386
 	unsigned long flags;
-	if(unlikely(boot_cpu_data.x86==3))
+	if(unlikely(boot_cpu_data.x86 <= 3))
 		goto no_xadd;
 #endif
 	/* Modern 486+ processor */



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

* Re: [PATCH] i386: fix early usage of atomic_add_return and local_add_return on real i386
  2007-05-22  9:48 [PATCH] i386: fix early usage of atomic_add_return and local_add_return on real i386 Thomas Gleixner
@ 2007-05-22 10:34 ` Andi Kleen
  2007-05-22 10:37   ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2007-05-22 10:34 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Andrew Morton, Ingo Molnar

On Tuesday 22 May 2007 11:48, Thomas Gleixner wrote:
> The check (boot_cpu_data.x86 == 3) in atomic_add_return() and
> local_add_return() fails, when those operations are used before
> boot_cpu_data is filled in.
>
> Change the check to (boot_cpu_data.x86 <= 3) to fix this.

That's a critical boot fix for 386, right?

-Andi

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

* Re: [PATCH] i386: fix early usage of atomic_add_return and local_add_return on real i386
  2007-05-22 10:34 ` Andi Kleen
@ 2007-05-22 10:37   ` Thomas Gleixner
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2007-05-22 10:37 UTC (permalink / raw)
  To: Andi Kleen; +Cc: LKML, Andrew Morton, Ingo Molnar

On Tue, 2007-05-22 at 12:34 +0200, Andi Kleen wrote:
> On Tuesday 22 May 2007 11:48, Thomas Gleixner wrote:
> > The check (boot_cpu_data.x86 == 3) in atomic_add_return() and
> > local_add_return() fails, when those operations are used before
> > boot_cpu_data is filled in.
> >
> > Change the check to (boot_cpu_data.x86 <= 3) to fix this.
> 
> That's a critical boot fix for 386, right?

Yup. Hit me with some debug option enabled, but might happen anywhere
else too.

	tglx



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

end of thread, other threads:[~2007-05-22 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-22  9:48 [PATCH] i386: fix early usage of atomic_add_return and local_add_return on real i386 Thomas Gleixner
2007-05-22 10:34 ` Andi Kleen
2007-05-22 10:37   ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox