single bit flip detector.
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
mm/slab.c renamed from mm/slab.c~ +24 -1
@@ -1516,10 +1516,33 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total=0 , bad_count=0 ;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset+i] !=POISON_FREE ) { + total += data[offset+i]; + ++bad_count; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); +if (bad_count ==1 ) { +switch (total) { +case POISON_FREE ^0x01 : +case POISON_FREE ^0x02 : +case POISON_FREE ^0x04 : +case POISON_FREE ^0x08 : +case POISON_FREE ^0x10 : +case POISON_FREE ^0x20 : +case POISON_FREE ^0x40 : +case POISON_FREE ^0x80 : +printk (KERN_ERR "Single bit error detected. Possibly bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86 or other memory test tool.\n" ); +#endif +return ; + } + } }#endif
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 11 lines · eventuallyDave Jones
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
Given the probability of hardware vs. kernel, you could replace "possible" with "probable" and not get any argument from me.
Signature · 5 lines
Bill Davidsen <[email protected]> Obscure bug of 2004: BASH BUFFER OVERFLOW - if bash is being run by a normal user and is setuid root, with the "vi" line edit mode selected, and the character set is "big5," an off-by-one errors occurs during wildcard (glob) expansion.
Ar Maw, 2006-08-01 am 14:44 -0400, ysgrifennodd Dave Jones:
mm/slab.c static void poison_obj(struct kmem_cache · line 1543
Quoted 13 lines
mm/slab.c renamed from mm/slab.c~ +13
-0+case POISON_FREE ^0x01 : +case POISON_FREE ^0x02 : +case POISON_FREE ^0x04 : +case POISON_FREE ^0x08 : +case POISON_FREE ^0x10 : +case POISON_FREE ^0x20 : +case POISON_FREE ^0x40 : +case POISON_FREE ^0x80 : +printk (KERN_ERR "Single bit error detected. Possibly bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86 or other memory test tool.\n" ); +#endif +return ;
Gack .. NAK
#1: Do we want memtest86 or memtest86+ ?
#2: The check is horrible and there is an elegant implementation for single bit.
errors = value ^ expected; if (errors && !(errors & (errors - 1))) printk(KERN_ERR "Single bit error detected....");
Alan
Quoted 17 lines · Alan Cox
Ar Maw, 2006-08-01 am 14:44 -0400, ysgrifennodd Dave Jones:
mm/slab.c static void poison_obj(struct kmem_cache · line 1543
Quoted 13 lines
mm/slab.c renamed from mm/slab.c~ +13
-0+case POISON_FREE ^0x01 : +case POISON_FREE ^0x02 : +case POISON_FREE ^0x04 : +case POISON_FREE ^0x08 : +case POISON_FREE ^0x10 : +case POISON_FREE ^0x20 : +case POISON_FREE ^0x40 : +case POISON_FREE ^0x80 : +printk (KERN_ERR "Single bit error detected. Possibly bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86 or other memory test tool.\n" ); +#endif +return ;Gack .. NAK
Quoted 1 line
#1: Do we want memtest86 or memtest86+ ?
I doubt it really matters.
Quoted 6 lines
#2: The check is horrible and there is an elegant implementation for single bit.
errors = value ^ expected; if (errors && !(errors & (errors - 1))) printk(KERN_ERR "Single bit error detected....");
Good call, I'll hack that up.
Dave
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 22 lines · Dave Jones
Quoted 17 lines · Alan Cox
Ar Maw, 2006-08-01 am 14:44 -0400, ysgrifennodd Dave Jones:
Review
Quoted 13 lines
(quoted diff) +13
-0+ case POISON_FREE ^ 0x01: + case POISON_FREE ^ 0x02: + case POISON_FREE ^ 0x04: + case POISON_FREE ^ 0x08: + case POISON_FREE ^ 0x10: + case POISON_FREE ^ 0x20: + case POISON_FREE ^ 0x40: + case POISON_FREE ^ 0x80: + printk (KERN_ERR "Single bit error detected. Possibly bad RAM.\n"); +#ifdef CONFIG_X86 + printk (KERN_ERR "Run memtest86 or other memory test tool.\n"); +#endif + return;Gack .. NAK
Quoted 1 line
#1: Do we want memtest86 or memtest86+ ?
I doubt it really matters.
Quoted 8 lines
Quoted 6 lines
#2: The check is horrible and there is an elegant implementation for single bit.
errors = value ^ expected; if (errors && !(errors & (errors - 1))) printk(KERN_ERR "Single bit error detected....");Good call, I'll hack that up.
Take #2.
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
mm/slab.c +20 -1
@@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total=0 , bad_count=0 ;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset+i] !=POISON_FREE ) { + total += data[offset+i]; + ++bad_count; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); + +if (bad_count ==1 ) { + errors = total ^POISON_FREE ; + if ((errors && !(errors & (errors-1))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86+ or similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" ); +#endif +return ; + } + } }#endif
Signature · 1 line
http://www.codemonkey.org.uk
mm/slab.c static void poison_obj(struct kmem_cache · line 1641
Quoted 9 lines · Dave Jones
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
mm/slab.c +1
-0@@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total=0 , bad_count=0 ;
" = 0"
mm/slab.c static void poison_obj(struct kmem_cache · line 1644
Quoted 4 lines
mm/slab.c +2
-1printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset+i] !=POISON_FREE ) {
" + i"
mm/slab.c static void poison_obj(struct kmem_cache · line 1645
Quoted 1 line
mm/slab.c +1
-0+ total += data[offset+i];
ditto
mm/slab.c static void poison_obj(struct kmem_cache · line 1646
Quoted 1 line
mm/slab.c +1
-0+ ++bad_count;
How about post increment?
mm/slab.c static void poison_obj(struct kmem_cache · line 1653
Quoted 7 lines
mm/slab.c +5
-0+ }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); + +if (bad_count ==1 ) { + errors = total ^POISON_FREE ;
undeclared "errors"
mm/slab.c static void poison_obj(struct kmem_cache · line 1654
Quoted 1 line
mm/slab.c +1
-0+ if ((errors && !(errors & (errors-1))) {
^^^
Turn on CONFIG_DEBUG_SLAB before compiling. ;-)
Quoted 1 line · Alexey Dobriyan
Turn on
CONFIG_DEBUG_SLABbefore compiling. ;-)
Well, that was silly. Here's a properly compile tested patch :-)
Dave
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
mm/slab.c +20 -1
@@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors =0 ;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset + i] !=POISON_FREE ) { + total += data[offset + i]; + bad_count++; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); + +if (bad_count ==1 ) { + errors = total ^POISON_FREE ; +if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86+ or similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" ); +#endif +return ; + } + } }#endif
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 5 lines · Dave Jones
Quoted 1 line · Alexey Dobriyan
Turn on
CONFIG_DEBUG_SLABbefore compiling. ;-)Well, that was silly. Here's a properly compile tested patch :-)
The grammar police found me, here's hopefully the final rendition..
Dave
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Probably bad RAM.
mm/slab.c +20 -1
@@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors =0 ;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset + i] !=POISON_FREE ) { + total += data[offset + i]; + bad_count++; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); + +if (bad_count ==1 ) { + errors = total ^POISON_FREE ; +if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86+ or a similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" ); +#endif +return ; + } + } }#endif
Signature · 1 line
http://www.codemonkey.org.uk
mm/slab.c static void poison_obj(struct kmem_cache · line 1641
Quoted 9 lines · Dave Jones
mm/slab.c +1
-0@@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors =0 ;
No need to initialize errors here.
Quoted 11 lines
mm/slab.c +7
-1printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset + i] !=POISON_FREE ) { + total += data[offset + i]; + bad_count++; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); +
mm/slab.c static void poison_obj(struct kmem_cache · line 1661
Quoted 10 lines
mm/slab.c +10
-0+if (bad_count ==1 ) { + errors = total ^POISON_FREE ; +if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86+ or similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" ); +#endif +return ;
Useless return.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 13 lines · Andreas Schwab
mm/slab.c static void poison_obj(struct kmem_cache · line 1641
Quoted 9 lines · Dave Jones
mm/slab.c +1
-0@@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors =0 ;No need to initialize errors here.
I'm going for the record of 'most times a patch gets submitted in one day'. And to think we were complaining that patches don't get enough review ? :) If every change had this much polish, we'd be awesome.
Dave
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
mm/slab.c +19 -1
@@ -1638,10 +1638,28 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset + i] !=POISON_FREE ) { + total += data[offset + i]; + bad_count++; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); + +if (bad_count ==1 ) { + errors = total ^POISON_FREE ; +if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86+ or a similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" ); +#endif + } + } }#endif
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 3 lines · Dave Jones
I'm going for the record of 'most times a patch gets submitted in one day'. And to think we were complaining that patches don't get enough review ? :) If every change had this much polish, we'd be awesome.
Sigh. Spaces before printk. Whatever next.
I am now officially bored of seeing this patch.
Dave
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
mm/slab.c +19 -1
@@ -1638,10 +1638,28 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) { +if (data[offset + i] !=POISON_FREE ) { + total += data[offset + i]; + bad_count++; + }printk (" %02x" , (unsigned char )data[offset + i]); + }printk ("\n" ); + +if (bad_count ==1 ) { + errors = total ^POISON_FREE ; +if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 +printk (KERN_ERR "Run memtest86+ or a similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" ); +#endif + } + } }#endif
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 13 lines · Dave Jones
Quoted 3 lines · Dave Jones
I'm going for the record of 'most times a patch gets submitted in one day'. And to think we were complaining that patches don't get enough review ? :) If every change had this much polish, we'd be awesome.
Sigh. Spaces before printk. Whatever next.
I am now officially bored of seeing this patch.mm/slab.c +0
-0
mm/slab.c static void poison_obj(struct kmem_cache · line 1643
Quoted 7 lines
mm/slab.c +2
-1@@ -1638,10 +1638,28 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; +unsigned char total =0 , bad_count =0 , errors;printk (KERN_ERR "%03x:" , offset); -for (i =0 ; i < limit; i++) +for (i =0 ; i < limit; i++) {
You might want to add a newline before the actual code to make it more readable :)
Eike
Quoted 2 lines
printk(" %02x", (unsigned char)data[offset + i]);Remove cast. (Or does it spew a warning message for you?)
Jan Engelhardt
Quoted 3 lines · Jan Engelhardt
Quoted 1 line
printk(" %02x", (unsigned char)data[offset + i]);Remove cast. (Or does it spew a warning message for you?)
No warning, but you still want the cast...
On PPC and ARM that will work fine, since char is unsigned.
But on most other platforms char is signed, and contrary to popular belief, %02x' doesn't mean limit this field to 2 characters', so it would print e.g. ffffffff instead of ff for -1.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 25 lines · Dave Jones
Quoted 3 lines · Dave Jones
I'm going for the record of 'most times a patch gets submitted in one day'. And to think we were complaining that patches don't get enough review ? :) If every change had this much polish, we'd be awesome.
Sigh. Spaces before printk. Whatever next.
I am now officially bored of seeing this patch.Dave
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
Signed-off-by Dave Jones <[email protected]>
mm/slab.c static void poison_obj(struct kmem_cache · line 1656
Quoted 3 lines
mm/slab.c +3
-0+if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86
#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
memtest86+ runs fine on x86_64 machines as well.
Quoted 3 lines
mm/slab.c +3
-0+printk (KERN_ERR "Run memtest86+ or a similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" );
Quoted 24 lines · On Wed, 02 Aug 2006 11:24:13 -0400 Patrick McLean wrote:
Quoted 23 lines · Dave Jones
Quoted 3 lines · Dave Jones
I'm going for the record of 'most times a patch gets submitted in one day'. And to think we were complaining that patches don't get enough review ? :) If every change had this much polish, we'd be awesome.
Sigh. Spaces before printk. Whatever next.
I am now officially bored of seeing this patch.Dave
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b Single bit error detected. Possibly bad RAM. Run memtest86.
Quoted 7 lines
mm/slab.c static void poison_obj(struct kmem_cache · line 1656
Quoted 5 lines
Signed-off-by Dave Jones <[email protected]>mm/slab.c +3
-0+if (errors && !(errors & (errors-1 ))) { +printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); +#ifdef CONFIG_X86 #if
defined(CONFIG_X86)||defined(CONFIG_X86_64)
CONFIG_X86 is set on both x86-32 and x86-64.
Quoted 6 lines
memtest86+ runs fine on
x86_64machines as well.mm/slab.c static void poison_obj(struct kmem_cache · line 1659
Quoted 3 lines
mm/slab.c +3
-0+printk (KERN_ERR "Run memtest86+ or a similar memory test tool.\n" ); +#else +printk (KERN_ERR "Run a memory test tool.\n" );-
---
~Randy
Quoted 8 lines · On Tue, 1 Aug 2006 20:16:26 -0400 Dave Jones <[email protected]> wrote:
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
Well boy, this has to be the most-reviewed patch ever. You'd think that I'd apply it with great confidence and warm fuzzies.
However...
From: Andrew Morton <[email protected]>
- one decl per line is more patching-friendly and a bit more idiomatic.
- make `bad_count' an int: a uchar might overflow
- Put a blank line between decls and code
- rename total' to error', remove `errors'.
- there's no need to sum up the errors.
- don't need to check for non-zero `errors': we know it is != POISON_FREE.
- make it look non-crapful in an 80-col window.
- add missing spaces in arithmetic
---
mm/slab.c renamed from mm/slab.c~single-bit-flip-detector-tidy +10 -6
@@ -1637,11 +1637,13 @@ static void poison_obj(struct kmem_cachestatic void dump_line (char *data,int offset,int limit) {int i; -unsigned char total =0 , bad_count =0 , errors; +unsigned char error =0 ; +int bad_count =0 ; +printk (KERN_ERR "%03x:" , offset);for (i =0 ; i < limit; i++) {if (data[offset + i] !=POISON_FREE ) { - total += data[offset + i]; + error = data[offset + i]; bad_count++; }printk (" %02x" , (unsigned char )data[offset + i]);
@@ -1649,11 +1651,13 @@ static void dump_line(char *data, int ofprintk ("\n" );if (bad_count ==1 ) { - errors = total ^POISON_FREE ; -if (errors && !(errors & (errors-1 ))) { -printk (KERN_ERR "Single bit error detected. Probably bad RAM.\n" ); + error ^=POISON_FREE ; +if (!(error & (error -1 ))) { +printk (KERN_ERR "Single bit error detected. Probably " +"bad RAM.\n" );#ifdef CONFIG_X86 -printk (KERN_ERR "Run memtest86+ or a similar memory test tool.\n" ); +printk (KERN_ERR "Run memtest86+ or a similar memory " +"test tool.\n" );#else printk (KERN_ERR "Run a memory test tool.\n" );#endif
_
Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Tue, 1 Aug 2006 20:16:26 -0400 Dave Jones <[email protected]> wrote:
In case where we detect a single bit has been flipped, we spew the usual slab corruption message, which users instantly think is a kernel bug. In a lot of cases, single bit errors are down to bad memory, or other hardware failure.
Quoted 6 lines
Quoted 3 lines
This patch adds an extra line to the slab debug messages in those cases, in the hope that users will try memtest before they report a bug.
Well boy, this has to be the most-reviewed patch ever. You'd think that I'd apply it with great confidence and warm fuzzies.
I should stick to one-liner fixes.
Quoted 8 lines
- one decl per line is more patching-friendly and a bit more idiomatic.
- make `bad_count' an int: a uchar might overflow
- Put a blank line between decls and code
- renametotal' toerror', remove `errors'.
- there's no need to sum up the errors.
- don't need to check for non-zero `errors': we know it is !=POISON_FREE.
- make it look non-crapful in an 80-col window.
- add missing spaces in arithmetic
With this much iteration, I do have one question.. Does it still work ? :-)
Dave
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 1 line · On Fri, 4 Aug 2006 18:06:44 -0400 Dave Jones <[email protected]> wrote:
Does it still work ? :-)
Awww man. And I thought everyone _else_ was being fussy.
I expect it'll work. We'll find out when someone hits a single-bit error. The worst it can do is crash the machine, except it's already crashed...
Quoted 9 lines · Andrew Morton
Quoted 1 line · On Fri, 4 Aug 2006 18:06:44 -0400 Dave Jones <[email protected]> wrote:
Does it still work ? :-)
Awww man. And I thought everyone _else_ was being fussy.
I expect it'll work. We'll find out when someone hits a single-bit error. The worst it can do is crash the machine, except it's already crashed...
Ok, if it turns out to be broken, and my version worked, you owe me a beer at the next conference :-)
Dave
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 5 lines
mm/slab.c static void poison_obj(struct kmem_cache · line 1646
Quoted 2 lines
mm/slab.c +1
-0+ ++bad_count;How about post increment?
There would no difference, in effect.
Same goes for the return; mentioned elsewhere in the thread.
Jan Engelhardt