Skip to content

Commit 2e0ddb3

Browse files
committed
Merge tag 'x86-fpu-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fpu updates from Ingo Molnar: - Replace zero-length array in struct xregs_state with flexible-array member, to help the enabling of stricter compiler checks. - Don't set TIF_NEED_FPU_LOAD for PF_IO_WORKER threads. * tag 'x86-fpu-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Don't set TIF_NEED_FPU_LOAD for PF_IO_WORKER threads x86/fpu: Replace zero-length array in struct xregs_state with flexible-array member
2 parents 8a68bd3 + cb3ea4b commit 2e0ddb3

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

arch/x86/include/asm/fpu/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern void fpu_flush_thread(void);
3939
static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu)
4040
{
4141
if (cpu_feature_enabled(X86_FEATURE_FPU) &&
42-
!(current->flags & PF_KTHREAD)) {
42+
!(current->flags & (PF_KTHREAD | PF_IO_WORKER))) {
4343
save_fpregs_to_fpstate(old_fpu);
4444
/*
4545
* The save operation preserved register state, so the

arch/x86/include/asm/fpu/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ struct xstate_header {
321321
struct xregs_state {
322322
struct fxregs_state i387;
323323
struct xstate_header header;
324-
u8 extended_state_area[0];
324+
u8 extended_state_area[];
325325
} __attribute__ ((packed, aligned (64)));
326326

327327
/*

arch/x86/kernel/fpu/context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static inline void fpregs_restore_userregs(void)
5757
struct fpu *fpu = &current->thread.fpu;
5858
int cpu = smp_processor_id();
5959

60-
if (WARN_ON_ONCE(current->flags & PF_KTHREAD))
60+
if (WARN_ON_ONCE(current->flags & (PF_KTHREAD | PF_IO_WORKER)))
6161
return;
6262

6363
if (!fpregs_state_valid(fpu, cpu)) {

arch/x86/kernel/fpu/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void kernel_fpu_begin_mask(unsigned int kfpu_mask)
426426

427427
this_cpu_write(in_kernel_fpu, true);
428428

429-
if (!(current->flags & PF_KTHREAD) &&
429+
if (!(current->flags & (PF_KTHREAD | PF_IO_WORKER)) &&
430430
!test_thread_flag(TIF_NEED_FPU_LOAD)) {
431431
set_thread_flag(TIF_NEED_FPU_LOAD);
432432
save_fpregs_to_fpstate(&current->thread.fpu);

0 commit comments

Comments
 (0)