aboutsummaryrefslogtreecommitdiffstats
path: root/samples/rust/rust_driver_platform.rs
diff options
context:
space:
mode:
authorChao Gao <[email protected]>2025-03-17 14:06:11 +0000
committerIngo Molnar <[email protected]>2025-03-17 22:52:31 +0000
commitdda366083e5ff307a4a728757db874bbfe7550be (patch)
tree00b8229eec60275dd2380bde629a3a6ad36d6f40 /samples/rust/rust_driver_platform.rs
parentx86/fpu: Clarify the "xa" symbolic name used in the XSTATE* macros (diff)
downloadkernel-dda366083e5ff307a4a728757db874bbfe7550be.tar.gz
kernel-dda366083e5ff307a4a728757db874bbfe7550be.zip
x86/fpu/xstate: Fix inconsistencies in guest FPU xfeatures
Guest FPUs manage vCPU FPU states. They are allocated via fpu_alloc_guest_fpstate() and are resized in fpstate_realloc() when XFD features are enabled. Since the introduction of guest FPUs, there have been inconsistencies in the kernel buffer size and xfeatures: 1. fpu_alloc_guest_fpstate() uses fpu_user_cfg since its introduction. See: 69f6ed1d14c6 ("x86/fpu: Provide infrastructure for KVM FPU cleanup") 36487e6228c4 ("x86/fpu: Prepare guest FPU for dynamically enabled FPU features") 2. __fpstate_reset() references fpu_kernel_cfg to set storage attributes. 3. fpu->guest_perm uses fpu_kernel_cfg, affecting fpstate_realloc(). A recent commit in the tip:x86/fpu tree partially addressed the inconsistency between (1) and (3) by using fpu_kernel_cfg for size calculation in (1), but left fpu_guest->xfeatures and fpu_guest->perm still referencing fpu_user_cfg: https://lore.kernel.org/all/[email protected]/ 1937e18cc3cf ("x86/fpu: Fix guest FPU state buffer allocation size") The inconsistencies within fpu_alloc_guest_fpstate() and across the mentioned functions cause confusion. Fix them by using fpu_kernel_cfg consistently in fpu_alloc_guest_fpstate(), except for fields related to the UABI buffer. Referencing fpu_kernel_cfg won't impact functionalities, as: 1. fpu_guest->perm is overwritten shortly in fpu_init_guest_permissions() with fpstate->guest_perm, which already uses fpu_kernel_cfg. 2. fpu_guest->xfeatures is solely used to check if XFD features are enabled. Including supervisor xfeatures doesn't affect the check. Fixes: 36487e6228c4 ("x86/fpu: Prepare guest FPU for dynamically enabled FPU features") Suggested-by: Chang S. Bae <[email protected]> Signed-off-by: Chao Gao <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Vitaly Kuznetsov <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: David Woodhouse <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'samples/rust/rust_driver_platform.rs')
0 files changed, 0 insertions, 0 deletions