[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMy6INjzYiVqOKEy@chao-email>
Date: Fri, 4 Aug 2023 16:43:12 +0800
From: Chao Gao <chao.gao@...el.com>
To: Yang Weijiang <weijiang.yang@...el.com>
CC: <seanjc@...gle.com>, <pbonzini@...hat.com>, <peterz@...radead.org>,
<john.allen@....com>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <rick.p.edgecombe@...el.com>,
<binbin.wu@...ux.intel.com>
Subject: Re: [PATCH v5 15/19] KVM:x86: Optimize CET supervisor SSP save/reload
On Thu, Aug 03, 2023 at 12:27:28AM -0400, Yang Weijiang wrote:
>Make PL{0,1,2}_SSP as write-intercepted to detect whether
>guest is using these MSRs. Disable intercept to the MSRs
>if they're written with non-zero values. KVM does save/
>reload for the MSRs only if they're used by guest.
What would happen if guest tries to use XRSTORS to load S_CET state from a
xsave area without any writes to the PL0-2_SSP (i.e., at that point, writes to
the MSRs are still intercepted)?
>@@ -2420,6 +2432,14 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> else
> vmx->pt_desc.guest.addr_a[index / 2] = data;
> break;
>+ case MSR_IA32_PL0_SSP ... MSR_IA32_PL2_SSP:
>+ if (kvm_set_msr_common(vcpu, msr_info))
>+ return 1;
>+ if (data) {
>+ vmx_disable_write_intercept_sss_msr(vcpu);
>+ wrmsrl(msr_index, data);
Is it necessary to do the wrmsl()?
looks the next kvm_x86_prepare_switch_to_guest() will load PL0-2_SSP from the
caching values.
Powered by blists - more mailing lists