qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] QEMU question: is eventfd not thread safe?
Date: Mon, 02 Jul 2012 09:07:51 +1000	[thread overview]
Message-ID: <1341184071.2588.10.camel@pasglop> (raw)
In-Reply-To: <4FF04939.7050608@ozlabs.ru>

> >> diff --git a/iohandler.c b/iohandler.c
> >> index 3c74de6..54f4c48 100644
> >> --- a/iohandler.c
> >> +++ b/iohandler.c
> >> @@ -77,6 +77,7 @@ int qemu_set_fd_handler2(int fd,
> >>          ioh->fd_write = fd_write;
> >>          ioh->opaque = opaque;
> >>          ioh->deleted = 0;
> >> +        kill(getpid(), SIGUSR2);
> >>      }
> >>      return 0;
> >>  }

That probably wants to be a pthread_kill targetted at the main loop.

> >> +static void sigusr2_print(int signal)
> >> +{
> >> +}
> >> +
> >> +static void sigusr2_init(void)
> >> +{
> >> +    struct sigaction action;
> >> +
> >> +    memset(&action, 0, sizeof(action));
> >> +    sigfillset(&action.sa_mask);
> >> +    action.sa_handler = sigusr2_print;
> >> +    action.sa_flags = 0;
> >> +    sigaction(SIGUSR2, &action, NULL);
> >> +}
> >> +

Won't that conflict with the business in coroutine-sigaltstack.c ?

Hrm... looking at it, it looks like it will save/restore the handler,
so that should be good.
 
Still, one might want to wrap that into something, like
qemu_wake_main_loop();

Cheers,
Ben.

> >>  int main_loop_init(void)
> >>  {
> >>      int ret;
> >>  
> >> +    sigusr2_init();
> >> +
> >>      qemu_mutex_lock_iothread();
> >>      ret = qemu_signal_init();
> >>      if (ret) {
> >> -- 
> >> 1.7.10
> 
> 

  reply	other threads:[~2012-07-01 23:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01 11:06 [Qemu-devel] QEMU question: is eventfd not thread safe? Alexey Kardashevskiy
2012-07-01 12:43 ` Michael S. Tsirkin
2012-07-01 12:57   ` Alexey Kardashevskiy
2012-07-01 23:07     ` Benjamin Herrenschmidt [this message]
2012-07-02  0:06       ` Alexey Kardashevskiy
2012-07-02  0:42         ` ronnie sahlberg
2012-07-02  0:45           ` Benjamin Herrenschmidt
2012-07-02  0:44         ` Benjamin Herrenschmidt
2012-07-02  0:49         ` Benjamin Herrenschmidt
2012-07-01 22:30   ` Benjamin Herrenschmidt
2012-07-01 13:32 ` Paolo Bonzini
2012-07-01 13:40   ` Alexey Kardashevskiy
2012-07-01 14:46     ` Alexey Kardashevskiy
2012-07-01 15:03       ` Paolo Bonzini
2012-07-01 19:48         ` [Qemu-devel] [PATCH] eventfd: making it rhread safe Alexey Kardashevskiy
2012-07-09  3:10           ` Alexey Kardashevskiy
2012-07-18  8:25             ` Alexey Kardashevskiy
2012-07-18 11:47           ` Michael S. Tsirkin
2012-07-18 12:08           ` [Qemu-devel] [PATCH] eventfd: making it thread safe Alexey Kardashevskiy
2012-07-18 12:22             ` Michael S. Tsirkin
2012-07-18 12:58               ` Alexey Kardashevskiy
2012-07-18 12:52             ` Alexey Kardashevskiy

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=1341184071.2588.10.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mst@redhat.com \
    --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).