[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f733543-200e-9ddd-240b-1f956a003ed6@intel.com>
Date: Sun, 7 Feb 2021 09:02:35 +0800
From: "Xu, Like" <like.xu@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Like Xu <like.xu@...ux.intel.com>
Subject: Re: [PATCH v2 4/4] KVM: x86: Expose Architectural LBR CPUID and its
XSAVES bit
On 2021/2/5 19:00, Paolo Bonzini wrote:
> On 05/02/21 09:16, Xu, Like wrote:
>> Hi Paolo,
>>
>> I am wondering if it is acceptable for you to
>> review the minor Architecture LBR patch set without XSAVES for v5.12 ?
>>
>> As far as I know, the guest Arch LBR can still work without XSAVES
>> support.
>
> I dopn't think it can work. You could have two guests on the same
> physical CPU and the MSRs would be corrupted if the guests write to the
> MSR but they do not enable the LBRs.
>
> Paolo
>
Neither Arch LBR nor the old version of LBR have this corruption issue,
and we will not use XSAVES for at least LBR MSRs in the VMX transaction.
This is because we have reused the LBR save/restore swicth support from the
host perf mechanism in the legacy LBR support, which will save/restore the LBR
MSRs of the vcpu (thread) when the vcpu is sched in/out.
Therefore, if we have two guests on the same physical CPU, the usage of LBR
MSRs
is isolated, and it's also true when we use LBR to trace the hypervisor on
the host.
The same thing happens on the platforms which supports Arch LBR.
I propose that we don't support using XSAVES to save/restore Arch LRB *in
the guest*
(just like the guest Intel PT), but use the traditional RD/WRMSR, which
still works
like the legacy LBR.
Since we already have legacy LBR support, we can add a small amount of
effort (just
two more MSRs emulation and related CPUID exposure) to support Arch LBR w/o
XSAVES.
I estimate that there are many issues we need to address when we supporting
guests
to use xsaves instructions. As a rational choice, we could enable the basic
Arch LBR.
Paolo and Sean, what do you think ?
---
thx, likexu
Powered by blists - more mailing lists