From: Dave Hansen <dave.hansen@intel.com>
To: chuang <nashuiliang@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: x86/fpu: Inaccurate AVX-512 Usage Tracking via arch_status
Date: Mon, 27 Oct 2025 07:26:19 -0700 [thread overview]
Message-ID: <c311789b-a6be-42c9-acfe-c1fdd9f4e3e1@intel.com> (raw)
In-Reply-To: <CACueBy7-1dMwPQ4mirrRjsOkKKyLchkBR+7qMVqxjo7Bbr1T=A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
On 10/27/25 00:50, chuang wrote:
> On AVX-512 capable systems, the implementation appears to record the
> current timestamp into 'task->thread.fpu.avx512_timestamp' upon any
> task switch, irrespective of whether the task has actually executed an
> AVX-512 instruction.
The timestamp update ultimately has _zero_ to do with executing
AVX-512 instructions. It's all about the state in the ZMM registers, not
AVX-512 instructions.
Those registers are inherited at fork and I don't see avx512_timestamp
being zeroed anywhere. So I suspect what you are seeing is that some
_parent_ used AVX512, and its children are getting stuck with
avx512_timestamp.
You could probably confirm this by dumping ->avx512_timestamp in
fpu_clone().
Or, try the attached patch and see if it makes things work more like
you'd expect.
[-- Attachment #2: avx512-ts-reset.patch --]
[-- Type: text/x-patch, Size: 467 bytes --]
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 1f71cc135e9a..2a8c159de5e2 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -648,6 +648,8 @@ int fpu_clone(struct task_struct *dst, u64 clone_flags, bool minimal,
/* The new task's FPU state cannot be valid in the hardware. */
dst_fpu->last_cpu = -1;
+ dst_fpu->avx512_timestamp = 0;
+
fpstate_reset(dst_fpu);
if (!cpu_feature_enabled(X86_FEATURE_FPU))
next prev parent reply other threads:[~2025-10-27 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 7:50 chuang
2025-10-27 14:26 ` Dave Hansen [this message]
2025-10-30 6:56 ` chuang
2025-10-30 15:00 ` Dave Hansen
2025-11-09 3:19 ` chuang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c311789b-a6be-42c9-acfe-c1fdd9f4e3e1@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nashuiliang@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®