FAILED: patch "[PATCH] KVM: VMX: Formally define KVM's "0xdead" exit reason used for" failed to apply to 6.18-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x d85f7dc8cf3c91a131946dae4c3aa8d9c97322d7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026110438-shrink-panic-2119@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d85f7dc8cf3c91a131946dae4c3aa8d9c97322d7 Mon Sep 17 00:00:00 2001
From: Sean Christopherson <[email protected]>
Date: Mon, 21 Sep 2026 16:56:55 -0700
Subject: [PATCH] KVM: VMX: Formally define KVM's "0xdead" exit reason used for
failed VM-Enter
Add EXIT_REASON_UNDEFINED to track KVM's magic "0xdead" value that's used to stuff the exit reason on a failed VM-Enter so that the magic can be reused by TDX, and to make it more obvious that it's an arbitrary, KVM- defined value (though the whole "dead" thing makes it pretty darn obvious).
Opportunistically add a compile-time assert to ensure the KVM-defined exit reason never collides with a "real" exit reason.
No functional change intended.
arch/x86/include/asm/vmx.h +8 -0
@@ -20,6 +20,14 @@#include <asm/trapnr.h> #include <asm/vmxfeatures.h> +/* +* UNDEFINED is a KVM-defined value used to indicate that the basic exit reason +* is undefined/invalid, e.g. on VM-Fail or if TDX never attempted VM-Enter. +* The value itself is arbitrary, it just needs to not collide with a real exit +* reason. +*/ +#define EXIT_REASON_UNDEFINED 0xdead +struct vmcs_hdr {u32 revision_id:31 ;u32 shadow_vmcs:1 ;
arch/x86/kvm/vmx/vmx.c +3 -1
@@ -6388,6 +6388,8 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {static const int kvm_vmx_max_exit_handlers =ARRAY_SIZE (kvm_vmx_exit_handlers); +static_assert (EXIT_REASON_UNDEFINED >=ARRAY_SIZE (kvm_vmx_exit_handlers)); +void vmx_get_exit_info (struct kvm_vcpu *vcpu,u32 *reason,u64 *info1,u64 *info2,u32 *intr_info,u32 *error_code) {
@@ -7474,7 +7476,7 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,vmx_enable_fb_clear (vmx);if (unlikely (vmx->fail)) { - vmx->vt.exit_reason.full =0xdead ; + vmx->vt.exit_reason.full =EXIT_REASON_UNDEFINED ; goto out; }
PATCH 1/1 KVM: VMX: Formally define KVM's "0xdead" exit reason used for failed VM-Enter
From: Sean Christopherson <[email protected]>
[ Upstream commit d85f7dc8cf3c91a131946dae4c3aa8d9c97322d7 ]
Add EXIT_REASON_UNDEFINED to track KVM's magic "0xdead" value that's used to stuff the exit reason on a failed VM-Enter so that the magic can be reused by TDX, and to make it more obvious that it's an arbitrary, KVM- defined value (though the whole "dead" thing makes it pretty darn obvious).
Opportunistically add a compile-time assert to ensure the KVM-defined exit reason never collides with a "real" exit reason.
No functional change intended.
--- arch/x86/include/asm/vmx.h | 8 ++++++++ arch/x86/kvm/vmx/vmx.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/include/asm/vmx.h +8 -0
@@ -20,6 +20,14 @@#include <asm/trapnr.h> #include <asm/vmxfeatures.h> +/* +* UNDEFINED is a KVM-defined value used to indicate that the basic exit reason +* is undefined/invalid, e.g. on VM-Fail or if TDX never attempted VM-Enter. +* The value itself is arbitrary, it just needs to not collide with a real exit +* reason. +*/ +#define EXIT_REASON_UNDEFINED 0xdead +#define VMCS_CONTROL_BIT (x) BIT(VMX_FEATURE_##x & 0x1f)/*
arch/x86/kvm/vmx/vmx.c +3 -1
@@ -6173,6 +6173,8 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {static const int kvm_vmx_max_exit_handlers =ARRAY_SIZE (kvm_vmx_exit_handlers); +static_assert (EXIT_REASON_UNDEFINED >=ARRAY_SIZE (kvm_vmx_exit_handlers)); +void vmx_get_exit_info (struct kvm_vcpu *vcpu,u32 *reason,u64 *info1,u64 *info2,u32 *intr_info,u32 *error_code) {
@@ -7354,7 +7356,7 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,vmx_enable_fb_clear (vmx);if (unlikely (vmx->fail)) { - vmx->vt.exit_reason.full =0xdead ; + vmx->vt.exit_reason.full =EXIT_REASON_UNDEFINED ; goto out; }
Signature · 1 line
2.53.0
Re: [PATCH 6.18.y] KVM: VMX: Formally define KVM's "0xdead" exit reason used for failed VM-Enter
Quoted 24 lines · Xiaoyao Li
From: Sean Christopherson <[email protected]>
[ Upstream commit
d85f7dc8cf3c91a131946dae4c3aa8d9c97322d7]Add
EXIT_REASON_UNDEFINEDto track KVM's magic "0xdead" value that's used to stuff the exit reason on a failed VM-Enter so that the magic can be reused by TDX, and to make it more obvious that it's an arbitrary, KVM- defined value (though the whole "dead" thing makes it pretty darn obvious).Opportunistically add a compile-time assert to ensure the KVM-defined exit reason never collides with a "real" exit reason.
No functional change intended.
Cc Xiaoyao Li <[email protected]>Cc Yan Zhao <[email protected]>Cc Binbin Wu <[email protected]>Cc Rick Edgecombe <[email protected]>Reviewed-by Binbin Wu <[email protected]>Reviewed-by Xiaoyao Li <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Signed-off-by Xiaoyao Li <[email protected]>
Quoted 1 line
---
In the future, please provide a quick explanation of the conflict resolution(s), it helps me assess the safety/correctness of the backport, and provides a paper trail to help with debug in case the backport introduces a bug.
For this, there was a superficial conflict due to lack of upstream commit 3c75e6a5da3c0 ("KVM: VMX: Move architectural "vmcs" and "vmcs_hdr" structures to public vmx.h").
Re: [PATCH 6.18.y] KVM: VMX: Formally define KVM's "0xdead" exit reason used for failed VM-Enter
In reply to Xiaoyao LiQuoted 2 lines
Add
EXIT_REASON_UNDEFINEDto track KVM's magic "0xdead" value that's used to stuff the exit reason on a failed VM-Enter
Queued for 6.18 and 6.12, thanks.
Signature · 2 lines
Thanks, Sasha