Re: [PATCH v2 2/3] KVM: TDX: Fix the exit reason handling
Xiaoyao Li <[email protected]>
| Newsgroups | dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/11/2026 11:20 PM, Edgecombe, Rick P wrote:
> On Tue, 2026-08-11 at 09:32 +0800, Xiaoyao Li wrote:
>>> We could make this return instead be a goto err; that returns this. Bonus is
>>> the
>>> comment on the other one can cover them both. What do you think?
>>
>> Given 1) this patch is here mainly to avoid the false-positive on
>> bus_lock_detected after the next patch,
>
> Hmm. Before this patch these are just one line returns. So a "goto err" would be
> unneeded. After this single line is expanded to be something more elaborate, and
> a comment is added around one of these more elaborate returns, but not the
> other. So I consider it a bit of a style regression. Which makes it appropriate
> to adjust it in the patch IMO.
Well, actually the added comment cannot be shared. For the
EXIT_REASON_EPT_MISCONFIG case, the reason to return a synthesized
invalid Exit Reason is to differentiate with the case of
TDVMCALL(ept_violation), where the exit reason is updated to EPT_MISCONFIG.
In fact, we don't need such trick for real EPT_MISCONFIG, because there
is handling for real EPT_MISCONFIG in tdx_handle_exit()
if (unlikely(vp_enter_ret == EXIT_REASON_EPT_MISCONFIG)) {
KVM_BUG_ON(1, vcpu->kvm);
return -EIO;
}
before the handling of transformed EPT_MISCONFIG from
TDVMCALL(ept_violation)
switch (exit_reason.basic) {
...
case EXIT_REASON_EPT_MISCONFIG:
return tdx_emulate_mmio(vcpu);
But it's not urgent to fix it and it's not mandatory to enable Bus Lock
VM exit on TDX. Let's leave it to the follow-up series.