mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Andrew Morton <akpm@zip.com.au>
Cc: wli@holomorphy.com, wli@parcelfarce.linux.theplanet.co.uk,
	"Richard B. Johnson" <root@chaos.analogic.com>,
	linux-kernel@vger.kernel.org, riel@surriel.com,
	hch@infradead.org, phillips@bonn-fries.net
Subject: Re: 2.4.19pre2aa1
Date: Wed, 13 Mar 2002 11:57:13 +0100	[thread overview]
Message-ID: <20020313115713.E1703@dualathlon.random> (raw)
In-Reply-To: <20020312041958.C687@holomorphy.com> <20020312070645.X10413@dualathlon.random> <20020312112900.A14628@holomorphy.com> <20020312135605.P25226@dualathlon.random> <20020312141439.C14628@holomorphy.com> <20020312160430.W25226@dualathlon.random>, <20020312160430.W25226@dualathlon.random>; <20020312233117.E14628@holomorphy.com> <3C8E98B2.159FA546@zip.com.au> <20020313083055.D21589@dualathlon.random>
In-Reply-To: <20020313083055.D21589@dualathlon.random>

On Wed, Mar 13, 2002 at 08:30:55AM +0100, Andrea Arcangeli wrote:
>  {
>  	clear_bit(BH_Wait_IO, &bh->b_state);
>  	clear_bit(BH_Lock, &bh->b_state);
> +	clear_bit(BH_Launder, &bh->b_state);
>  	smp_mb__after_clear_bit();
>  	if (waitqueue_active(&bh->b_wait))

actually, while refining the patch and integrating it, I audited it some
more carefully and the above was wrong, we must ensure nobody is able to
acquire BH_Lock before BH_Launder. So we must also enforce ordering at
the cpu level.  This is the correct version.

	clear_bit(BH_Wait_IO, &bh->b_state);
	clear_bit(BH_Launder, &bh->b_state);
	/* nobody must acquire BH_Lock again before BH_Launder is clear */
	smp_mb__after_clear_bit();
	clear_bit(BH_Lock, &bh->b_state);

The race would been nearly impossible to trigger during stress testing,
you'd need to BH_Lock + GFP_NOFS + alloc_pages + shrink_cache + the
interesting page is near the end of the lru + try_to_free_buffers +
sync_page_buffers + wait_on_buffer all in a few cycles (irq handlers
could trigger it :), but with the huge userbase somebody I don't exclude
somebody could been really hurted by and anyways it would be still a
common code bug even if it would not be possible to reproduce it with
current available hardware.

Note that the above very same race can happen in mainline too on
architectures where a clear_bit doesn't imply a strong CPU barrier.
So on the paper your same kind of deadlock could happen on mainline as
well but there it is reduced to an SMP race and it would affect only
alpha, ppc and s390. So I'm glad my deadlock is been useful to fix
another SMP race condition at least :)

Andrea

  parent reply	other threads:[~2002-03-13 10:56 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-12  4:19 2.4.19pre2aa1 wli
2002-03-12  5:31 ` 2.4.19pre2aa1 wli
2002-03-12  6:36   ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12  6:06 ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12 10:46   ` 2.4.19pre2aa1 Rik van Riel
2002-03-12 11:47     ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12 11:48       ` 2.4.19pre2aa1 wli
2002-03-12 12:21       ` 2.4.19pre2aa1 Daniel Phillips
2002-03-12 14:25         ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12 14:32           ` 2.4.19pre2aa1 Daniel Phillips
2002-03-15 17:20           ` 2.4.19pre2aa1 Horst von Brand
2002-03-15 16:43             ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12 11:29   ` 2.4.19pre2aa1 wli
2002-03-12 12:56     ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12 13:20       ` 2.4.19pre2aa1 Rik van Riel
2002-03-12 13:33       ` 2.4.19pre2aa1 Richard B. Johnson
2002-03-12 14:17         ` 2.4.19pre2aa1 wli
2002-03-12 14:30           ` 2.4.19pre2aa1 Richard B. Johnson
2002-03-13  2:18         ` 2.4.19pre2aa1 wli
2002-03-13 19:06           ` 2.4.19pre2aa1 Richard B. Johnson
2002-03-13 22:10             ` 2.4.19pre2aa1 wli
2002-03-14 12:18               ` 2.4.19pre2aa1 Richard B. Johnson
2002-03-14 12:47                 ` 2.4.19pre2aa1 Daniel Phillips
2002-03-14 13:59                 ` 2.4.19pre2aa1 Rik van Riel
2002-03-14 14:02                   ` 2.4.19pre2aa1 Daniel Phillips
2002-03-12 14:14       ` 2.4.19pre2aa1 wli
2002-03-12 15:04         ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-12 23:31           ` 2.4.19pre2aa1 wli
2002-03-13  0:09             ` 2.4.19pre2aa1 Andrew Morton
2002-03-13  1:06               ` 2.4.19pre2aa1 wli
2002-03-13  1:24                 ` 2.4.19pre2aa1 Andrew Morton
2002-03-13  7:37                   ` 2.4.19pre2aa1 Daniel Phillips
2002-03-13  7:30               ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-13  7:55                 ` 2.4.19pre2aa1 Andrew Morton
2002-03-13  8:06                   ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-13 10:57                 ` Andrea Arcangeli [this message]
2002-03-13 13:51                   ` 2.4.19pre2aa1 Rik van Riel
2002-03-13 14:03                     ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-13 19:19                     ` 2.4.19pre2aa1 Andrew Morton
2002-03-13  8:12               ` 2.4.19pre2aa1 Daniel Phillips
  -- strict thread matches above, loose matches on Subject: below --
2002-03-08  2:40 2.4.19pre2aa1 rwhron
2002-03-07  8:21 2.4.19pre2aa1 Andrea Arcangeli
2002-03-07 10:49 ` 2.4.19pre2aa1 William Lee Irwin III
2002-03-07 11:27   ` 2.4.19pre2aa1 Daniel Phillips
2002-03-07 11:47     ` 2.4.19pre2aa1 William Lee Irwin III
2002-03-07 11:46       ` 2.4.19pre2aa1 Daniel Phillips
2002-03-07 17:03   ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-07 20:18     ` 2.4.19pre2aa1 William Lee Irwin III
2002-03-07 20:38       ` 2.4.19pre2aa1 Richard B. Johnson
2002-03-08  0:22         ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-08  0:26           ` 2.4.19pre2aa1 Rik van Riel
2002-03-08  0:11       ` 2.4.19pre2aa1 Andrea Arcangeli
2002-03-07 11:34 ` 2.4.19pre2aa1 Christoph Hellwig

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=20020313115713.E1703@dualathlon.random \
    --to=andrea@suse.de \
    --cc=akpm@zip.com.au \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillips@bonn-fries.net \
    --cc=riel@surriel.com \
    --cc=root@chaos.analogic.com \
    --cc=wli@holomorphy.com \
    --cc=wli@parcelfarce.linux.theplanet.co.uk \
    /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®