From: Stephen Hemminger <shemminger@osdl.org>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org
Subject: Re: Race condition between aio_complete and aio_read_evt
Date: Tue, 8 Jul 2003 16:00:18 -0700 [thread overview]
Message-ID: <20030708160018.04353f4f.shemminger@osdl.org> (raw)
In-Reply-To: <41F331DBE1178346A6F30D7CF124B24B2A4886@fmsmsx409.fm.intel.com>
On Tue, 8 Jul 2003 14:52:28 -0700
"Chen, Kenneth W" <kenneth.w.chen@intel.com> wrote:
> We hit a memory ordering race condition on AIO ring buffer tail pointer
> between function aio_complete() and aio_read_evt().
>
> What happens is that on an architecture that has a relaxed memory
> ordering model like IPF(ia64), explicit memory barrier is required in a
> SMP execution environment. Considering the following case:
>
> 1 CPU is executing a tight loop of aio_read_evt. It is pulling event
> off the ring buffer. During that loop, another CPU is executing
> aio_complete() where it is putting event into the ring buffer and then
> update the tail pointer. However, due to relaxed memory ordering model,
> the tail pointer can be visible before the actual event is being
> updated. So the other CPU sees the updated tail pointer but picks up a
> staled event data.
>
> A memory barrier is required in this case between the event data and
> tail pointer update. Same is true for the head pointer but the window
> of the race condition is nil. For function correctness, it is fixed
> here as well.
>
> By the way, this bug is fixed in the major distributor's kernel on 2.4.x
> kernel series for a while, but somehow hasn't been propagated to 2.5
> kernel yet.
>
> The patch is relative to 2.5.74.
>
> - Ken
>
Make those smp_* memory barrier's because they don't matter on UP.
next prev parent reply other threads:[~2003-07-08 22:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-08 21:52 Chen, Kenneth W
2003-07-08 23:00 ` Stephen Hemminger [this message]
2003-07-08 23:03 Chen, Kenneth W
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=20030708160018.04353f4f.shemminger@osdl.org \
--to=shemminger@osdl.org \
--cc=kenneth.w.chen@intel.com \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
/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®