[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <857ad555-4175-4816-81d7-f98ad091a1db@zytor.com>
Date: Wed, 4 Dec 2024 23:16:57 -0800
From: Xin Li <xin@...or.com>
To: Chao Gao <chao.gao@...el.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, seanjc@...gle.com, pbonzini@...hat.com,
corbet@....net, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
luto@...nel.org, peterz@...radead.org, andrew.cooper3@...rix.com
Subject: Re: [PATCH v3 16/27] KVM: VMX: Virtualize FRED nested exception
tracking
On 10/27/2024 11:33 PM, Chao Gao wrote:
>>>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>>>> index d81144bd648f..03f42b218554 100644
>>>> --- a/arch/x86/kvm/vmx/vmx.c
>>>> +++ b/arch/x86/kvm/vmx/vmx.c
>>>> @@ -1910,8 +1910,11 @@ void vmx_inject_exception(struct kvm_vcpu *vcpu)
>>>> vmcs_write32(VM_ENTRY_INSTRUCTION_LEN,
>>>> vmx->vcpu.arch.event_exit_inst_len);
>>>> intr_info |= INTR_TYPE_SOFT_EXCEPTION;
>>>> - } else
>>>> + } else {
>>>> intr_info |= INTR_TYPE_HARD_EXCEPTION;
>>>> + if (ex->nested)
>>>> + intr_info |= INTR_INFO_NESTED_EXCEPTION_MASK;
>>>
>>> how about moving the is_fred_enable() check from kvm_multiple_exception() to here? i.e.,
>>>
>>> if (ex->nested && is_fred_enabled(vcpu))
>>> intr_info |= INTR_INFO_NESTED_EXCEPTION_MASK;
>>>
>>> It is slightly clearer because FRED details don't bleed into kvm_multiple_exception().
>>
>> But FRED is all about events, including exception/interrupt/trap/...
>>
>> logically VMX nested exception only works when FRED is enabled, see how it is
>> set at 2 places in kvm_multiple_exception().
>
> "VMX nested exception only works ..." is what I referred to as "FRED details"
>
> I believe there are several reasons to decouple the "nested exception" concept
> from FRED:
>
> 1. Readers new to FRED can understand kvm_multiple_exception() without needing
> to know FRED details. Readers just need to know nested exceptions are
> exceptions encountered during delivering another event (exception/NMI/interrupts).
>
> 2. Developing KVM's generic "nested exception" concept can support other vendors.
> "nested" becomes a property of an exception. only how nested exceptions are
> reported to guests is specific to vendors (i.e., VMX/SVM).
>
> 3. This series handles ex->event_data in a similar approach: set it regardless
> of FRED enablement and let VMX/SVM code decide to consume or ignore it.
This is a nice way to look at the nature of nested exception, and I have
made the change for the next iteration.
Thanks!
Xin
Powered by blists - more mailing lists