[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aR04V4VVg+p4RsdT@intel.com>
Date: Wed, 19 Nov 2025 11:24:07 +0800
From: Chao Gao <chao.gao@...el.com>
To: "Xin Li (Intel)" <xin@...or.com>
CC: <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
<linux-doc@...r.kernel.org>, <pbonzini@...hat.com>, <seanjc@...gle.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>,
<hch@...radead.org>, <sohil.mehta@...el.com>
Subject: Re: [PATCH v9 12/22] KVM: VMX: Virtualize FRED event_data
>diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>index 4a74c9f64f90..0b5d04c863a8 100644
>--- a/arch/x86/kvm/vmx/vmx.c
>+++ b/arch/x86/kvm/vmx/vmx.c
>@@ -1860,6 +1860,9 @@ void vmx_inject_exception(struct kvm_vcpu *vcpu)
>
> vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, intr_info);
>
>+ if (is_fred_enabled(vcpu))
>+ vmcs_write64(INJECTED_EVENT_DATA, ex->event_data);
I think event_data should be reset to 0 in kvm_clear_exception_queue().
Otherwise, ex->event_data may be stale here, i.e., the event_data from the
previous event may be injected along with the next event.
<snip>
>+
> vmx_clear_hlt(vcpu);
> }
>
> /*
>@@ -950,6 +963,7 @@ void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned int nr,
> vcpu->arch.exception.error_code = error_code;
> vcpu->arch.exception.has_payload = false;
> vcpu->arch.exception.payload = 0;
>+ vcpu->arch.exception.event_data = event_data;
If userspace saves guest events (via kvm_vcpu_ioctl_x86_get_vcpu_events())
right after an event is requeued, event_data will be lost (as that uAPI only
saves the payload and KVM doesn't convert the event_data back to a payload
there). So this event will be delivered with incorrect event_data if the
event is restored on another system after migration.
> }
> EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_requeue_exception);
>
>--
>2.51.0
>
Powered by blists - more mailing lists