From: Andi Kleen Subject: Re: [PATCH v2 6/8] perf/x86/intel/lbr: guest requesting KVM for lbr stack save/restore Date: Fri, 7 Sep 2018 07:10:51 -0700 Message-ID: <20180907141051.GP27886@tassilo.jf.intel.com> References: <1536233456-12173-1-git-send-email-wei.w.wang@intel.com> <1536233456-12173-7-git-send-email-wei.w.wang@intel.com> <20180907032707.GN27886@tassilo.jf.intel.com> <5B920B96.6080803@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "Liang, Kan" , "peterz@infradead.org" , "mingo@redhat.com" , "rkrcmar@redhat.com" , "Xu, Like" To: Wei Wang Return-path: Content-Disposition: inline In-Reply-To: <5B920B96.6080803@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org > This could achieve the above #1, but how would it solve #2 above? That is, > after the guest uses the lbr feature for a while, the lbr stack has been > passed through, then the guest doesn't use lbr any more, but the vCPU will > still save/restore on switching? If nothing accesses the MSR LBRs after a context switch in the guest nothing gets saved/restored due to: > > Also when the LBRs haven't been set to direct access the state doesn't > > need to be saved. -Andi