From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57180 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pu5RM-0007q5-Qp for qemu-devel@nongnu.org; Mon, 28 Feb 2011 10:55:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pu5RJ-00083g-9J for qemu-devel@nongnu.org; Mon, 28 Feb 2011 10:55:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pu5RI-00082y-Us for qemu-devel@nongnu.org; Mon, 28 Feb 2011 10:55:13 -0500 Message-ID: <4D6BC55B.9030805@redhat.com> Date: Mon, 28 Feb 2011 17:55:07 +0200 From: Avi Kivity MIME-Version: 1.0 References: <688de146287dc589a2e0fcce4cdec85d4f2c1127.1296594961.git.jan.kiszka@web.de> In-Reply-To: <688de146287dc589a2e0fcce4cdec85d4f2c1127.1296594961.git.jan.kiszka@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2 13/24] kvm: Set up signal mask also for !CONFIG_IOTHREAD List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org On 02/01/2011 11:15 PM, Jan Kiszka wrote: > From: Jan Kiszka > > Block SIG_IPI, unblock it during KVM_RUN, just like in io-thread mode. > It's unused so far, but this infrastructure will be required for > self-IPIs and to process SIGBUS plus, in KVM mode, SIGIO and SIGALRM. As > Windows doesn't support signal services, we need to provide a stub for > the init function. > This patch breaks qemu-kvm after merging. The symptoms are that Windows XP x64 does not respond when netcat connects to some server in it, via -net user,hostfwd. The vcpu thread loops indefinitely on KVM_EXIT_INTR, which is consistent with signals being messed up. I verified that 981085dd465c1 merged with ff48eb5fe79ad works, while 981085dd465c1 merged with ff48eb5fe79ad^ fails. > diff --git a/cpus.c b/cpus.c > index 42717ba..a33e470 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -231,11 +231,9 @@ fail: > return err; > } > > -#ifdef CONFIG_IOTHREAD > static void dummy_signal(int sig) > { > } > -#endif > > #else /* _WIN32 */ > > @@ -267,6 +265,32 @@ static void qemu_event_increment(void) > #endif /* _WIN32 */ > > #ifndef CONFIG_IOTHREAD > +static void qemu_kvm_init_cpu_signals(CPUState *env) > +{ > +#ifndef _WIN32 > + int r; > + sigset_t set; > + struct sigaction sigact; > + > + memset(&sigact, 0, sizeof(sigact)); > + sigact.sa_handler = dummy_signal; > + sigaction(SIG_IPI,&sigact, NULL); > + > + sigemptyset(&set); > + sigaddset(&set, SIG_IPI); > + pthread_sigmask(SIG_BLOCK,&set, NULL); > + > + pthread_sigmask(SIG_BLOCK, NULL,&set); > + sigdelset(&set, SIG_IPI); > + sigdelset(&set, SIGBUS); > + r = kvm_set_signal_mask(env,&set); > + if (r) { > + fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); > + exit(1); > + } > +#endif > +} > + > int qemu_init_main_loop(void) > { > cpu_set_debug_excp_handler(cpu_debug_handler); > @@ -292,6 +316,7 @@ void qemu_init_vcpu(void *_env) > fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); > exit(1); > } > + qemu_kvm_init_cpu_signals(env); > } > } > -- error compiling committee.c: too many arguments to function