From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [RFC PATCH] KVM: x86: Skip request checking branches in vcpu_enter_guest() more effectively Date: Fri, 5 Oct 2012 01:11:52 +0900 Message-ID: <20121005011152.0ef3b66c729bbcedf952f0f5@gmail.com> References: <20120924152447.36c71b8f.yoshikawa_takuya_b1@lab.ntt.co.jp> <20120924071612.GE20907@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Takuya Yoshikawa , avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mail-pb0-f46.google.com ([209.85.160.46]:44884 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757061Ab2JDQL5 (ORCPT ); Thu, 4 Oct 2012 12:11:57 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so745666pbb.19 for ; Thu, 04 Oct 2012 09:11:57 -0700 (PDT) In-Reply-To: <20120924071612.GE20907@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 24 Sep 2012 09:16:12 +0200 Gleb Natapov wrote: > Yes, for guests that do not enable steal time KVM_REQ_STEAL_UPDATE > should be never set, but currently it is. The patch (not tested) should > fix this. Thinking a bit more about KVM_REQ_STEAL_UPDATE... > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 901ad00..01572f5 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -1544,6 +1544,8 @@ static void accumulate_steal_time(struct kvm_vcpu *vcpu) > delta = current->sched_info.run_delay - vcpu->arch.st.last_steal; > vcpu->arch.st.last_steal = current->sched_info.run_delay; > vcpu->arch.st.accum_steal = delta; > + > + kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu); > } Even without this flag, we know when we should record the steal time: that's when vcpu->arch.st.accum_steal != 0. > > static void record_steal_time(struct kvm_vcpu *vcpu) So we can live without KVM_REQ_STEAL_UPDATE and make record_steal_time() do the job when vcpu->arch.st.accum_steal != 0 so that it can be called unconditionally in vcpu_enter_guest(). Why didn't we do that? The only reason I can think of is we wanted to eliminate that check for the zero-requests case. But does such a micro-optimization really help us? Thanks, Takuya