From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlU9q-00038N-Hf for qemu-devel@nongnu.org; Sun, 01 Jul 2012 20:06:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SlU9o-0008HQ-RK for qemu-devel@nongnu.org; Sun, 01 Jul 2012 20:06:26 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:57282) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlU9o-0008HJ-L4 for qemu-devel@nongnu.org; Sun, 01 Jul 2012 20:06:24 -0400 Received: by pbbro12 with SMTP id ro12so7559372pbb.4 for ; Sun, 01 Jul 2012 17:06:22 -0700 (PDT) Message-ID: <4FF0E5FB.1080200@ozlabs.ru> Date: Mon, 02 Jul 2012 10:06:19 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <4FF02F2C.30006@ozlabs.ru> <20120701124314.GB4782@redhat.com> <4FF04939.7050608@ozlabs.ru> <1341184071.2588.10.camel@pasglop> In-Reply-To: <1341184071.2588.10.camel@pasglop> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] QEMU question: is eventfd not thread safe? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: Alex Williamson , David Gibson , qemu-devel@nongnu.org, "Michael S. Tsirkin" On 02/07/12 09:07, Benjamin Herrenschmidt wrote: >>>> 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 ? The code which touches SIGUSR2 does not compile on power. > 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(); I already posted another patch with qemu_notify_event() in this mail thread later :) > > Cheers, > Ben. > >>>> int main_loop_init(void) >>>> { >>>> int ret; >>>> >>>> + sigusr2_init(); >>>> + >>>> qemu_mutex_lock_iothread(); >>>> ret = qemu_signal_init(); >>>> if (ret) { >>>> -- >>>> 1.7.10 >> >> > > -- Alexey