[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3576c721-3ef2-40bd-8764-b50912df93a2@intel.com>
Date: Thu, 28 Nov 2024 08:26:29 +0200
From: Adrian Hunter <adrian.hunter@...el.com>
To: Yan Zhao <yan.y.zhao@...el.com>
Cc: Binbin Wu <binbin.wu@...ux.intel.com>, Xiaoyao Li <xiaoyao.li@...el.com>,
pbonzini@...hat.com, seanjc@...gle.com, kvm@...r.kernel.org,
dave.hansen@...ux.intel.com, rick.p.edgecombe@...el.com,
kai.huang@...el.com, reinette.chatre@...el.com,
tony.lindgren@...ux.intel.com, dmatlack@...gle.com,
isaku.yamahata@...el.com, nik.borisov@...e.com,
linux-kernel@...r.kernel.org, x86@...nel.org, chao.gao@...el.com,
weijiang.yang@...el.com
Subject: Re: [PATCH 2/7] KVM: TDX: Implement TDX vcpu enter/exit path
On 28/11/24 07:56, Yan Zhao wrote:
> On Fri, Nov 22, 2024 at 04:33:27PM +0200, Adrian Hunter wrote:
>> On 22/11/24 07:56, Binbin Wu wrote:
>>>
>>>
>>>
>>> On 11/22/2024 1:23 PM, Xiaoyao Li wrote:
>>> [...]
>>>>> +
>>>>> +fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit)
>>>>> +{
>>>>> + struct vcpu_tdx *tdx = to_tdx(vcpu);
>>>>> +
>>>>> + /* TDX exit handle takes care of this error case. */
>>>>> + if (unlikely(tdx->state != VCPU_TD_STATE_INITIALIZED)) {
>>>>> + /* Set to avoid collision with EXIT_REASON_EXCEPTION_NMI. */
>>>>
>>>> It seems the check fits better in tdx_vcpu_pre_run().
>>>
>>> Indeed, it's cleaner to move the check to vcpu_pre_run.
>>> Then no need to set the value to vp_enter_ret, and the comments are not
>>> needed.
>>
>> And we can take out the same check in tdx_handle_exit()
>> because it won't get there if ->vcpu_pre_run() fails.
>
> And also check for TD_STATE_RUNNABLE in tdx_vcpu_pre_run()?
Yes, let's also do that.
>
>>>
>>>>
>>>> And without the patch of how TDX handles Exit (i.e., how deal with vp_enter_ret), it's hard to review this comment.
>>>>
>>>>> + tdx->vp_enter_ret = TDX_SW_ERROR;
>>>>> + return EXIT_FASTPATH_NONE;
>>>>> + }
>>>>> +
>>>>> + trace_kvm_entry(vcpu, force_immediate_exit);
>>>>> +
>>>>> + tdx_vcpu_enter_exit(vcpu);
>>>>> +
>>>>> + vcpu->arch.regs_avail &= ~VMX_REGS_LAZY_LOAD_SET;
>>>>> + trace_kvm_exit(vcpu, KVM_ISA_VMX);
>>>>> +
>>>>> + return EXIT_FASTPATH_NONE;
>>>>> +}
>>>>> +
>>> [...]
>>
Powered by blists - more mailing lists