mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Valdis.Kletnieks@vt.edu
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: 2.6.10-rc2-mm1 - detect-atomic-counter-underflows.patch
Date: Wed, 17 Nov 2004 12:46:40 -0800	[thread overview]
Message-ID: <20041117124640.08bac623.akpm@osdl.org> (raw)
In-Reply-To: <200411171803.iAHI3wIG018055@turing-police.cc.vt.edu>

Valdis.Kletnieks@vt.edu wrote:
>
> Now, I *may* have simply shot myself in the foot, but when I tried booting
> 2.6.10-rc2-mm1, I got spewed *thousands* of messages triggered by this:
> 
> 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();
> +       }
>         __asm__ __volatile__(
>                 LOCK "decl %0; sete %1"
>                 :"=m" (v->counter), "=qm" (c)
> 
> Somehow, warning a *counter* is non-zero doesn't seem right (calling it an
> underflow 4 times if the value goes 4, 3, 2, 1 and then NOT complain when it
> hits zero?) , and I'm not flooded if it says:
> 
> 	if (atomic_read(v) < 0) {

No, the code is OK.  It's telling us that we're about to take the counter
negative, and that's a good predictor of a bug somewhere.

> So is this code wrong, or did I introduce an now-detected underflow with some
> self-inflicted patch that this is picking up?

Dunno.  What was in the traces?

  reply	other threads:[~2004-11-17 20:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 18:03 Valdis.Kletnieks
2004-11-17 20:46 ` Andrew Morton [this message]
2004-11-18  6:30 ` James Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041117124640.08bac623.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®