From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v3 14/22] kvm: Fix race between timer signals and vcpu entry under !IOTHREAD Date: Mon, 31 Jan 2011 18:30:12 +0200 Message-ID: <4D46E394.9000908@redhat.com> References: <4D417F1F.7020302@siemens.com> <4D418230.1010801@siemens.com> <4D4688EB.30408@redhat.com> <4D469C87.3080909@siemens.com> <4D46B7A3.3000106@redhat.com> <4D46C7BF.6010809@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" , Stefan Hajnoczi To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40109 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752042Ab1AaQaV (ORCPT ); Mon, 31 Jan 2011 11:30:21 -0500 In-Reply-To: <4D46C7BF.6010809@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/31/2011 04:31 PM, Jan Kiszka wrote: > >> > >> And how would you be kicked out of the select() call if it is waiting > >> with a timeout? We only have a single thread here. > > > > If we use signalfd() (either kernel provided or thread+pipe), we kick > > out of select by select()ing it (though I don't see how it works without > > an iothread, since an fd can't stop a vcpu unless you enable SIGIO on > > it, which is silly for signalfd) > > > > If you leave it as a naked signal, then it can break out of either > > pselect() or vcpu. > > > > Since the goal is to drop !CONFIG_IOTHREAD, the first path seems better, > > I just don't understand the problem with emulated signalfd(). > > > > With the emulated signalfd, there won't be any signal for the VCPU while > in KVM_RUN. > I see it now - with a real signalfd, kvm unmasks the signal, and that takes precedence over signalfd and exits the vcpu. -- error compiling committee.c: too many arguments to function From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53267 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pjwdx-0002PL-Ns for qemu-devel@nongnu.org; Mon, 31 Jan 2011 11:30:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pjwdv-00051P-0C for qemu-devel@nongnu.org; Mon, 31 Jan 2011 11:30:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pjwdu-00051E-OP for qemu-devel@nongnu.org; Mon, 31 Jan 2011 11:30:18 -0500 Message-ID: <4D46E394.9000908@redhat.com> Date: Mon, 31 Jan 2011 18:30:12 +0200 From: Avi Kivity MIME-Version: 1.0 References: <4D417F1F.7020302@siemens.com> <4D418230.1010801@siemens.com> <4D4688EB.30408@redhat.com> <4D469C87.3080909@siemens.com> <4D46B7A3.3000106@redhat.com> <4D46C7BF.6010809@siemens.com> In-Reply-To: <4D46C7BF.6010809@siemens.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v3 14/22] kvm: Fix race between timer signals and vcpu entry under !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" , Stefan Hajnoczi On 01/31/2011 04:31 PM, Jan Kiszka wrote: > >> > >> And how would you be kicked out of the select() call if it is waiting > >> with a timeout? We only have a single thread here. > > > > If we use signalfd() (either kernel provided or thread+pipe), we kick > > out of select by select()ing it (though I don't see how it works without > > an iothread, since an fd can't stop a vcpu unless you enable SIGIO on > > it, which is silly for signalfd) > > > > If you leave it as a naked signal, then it can break out of either > > pselect() or vcpu. > > > > Since the goal is to drop !CONFIG_IOTHREAD, the first path seems better, > > I just don't understand the problem with emulated signalfd(). > > > > With the emulated signalfd, there won't be any signal for the VCPU while > in KVM_RUN. > I see it now - with a real signalfd, kvm unmasks the signal, and that takes precedence over signalfd and exits the vcpu. -- error compiling committee.c: too many arguments to function