[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zx8wS/wAI99yLmPh@intel.com>
Date: Mon, 28 Oct 2024 14:33:47 +0800
From: Chao Gao <chao.gao@...el.com>
To: Xin Li <xin@...or.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
>> > 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.
Powered by blists - more mailing lists