From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031221AbdI0BYh (ORCPT ); Tue, 26 Sep 2017 21:24:37 -0400 Received: from mga14.intel.com ([192.55.52.115]:50108 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968827AbdI0BYg (ORCPT ); Tue, 26 Sep 2017 21:24:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,442,1500966000"; d="scan'208";a="1176151460" Message-ID: <59CAFE92.8090608@intel.com> Date: Wed, 27 Sep 2017 09:27:46 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andi Kleen CC: virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, mst@redhat.com, rkrcmar@redhat.com, mingo@redhat.com Subject: Re: [PATCH v1 4/4] KVM/vmx: enable lbr for the guest References: <1506314696-4632-1-git-send-email-wei.w.wang@intel.com> <1506314696-4632-5-git-send-email-wei.w.wang@intel.com> <20170925145720.GM4311@tassilo.jf.intel.com> <59CA164B.1080707@intel.com> <20170926164114.GQ4311@tassilo.jf.intel.com> In-Reply-To: <20170926164114.GQ4311@tassilo.jf.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/27/2017 12:41 AM, Andi Kleen wrote: >> 1) vCPU context switching and guest side task switching are not identical. >> That is, when the vCPU is scheduled out, the guest task on the vCPU may not > guest task lifetime has nothing to do with this. It's completely independent > of what you do here on the VCPU level. > >> run out its time slice yet, so the task will continue to run when the vCPU >> is >> scheduled in by the host (lbr wasn't save by the guest task when the vCPU is >> scheduled out in this case). >> >> It is possible to have the vCPU which runs the guest task (in use of lbr) >> scheduled >> out, followed by a new host task being scheduled in on the pCPU to run. >> It is not guaranteed that the new host task does not use the LBR feature on >> the >> pCPU. > Sure it may use the LBR, and the normal perf context switch > will switch it and everything works fine. > > It's like any other per-task LBR user. OK, I see the point, thanks. Why couldn't we save the LBR_SELECT via task switching too? Best, Wei