From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: [PATCH v2 7/8] KVM: PMU: support to save/restore the guest lbr stack on vCPU switching Date: Mon, 17 Sep 2018 19:56:16 -0700 Message-ID: <20180918025616.GA10360@tassilo.jf.intel.com> References: <1536233456-12173-1-git-send-email-wei.w.wang@intel.com> <1536233456-12173-8-git-send-email-wei.w.wang@intel.com> <33183CC9F5247A488A2544077AF19020DB0F1D5F@dggeml511-mbx.china.huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Wei Wang , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "kan.liang@intel.com" , "peterz@infradead.org" , "mingo@redhat.com" , "rkrcmar@redhat.com" , "like.xu@intel.com" To: "Gonglei (Arei)" Return-path: Content-Disposition: inline In-Reply-To: <33183CC9F5247A488A2544077AF19020DB0F1D5F@dggeml511-mbx.china.huawei.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org > > From: Like Xu > > > > This patch adds support to KVM to save/restore the lbr stack on vCPU > > context switching. > > > > When the guest sets the ACTIVE bit of MSR_KVM_PV_LBR_CTRL, a perf event > > is created on the host for the related vCPU. This perf event ensures the > > LBR stack to be saved/restored when the vCPU thread is scheduled out/in. > > The perf event is removed and freed when the guest clears the ACTIVE > > bit. > > > > What about live migration? Does LBR stack need to be saved on the source side and > restored on the dest side with the passthrough mode? Yes it should. Either for call stack LBR, or when it is frozen/disabled. When it's not frozen/disabled and not in call stack LBR mode it likely doesn't hurt either, but it's not strictly needed because it will be replaced so quickly. -Andi