[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250307164123.1613414-4-chao.gao@intel.com>
Date: Sat, 8 Mar 2025 00:41:16 +0800
From: Chao Gao <chao.gao@...el.com>
To: chao.gao@...el.com,
tglx@...utronix.de,
dave.hansen@...el.com,
x86@...nel.org,
seanjc@...gle.com,
pbonzini@...hat.com,
linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: peterz@...radead.org,
rick.p.edgecombe@...el.com,
weijiang.yang@...el.com,
john.allen@....com,
bp@...en8.de
Subject: [PATCH v3 03/10] x86/fpu/xstate: Correct xfeatures cache in guest pseudo fpu container
The xfeatures field in struct fpu_guest is designed to track the enabled
xfeatures for guest FPUs. However, during allocation in
fpu_alloc_guest_fpstate(), gfpu->xfeatures is initialized to
fpu_user_cfg.default_features, while the corresponding
fpstate->xfeatures is set to fpu_kernel_cfg.default_features
Correct the mismatch to avoid confusion.
Note this mismatch does not cause any functional issues. The
gfpu->xfeatures is checked in fpu_enable_guest_xfd_features() to
verify if XFD features are already enabled:
xfeatures &= ~guest_fpu->xfeatures;
if (!xfeatures)
return 0;
It gets updated in fpstate_realloc() after enabling some XFD features:
guest_fpu->xfeatures |= xfeatures;
So, backport is not needed.
Signed-off-by: Chao Gao <chao.gao@...el.com>
---
arch/x86/kernel/fpu/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index dc169f3d336d..6166a928d3f5 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -230,7 +230,7 @@ bool fpu_alloc_guest_fpstate(struct fpu_guest *gfpu)
fpstate->is_guest = true;
gfpu->fpstate = fpstate;
- gfpu->xfeatures = fpu_user_cfg.default_features;
+ gfpu->xfeatures = fpu_kernel_cfg.default_features;
/*
* KVM sets the FP+SSE bits in the XSAVE header when copying FPU state
--
2.46.1
Powered by blists - more mailing lists