From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v3 1/6] KVM: Don't use KVM_REQ_PENDING_TIMER Date: Tue, 10 Jul 2012 12:13:20 +0300 Message-ID: <4FFBF230.8010700@redhat.com> References: <1341853545-3023-1-git-send-email-avi@redhat.com> <1341853545-3023-2-git-send-email-avi@redhat.com> <20120710085002.GB23898@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754684Ab2GJJN1 (ORCPT ); Tue, 10 Jul 2012 05:13:27 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6A9DQGb020838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Jul 2012 05:13:26 -0400 In-Reply-To: <20120710085002.GB23898@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/10/2012 11:50 AM, Gleb Natapov wrote: > On Mon, Jul 09, 2012 at 08:05:40PM +0300, Avi Kivity wrote: > > It's a write-only bit, set by the timer and cleared by the main loop. > > Remove it. Retain the definition since ppc uses it. > > > > Signed-off-by: Avi Kivity > > --- > > arch/x86/kvm/timer.c | 8 ++------ > > arch/x86/kvm/x86.c | 1 - > > 2 files changed, 2 insertions(+), 7 deletions(-) > > > > diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c > > index 6b85cc6..c28f838 100644 > > --- a/arch/x86/kvm/timer.c > > +++ b/arch/x86/kvm/timer.c > > @@ -27,14 +27,10 @@ enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) > > /* > > * There is a race window between reading and incrementing, but we do > > * not care about potentially losing timer events in the !reinject > > - * case anyway. Note: KVM_REQ_PENDING_TIMER is implicitly checked > > - * in vcpu_enter_guest. > So what about the part that says "KVM_REQ_PENDING_TIMER is implicitly > checked in vcpu_enter_guest"? This patch drops the check. So now if > timer triggers while vcpu is in userspace it will enter guest mode > without injecting timer interrupt on the next ioctl(KVM_RUN). Or do I > miss something here? You're right, the bit appears to be write-only, but it isn't. The check inside the critical section for vcpu->requests reads it. I guess we can make the check explicit by doing a 'goto out' if the bit is set. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.