Re: AGP bogosities
From: Linus Torvalds
Date: Sat Mar 12 2005 - 12:10:13 EST
On Sat, 12 Mar 2005, OGAWA Hirofumi wrote:
>
> diff -puN include/asm-i386/atomic.h~detect-atomic-counter-underflows include/asm-i386/atomic.h
> --- 25/include/asm-i386/atomic.h~detect-atomic-counter-underflows Wed Nov 3 15:27:37 2004
> +++ 25-akpm/include/asm-i386/atomic.h Wed Nov 3 15:27:37 2004
> @@ -132,6 +132,10 @@ static __inline__ int atomic_dec_and_tes
> {
> unsigned char c;
>
> + if (!atomic_read(v)) {
> + printk("BUG: atomic counter underflow at:\n");
> + dump_stack();
> + }
Btw, this should probably check for negative 32-bit values too, ie the
test should probably be
if ((int)atomic_read(v) <= 0)
and it should probably be done for the regular atomic_dec() etc cases too,
not just the dec-and-test. "atomic" values simply aren't historically
well-defined for negative values (sparc used to limit them to 24 bits), so
a negative thing would always be a bug, I think.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/