From: pbonzini@redhat.com (Paolo Bonzini)
Subject: [ltt-dev] [PATCH 1/3] Fix the "unknown" case
Date: Mon, 14 Jun 2010 18:52:43 +0200 [thread overview]
Message-ID: <4C165E5B.1090402@redhat.com> (raw)
In-Reply-To: <20100614004125.GI2428@linux.vnet.ibm.com>
On 06/14/2010 02:41 AM, Paul E. McKenney wrote:
> The compiler (and sometimes the CPU) are within their rights to move
> code into a lock-based critical section. With two
> locks:
>
> do_first_thing();
> acquire_lock();
> release_lock();
> acquire_lock();
> release_lock();
> do_second_thing();
>
> the worst that the compiler and CPU can do is:
>
> acquire_lock();
> do_first_thing();
> release_lock();
> acquire_lock();
> do_second_thing();
> release_lock();
>
> which is still acting like a memory barrier.
Interesting, so it's actually the release+acquire that is doing the job.
I thought about barrier+acquire+release+barrier, but that would
placate the compiler only, not the CPU.
Paolo
next prev parent reply other threads:[~2010-06-14 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100611195937.GA18891@linux.vnet.ibm.com>
[not found] ` <1276286430-21147-1-git-send-email-paulmck@linux.vnet.ibm.com>
2010-06-13 21:28 ` Mathieu Desnoyers
2010-06-14 0:41 ` Paul E. McKenney
2010-06-14 16:51 ` Paolo Bonzini
2010-06-14 17:05 ` Paul E. McKenney
2010-06-14 16:52 ` Paolo Bonzini [this message]
[not found] ` <1276286430-21147-3-git-send-email-paulmck@linux.vnet.ibm.com>
2010-06-13 21:30 ` [ltt-dev] [PATCH 3/3] Remove unused sync_core() definitions Mathieu Desnoyers
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=4C165E5B.1090402@redhat.com \
--to=pbonzini@redhat.com \
/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