From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlTFM-0005Mp-Kr for qemu-devel@nongnu.org; Sun, 01 Jul 2012 19:08:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SlTFK-0003HC-Hp for qemu-devel@nongnu.org; Sun, 01 Jul 2012 19:08:04 -0400 Received: from gate.crashing.org ([63.228.1.57]:56632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlTFK-0003H5-8T for qemu-devel@nongnu.org; Sun, 01 Jul 2012 19:08:02 -0400 Message-ID: <1341184071.2588.10.camel@pasglop> From: Benjamin Herrenschmidt Date: Mon, 02 Jul 2012 09:07:51 +1000 In-Reply-To: <4FF04939.7050608@ozlabs.ru> References: <4FF02F2C.30006@ozlabs.ru> <20120701124314.GB4782@redhat.com> <4FF04939.7050608@ozlabs.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Subject: Re: [Qemu-devel] QEMU question: is eventfd not thread safe? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alex Williamson , David Gibson , qemu-devel@nongnu.org, "Michael S. Tsirkin" > >> 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 > >