Re: [PATCH v10 13/28] KVM: VMX: Virtualize FRED nested exception tracking

From: Sohil Mehta

Date: Fri Nov 06 2026 - 14:53:41 EST


On 10/29/2026 1:41 AM, Binbin Wu wrote:

>> Note, like the other fields of struct kvm_queued_exception, the nested
>> flag is meaningful only while the exception is pending or injected. It
>> is not consulted otherwise, and so doesn't need to be cleared when an
>> exception is dropped.
>
> Just try to understand the sentence.
> The patch clears is_nested alongside pending/injected in two places:
> 1. kvm_clear_exception_queue()
> 2. When the exception from userspace is converted to a nested vm exit.
>
> So are they needed?
>

I don't think they are needed any longer. v9 needed the clear in
kvm_clear_exception_queue() because the old flag was ORed into the new
one. But, now kvm_multiple_exception() uses a local variable. So both
the above clears can be removed.

>>
>> Signed-off-by: Xin Li (Intel) <xin@xxxxxxxxx>
>> [ Sean: reworked kvm_requeue_exception() to simply the code changes ]
> ^
> simplify
>

This handler comment that got added early on in the series seems a bit
out of place now. I'll drop it or maybe change it to a Co-developed-by
if the original code that Sean suggested is still being used.

>> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
>> Signed-off-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
>> Reviewed-by: Chao Gao <chao.gao@xxxxxxxxx>
>
> [...]
>
>> @@ -8978,6 +8993,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>> ex->has_payload, ex->payload);
>> ex->injected = false;
>> ex->pending = false;
>> + ex->is_nested = false;
>> }
>> vcpu->arch.exception_from_userspace = false;
>>
>> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
>> index 0f5919b092e4..2d6bae66cfae 100644
>> --- a/arch/x86/kvm/x86.h
>> +++ b/arch/x86/kvm/x86.h
>> @@ -158,6 +158,7 @@ static inline void kvm_clear_exception_queue(struct kvm_vcpu *vcpu)
>> {
>> vcpu->arch.exception.pending = false;
>> vcpu->arch.exception.injected = false;
>> + vcpu->arch.exception.is_nested = false;
>> vcpu->arch.exception_vmexit.pending = false;
>> }
>