Add Intel Lunarlake to X86_BUG_MONITOR
Subsystems (2)
cover Add Intel Lunarlake to X86_BUG_MONITOR
Early adopters of Intel Lunar Lake systems have noticed unacceptable GUI delays. This patch addresses those systems.
[PATCH] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
Upstream patch, also applies to 6.11
[PATCH backport to 6.10] x86/cpu: Add INTEL_FAM6_LUNARLAKE_M to X86_BUG_MONITOR
Backport to 6.10 for old model number scheme
PATCH 1/1 x86/cpu: Add INTEL_FAM6_LUNARLAKE_M to X86_BUG_MONITOR
From: Len Brown <[email protected]>
Under some conditions, MONITOR wakeups on Lunar Lake processors can be lost, resulting in significant user-visible delays.
Add LunarLake to X86_BUG_MONITOR so that wake_up_idle_cpu() always sends an IPI, avoiding this potential delay. Update the X86_BUG_MONITOR workaround to handle the new smp_kick_mwait_play_dead() path.
---
This is a backport of the upstream patch to Linux-6.10 and earlier
--- arch/x86/kernel/cpu/intel.c | 3 ++- arch/x86/kernel/smpboot.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +2 -1
@@ -583,7 +583,8 @@ static void init_intel(struct cpuinfo_x86 *c)set_cpu_bug (c,X86_BUG_CLFLUSH_MONITOR );if (c->x86 ==6 &&boot_cpu_has (X86_FEATURE_MWAIT ) && - ((c->x86_model ==INTEL_FAM6_ATOM_GOLDMONT ))) + ((c->x86_model ==INTEL_FAM6_ATOM_GOLDMONT ) || + (c->x86_model ==INTEL_FAM6_LUNARLAKE_M )))set_cpu_bug (c,X86_BUG_MONITOR );#ifdef CONFIG_X86_64
arch/x86/kernel/smpboot.c +3 -0
@@ -1376,6 +1376,9 @@ void smp_kick_mwait_play_dead(void)for (i =0 ;READ_ONCE (md->status) != newstate && i <1000 ; i++) {/* Bring it out of mwait */ WRITE_ONCE (md->control, newstate); +/* If MWAIT unreliable, send IPI */ +if (boot_cpu_has_bug (X86_BUG_MONITOR )) +__apic_send_IPI (cpu,RESCHEDULE_VECTOR );udelay (5 ); }
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH backport to 6.10] x86/cpu: Add INTEL_FAM6_LUNARLAKE_M to X86_BUG_MONITOR
FYI: kernel test robot notices the stable kernel rule is not satisfied.
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-3
Rule: The upstream commit ID must be specified with a separate line above the commit text.
Subject: [PATCH backport to 6.10] x86/cpu: Add INTEL_FAM6_LUNARLAKE_M to X86_BUG_MONITOR
Please ignore this mail if the patch is not relevant for upstream.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH backport to 6.10] x86/cpu: Add INTEL_FAM6_LUNARLAKE_M to X86_BUG_MONITOR
In reply to Len BrownQuoted 10 lines · Len Brown
From: Len Brown <[email protected]>
Under some conditions, MONITOR wakeups on Lunar Lake processors can be lost, resulting in significant user-visible delays.
Add LunarLake to
X86_BUG_MONITORso thatwake_up_idle_cpu()always sends an IPI, avoiding this potential delay. Update theX86_BUG_MONITORworkaround to handle the newsmp_kick_mwait_play_dead()path.
Quoted 6 lines
Cc [email protected] # 6.10Signed-off-by Len Brown <[email protected]>---
This is a backport of the upstream patch to Linux-6.10 and earlier
You either fail to understand or intentionally ignore the process for stable backports, which is in place since more than a decade.
Documentation/process/* has plenty of information how that works and you're around long enough to know that already.
I don't care about you wasting your time, but I very much care about you wasting my time to deal with pointless emails. I get plenty enough of them every day.
Thanks,
tglx
PATCH 1/1 x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
In reply to Len BrownFrom: Len Brown <[email protected]>
Under some conditions, MONITOR wakeups on Lunar Lake processors can be lost, resulting in significant user-visible delays.
Add LunarLake to X86_BUG_MONITOR so that wake_up_idle_cpu() always sends an IPI, avoiding this potential delay.
Also update the X86_BUG_MONITOR workaround to handle the new smp_kick_mwait_play_dead() path.
--- arch/x86/kernel/cpu/intel.c | 3 ++- arch/x86/kernel/smpboot.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +2 -1
@@ -586,7 +586,8 @@ static void init_intel(struct cpuinfo_x86 *c) c->x86_vfm == INTEL_WESTMERE_EX))set_cpu_bug (c,X86_BUG_CLFLUSH_MONITOR ); -if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT || c->x86_vfm ==INTEL_LUNARLAKE_M ))set_cpu_bug (c,X86_BUG_MONITOR );#ifdef CONFIG_X86_64
arch/x86/kernel/smpboot.c +3 -0
@@ -1377,6 +1377,9 @@ void smp_kick_mwait_play_dead(void)for (i =0 ;READ_ONCE (md->status) != newstate && i <1000 ; i++) {/* Bring it out of mwait */ WRITE_ONCE (md->control, newstate); +/* If MONITOR unreliable, send IPI */ +if (boot_cpu_has_bug (X86_BUG_MONITOR )) +__apic_send_IPI (cpu,RESCHEDULE_VECTOR );udelay (5 ); }
Signature · 1 line
2.43.0
Re: [PATCH] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
Quoted 9 lines · Len Brown
From: Len Brown <[email protected]>
Under some conditions, MONITOR wakeups on Lunar Lake processors can be lost, resulting in significant user-visible delays.
Add LunarLake to
X86_BUG_MONITORso thatwake_up_idle_cpu()always sends an IPI, avoiding this potential delay.
Quoted 7 lines
Also update the
X86_BUG_MONITORworkaround to handle the newsmp_kick_mwait_play_dead()path.Cc [email protected] # 6.11Signed-off-by Len Brown <[email protected]>
Overall
Quoted 24 lines
--- arch/x86/kernel/cpu/intel.c | 3 ++- arch/x86/kernel/smpboot.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/intel.c +2
-1@@ -586,7 +586,8 @@ static void init_intel(struct cpuinfo_x86 *c) c->x86_vfm == INTEL_WESTMERE_EX))set_cpu_bug (c,X86_BUG_CLFLUSH_MONITOR ); -if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT || c->x86_vfm ==INTEL_LUNARLAKE_M ))set_cpu_bug (c,X86_BUG_MONITOR );#ifdef CONFIG_X86_64 arch/x86/kernel/smpboot.c +0
-0
arch/x86/kernel/smpboot.c void smp_kick_mwait_play_dead(void) · line 1382
Quoted 6 lines
arch/x86/kernel/smpboot.c +3
-0@@ -1377,6 +1377,9 @@ void smp_kick_mwait_play_dead(void)for (i =0 ;READ_ONCE (md->status) != newstate && i <1000 ; i++) {/* Bring it out of mwait */ WRITE_ONCE (md->control, newstate); +/* If MONITOR unreliable, send IPI */ +if (boot_cpu_has_bug (X86_BUG_MONITOR )) +__apic_send_IPI (cpu,RESCHEDULE_VECTOR );
The __apic_send_IPI() call could be wrapped into something like __native_smp_send_reschedule() to underline the analogy between this and what happens in native_smp_send_reschedule().
It is still fine as is though IMV.
Quoted 4 lines
arch/x86/kernel/smpboot.c +0
-1udelay (5 ); } --
Re: [PATCH] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
In reply to Len Brownarch/x86/kernel/smpboot.c void smp_kick_mwait_play_dead(void) · line 1384
Quoted 13 lines · Len Brown
arch/x86/kernel/smpboot.c +3
-0@@ -1377,6 +1377,9 @@ void smp_kick_mwait_play_dead(void)for (i =0 ;READ_ONCE (md->status) != newstate && i <1000 ; i++) {/* Bring it out of mwait */ WRITE_ONCE (md->control, newstate); +/* If MONITOR unreliable, send IPI */ +if (boot_cpu_has_bug (X86_BUG_MONITOR )) +__apic_send_IPI (cpu,RESCHEDULE_VECTOR );udelay (5 ); }
Going over that code again, mwait_play_dead() is doing __mwait(.exc=0) with IRQs disabled.
So that IPI you're trying to send there won't do no nothing :-/
Now that comment there says MCE/NMI/SMI are still open (non-maskable etc.) so perhaps prod it on the NMI vector?
This does seem to suggest the above code path wasn't actually tested. Perhaps mark your local machine with BUG_MONITOR, remove the md->control WRITE_ONCE() and try kexec to test it?
Thomas, any other thoughts?
Re: [PATCH] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
Quoted 17 lines · Peter Zijlstra
arch/x86/kernel/smpboot.c void smp_kick_mwait_play_dead(void) · line 1384
Quoted 13 lines · Len Brown
arch/x86/kernel/smpboot.c +3
-0@@ -1377,6 +1377,9 @@ void smp_kick_mwait_play_dead(void)for (i =0 ;READ_ONCE (md->status) != newstate && i <1000 ; i++) {/* Bring it out of mwait */ WRITE_ONCE (md->control, newstate); +/* If MONITOR unreliable, send IPI */ +if (boot_cpu_has_bug (X86_BUG_MONITOR )) +__apic_send_IPI (cpu,RESCHEDULE_VECTOR );udelay (5 ); }Going over that code again,
mwait_play_dead()is doing__mwait(.exc=0)with IRQs disabled.
And the APIC is shut down. So it won't react on the IPI either.
Quoted 6 lines
So that IPI you're trying to send there won't do no nothing :-/
Now that comment there says MCE/NMI/SMI are still open (non-maskable etc.) so perhaps prod it on the NMI vector?
This does seem to suggest the above code path wasn't actually tested.
I'm not sure whether that's just a suggestion :)
Quoted 4 lines
Perhaps mark your local machine with
BUG_MONITOR, remove themd->controlWRITE_ONCE()and try kexec to test it?Thomas, any other thoughts?
NMI should work. See exc_nmi():
if (arch_cpu_is_offline(smp_processor_id())) {
if (microcode_nmi_handler_enabled())
microcode_offline_nmi_handler();
return;
}Thanks,
tglx
v2 cover x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
In reply to Peter ZijlstraIt was folly to respond to review feedback by attempting to add bits to the kexec path to this simple patch. So that misguided hunk is removed.
Here is the 1-line patch that addresses the problem that users see in the field today.
If kexec proves to be an issue on LNL, that can be addressed in a subsequent patch.
thanks,
-Len
PATCH v2 1/1 x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
From: Len Brown <[email protected]>
Under some conditions, MONITOR wakeups on Lunar Lake processors can be lost, resulting in significant user-visible delays.
Add LunarLake to X86_BUG_MONITOR so that wake_up_idle_cpu() always sends an IPI, avoiding this potential delay.
--- arch/x86/kernel/cpu/intel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/intel.c +3 -1
@@ -586,7 +586,9 @@ static void init_intel(struct cpuinfo_x86 *c) c->x86_vfm == INTEL_WESTMERE_EX))set_cpu_bug (c,X86_BUG_CLFLUSH_MONITOR ); -if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT + || c->x86_vfm ==INTEL_LUNARLAKE_M ))set_cpu_bug (c,X86_BUG_MONITOR );#ifdef CONFIG_X86_64
Signature · 1 line
2.43.0
Re: [PATCH 1/1] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
Quoted 6 lines · Len Brown
From: Len Brown <[email protected]>
Under some conditions, MONITOR wakeups on Lunar Lake processors can be lost, resulting in significant user-visible delays.
Quoted 7 lines
Add LunarLake to
X86_BUG_MONITORso thatwake_up_idle_cpu()always sends an IPI, avoiding this potential delay.Cc [email protected] # 6.11Signed-off-by Len Brown <[email protected]>
So again
and see one super-minor nit below.
Quoted 9 lines
--- arch/x86/kernel/cpu/intel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/intel.c +0
-0
arch/x86/kernel/cpu/intel.c static void init_intel(struct cpuinfo_x86 *c) · line 591
Quoted 7 lines
arch/x86/kernel/cpu/intel.c +3
-1@@ -586,7 +586,9 @@ static void init_intel(struct cpuinfo_x86 *c) c->x86_vfm == INTEL_WESTMERE_EX))set_cpu_bug (c,X86_BUG_CLFLUSH_MONITOR ); -if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT + || c->x86_vfm ==INTEL_LUNARLAKE_M ))
I would put the || at the end of the previous line, that is
Quoted 9 lines
arch/x86/kernel/cpu/intel.c +2
-1+ (c->x86_vfm == INTEL_ATOM_GOLDMONT || + c->x86_vfm == INTEL_LUNARLAKE_M))set_cpu_bug (c,X86_BUG_MONITOR );#ifdef CONFIG_X86_64 --2.43.0
A message that is not in the archive (sent off-list or not yet received): CAJvTdKnRpDQKUVNJ4Gp7r+WaHo0y-Wume3ay7toHU+Xz0gv2Zw@mail.gmail.com
Re: [PATCH 1/1] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
Quoted 8 lines · Len Brown
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines
arch/x86/kernel/cpu/intel.c +3
-1-if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT + || c->x86_vfm ==INTEL_LUNARLAKE_M ))
Quoted 5 lines
Quoted 1 line
I would put the || at the end of the previous line, that is
It isn't my personal preference for human readability either, but this is what
scripts/Lindentdoes...
Well, it doesn't match the coding style of the first line ...
A message that is not in the archive (sent off-list or not yet received): CAJvTdK=SnRqwjR5fUatP0CzaXD_CpZ-1cc+2yX0D8_XM_3oJUw@mail.gmail.com
Re: [PATCH 1/1] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
Quoted 27 lines · Len Brown
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Len Brown
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines
arch/x86/kernel/cpu/intel.c +3
-1-if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT + || c->x86_vfm ==INTEL_LUNARLAKE_M ))Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I would put the || at the end of the previous line, that is
It isn't my personal preference for human readability either, but this is what
scripts/Lindentdoes...Well, it doesn't match the coding style of the first line ...
Fair observation.
I'll bite.
If you took the existing
intel.cand added it as a patch to the kernel, the resulting checkpatch would have 6 errors and 33 warnings.
Quoted 7 lines
If you ran Lindent on the existing
intel.c, the resulting diff would be 408 lines -- 1 file changed, 232 insertions(+), 176 deletions(-)This for a file that is only 1300 lines long.
If whitespace nirvana is the goal, tools are the answer, not the valuable cycles of human reviewers.
Well, the advice always given is to follow the coding style of the given fine in the first place.
checkpatch reflects the preferences of its author is this particular respect and maintainers' preferences tend to differ from one to another.
Re: [PATCH] x86/cpu: Add INTEL_LUNARLAKE_M to X86_BUG_MONITOR
In reply to Len Brownarch/x86/kernel/cpu/intel.c static void init_intel(struct cpuinfo_x86 *c) · line 590
Quoted 11 lines · Len Brown
arch/x86/kernel/cpu/intel.c +2
-1@@ -586,7 +586,8 @@ static void init_intel(struct cpuinfo_x86 *c) c->x86_vfm == INTEL_WESTMERE_EX))set_cpu_bug (c,X86_BUG_CLFLUSH_MONITOR ); -if (boot_cpu_has (X86_FEATURE_MWAIT ) && c->x86_vfm ==INTEL_ATOM_GOLDMONT ) +if (boot_cpu_has (X86_FEATURE_MWAIT ) && + (c->x86_vfm ==INTEL_ATOM_GOLDMONT || c->x86_vfm ==INTEL_LUNARLAKE_M ))
This indentation is bogus.
arch/x86/kernel/smpboot.c void smp_kick_mwait_play_dead(void) · line 1382
Quoted 13 lines
arch/x86/kernel/cpu/intel.c +0
-0set_cpu_bug (c,X86_BUG_MONITOR );arch/x86/kernel/smpboot.c +3
-0@@ -1377,6 +1377,9 @@ void smp_kick_mwait_play_dead(void)for (i =0 ;READ_ONCE (md->status) != newstate && i <1000 ; i++) {/* Bring it out of mwait */ WRITE_ONCE (md->control, newstate); +/* If MONITOR unreliable, send IPI */ +if (boot_cpu_has_bug (X86_BUG_MONITOR )) +__apic_send_IPI (cpu,RESCHEDULE_VECTOR );
How is this supposed to work?
The local APIC of the offline CPU is shut down and only responds to INIT, NMI, SMI, and SIPI.
Even if the APIC would react to the IPI, then the offline CPU would not notice as is has interrupts disabled when it reaches mwait_play_dead().
Seriously?
Thanks,
tglx