qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Julian Seward <jseward@acm.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Race condition between signal handler and cpu_exec()
Date: Fri, 6 Mar 2009 12:49:28 +0100	[thread overview]
Message-ID: <200903061249.29263.jseward@acm.org> (raw)
In-Reply-To: <20090306010555.GC13735@shareable.org>

On Friday 06 March 2009, Jamie Lokier wrote:
> Aurelien Jarno wrote:
> > I am currently too tired to find a proper solution (which should only
> > use read/write to a variable to keep the operations atomic), I'll look
> > at that tomorrow, but patches are welcome in the meanwhile.
>
> The theoretically right thing in C is read/write a "volatile
> sig_atomic_t".

It looks to me like this requires to atomically test that a bit in a
byte is set, and if so clear it.  That would require a lock;cmpxchg
sequence on x86 and lwarx/stwcx on ppc.  I wonder if it can be done
with gcc's __sync_bool_compare_and_swap builtin, in order to make
it portable.

J

  reply	other threads:[~2009-03-06 11:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05 22:14 [Qemu-devel] Race condition between signal handler and cpu_exec() Aurelien Jarno
2009-03-06  1:05 ` Jamie Lokier
2009-03-06 11:49   ` Julian Seward [this message]
2009-03-06 12:30     ` malc
2009-03-06 13:02     ` Jamie Lokier

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=200903061249.29263.jseward@acm.org \
    --to=jseward@acm.org \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).