Skip to content

Commit 191cf7f

Browse files
committed
Merge tag 'x86_fpu_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fpu update from Borislav Petkov: "A single x86/fpu update for 5.17: - Exclude AVX opmask registers use from AVX512 state tracking as they don't contribute to frequency throttling" * tag 'x86_fpu_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Correct AVX512 state tracking
2 parents 8cc1e20 + 0fe4ff8 commit 191cf7f

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

arch/x86/kernel/fpu/core.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ bool irq_fpu_usable(void)
9898
}
9999
EXPORT_SYMBOL(irq_fpu_usable);
100100

101+
/*
102+
* Track AVX512 state use because it is known to slow the max clock
103+
* speed of the core.
104+
*/
105+
static void update_avx_timestamp(struct fpu *fpu)
106+
{
107+
108+
#define AVX512_TRACKING_MASK (XFEATURE_MASK_ZMM_Hi256 | XFEATURE_MASK_Hi16_ZMM)
109+
110+
if (fpu->fpstate->regs.xsave.header.xfeatures & AVX512_TRACKING_MASK)
111+
fpu->avx512_timestamp = jiffies;
112+
}
113+
101114
/*
102115
* Save the FPU register state in fpu->fpstate->regs. The register state is
103116
* preserved.
@@ -116,13 +129,7 @@ void save_fpregs_to_fpstate(struct fpu *fpu)
116129
{
117130
if (likely(use_xsave())) {
118131
os_xsave(fpu->fpstate);
119-
120-
/*
121-
* AVX512 state is tracked here because its use is
122-
* known to slow the max clock speed of the core.
123-
*/
124-
if (fpu->fpstate->regs.xsave.header.xfeatures & XFEATURE_MASK_AVX512)
125-
fpu->avx512_timestamp = jiffies;
132+
update_avx_timestamp(fpu);
126133
return;
127134
}
128135

0 commit comments

Comments
 (0)