From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 5/5] KVM: x86: Using TSC deadline may cause multiple interrupts by user writes Date: Wed, 08 Oct 2014 11:29:40 +0200 Message-ID: <54350404.3010501@redhat.com> References: <1412287806-16016-1-git-send-email-namit@cs.technion.ac.il> <1412287806-16016-6-git-send-email-namit@cs.technion.ac.il> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Nadav Amit , joro@8bytes.org Return-path: Received: from mail-qc0-f171.google.com ([209.85.216.171]:33028 "EHLO mail-qc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754192AbaJHJ3p (ORCPT ); Wed, 8 Oct 2014 05:29:45 -0400 Received: by mail-qc0-f171.google.com with SMTP id i17so7168946qcy.2 for ; Wed, 08 Oct 2014 02:29:44 -0700 (PDT) In-Reply-To: <1412287806-16016-6-git-send-email-namit@cs.technion.ac.il> Sender: kvm-owner@vger.kernel.org List-ID: Il 03/10/2014 00:10, Nadav Amit ha scritto: > To solve this situation, ignore host initiated TSC deadline writes that do not > change the deadline value. > > Signed-off-by: Nadav Amit > --- > arch/x86/kvm/lapic.c | 7 ++++++- > arch/x86/kvm/lapic.h | 3 ++- > arch/x86/kvm/x86.c | 2 +- > 3 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index b8345dd..0bcf2e1 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -1346,14 +1346,19 @@ u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) > return apic->lapic_timer.tscdeadline; > } > > -void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) > +void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, > + struct msr_data *msr_info) > { > struct kvm_lapic *apic = vcpu->arch.apic; > + u64 data = msr_info->data; > > if (!kvm_vcpu_has_lapic(vcpu) || apic_lvtt_oneshot(apic) || > apic_lvtt_period(apic)) > return; > > + if (msr_info->host_initiated && apic->lapic_timer.tscdeadline == data) > + return; > + Why do we have to check host_initiated? Paolo