public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.16-rc1-mm4 i386 atomic operations broken on SMP (in modules at least)
@ 2006-02-02  1:19 Neil Brown
  2006-02-02  1:35 ` J.A. Magallon
  0 siblings, 1 reply; 9+ messages in thread
From: Neil Brown @ 2006-02-02  1:19 UTC (permalink / raw)
  To: linux-kernel


I've been testing md/raid in 2.6.16-rc1-mm4 on a dual Xeon with most
of the md personalities compiled as modules, and weird stuff if
happening.

In particular I'm getting lots of 

    BUG: atomic counter underflow at:

reports in raid10 and raid5, which are modules.

I reverted to 2.6.16-rc1-mm2, which still has that BUG check, but
doesn't muck about with the LOCK prefix, and the "atomic" problems go
away (leaving me to look into the other problems of my own making:-).

My guess is there is there is something wrong with the 'alternative'
stuff which strips out the lock prefix, but I couldn't see anything
obviously wrong.  The CPUs don't have FEATURE_UP (see below) so it
cannot possibly be removing the 'lock' prefix... but it certainly acts
like it is.

Help?

NeilBrown



processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Xeon(TM) CPU 3.20GHz
stepping        : 4
cpu MHz         : 3192.524
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 6389.26


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: 2.6.16-rc1-mm4 i386 atomic operations broken on SMP (in modules at least)
@ 2006-02-02 18:12 Chuck Ebbert
  2006-02-02 21:52 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Chuck Ebbert @ 2006-02-02 18:12 UTC (permalink / raw)
  To: Neil Brown; +Cc: Andrew Morton, Gerd Hoffman, linux-kernel

In-Reply-To: <17377.24090.486443.865483@cse.unsw.edu.au>

On Thu, 2 Feb 2006 at 12:19:22 +1100, Neil Brown wrote:

> My guess is there is there is something wrong with the 'alternative'
> stuff which strips out the lock prefix, but I couldn't see anything
> obviously wrong.  The CPUs don't have FEATURE_UP (see below) so it
> cannot possibly be removing the 'lock' prefix... but it certainly acts
> like it is.

Look closer:

> flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
> cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm
> constant_tsc pni monitor ds_cpl cid xtpr
  ^^^^^^^^^^^^

SMP alternatives is re-using the constant_tsc X86 feature bit.

--- 2.6.16-rc1-mm4-386.orig/include/asm-i386/cpufeature.h
+++ 2.6.16-rc1-mm4-386/include/asm-i386/cpufeature.h
@@ -71,7 +71,7 @@
 #define X86_FEATURE_P4		(3*32+ 7) /* P4 */
 #define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
 
-#define X86_FEATURE_UP		(3*32+ 8) /* smp kernel running on up */
+#define X86_FEATURE_UP		(3*32+ 9) /* smp kernel running on up */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3 */
-- 
Chuck

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: 2.6.16-rc1-mm4 i386 atomic operations broken on SMP (in modules at least)
@ 2006-02-02 23:28 Chuck Ebbert
  0 siblings, 0 replies; 9+ messages in thread
From: Chuck Ebbert @ 2006-02-02 23:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, kraxel, neilb

In-Reply-To: <20060202135205.08d91b76.akpm@osdl.org>

On Thu, 2 Feb 2006 at 13:52:05 -0800, Andrew Morton wrote:

> Chuck Ebbert <76306.1226@compuserve.com> wrote:
> > 
> > SMP alternatives is re-using the constant_tsc X86 feature bit.
> > 
> 
> Darn, how did you spot that?

I went looking for which bit represented X86_FEATURE_UP and there
it was...

>
> Should `feature_up' appear in /proc/cpuinfo?

Probably.  The bug would have been nearly impossible if that had
been done to begin with.


i386: show x86 feature "up" in cpuinfo

Show feature bit "up" (SMP kernel running on uniprocessor) in
/proc/cpuinfo.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- 2.6.16-rc1-mm4-386.orig/arch/i386/kernel/cpu/proc.c
+++ 2.6.16-rc1-mm4-386/arch/i386/kernel/cpu/proc.c
@@ -40,7 +40,7 @@ static int show_cpuinfo(struct seq_file 
 		/* Other (Linux-defined) */
 		"cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
 		NULL, NULL, NULL, NULL,
-		"constant_tsc", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+		"constant_tsc", "up", NULL, NULL, NULL, NULL, NULL, NULL,
 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
-- 
Chuck

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

end of thread, other threads:[~2006-02-02 23:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-02  1:19 2.6.16-rc1-mm4 i386 atomic operations broken on SMP (in modules at least) Neil Brown
2006-02-02  1:35 ` J.A. Magallon
2006-02-02  1:50   ` Neil Brown
2006-02-02  8:15     ` J.A. Magallon
2006-02-02  8:23       ` Neil Brown
  -- strict thread matches above, loose matches on Subject: below --
2006-02-02 18:12 Chuck Ebbert
2006-02-02 21:52 ` Andrew Morton
2006-02-02 22:41   ` Neil Brown
2006-02-02 23:28 Chuck Ebbert

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