From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 1/9] x86/mwait-idle: arrange for BSP MSR adjustments during S3 resume
Date: Thu, 12 Mar 2026 17:54:30 +0100 [thread overview]
Message-ID: <e5e03239-1d4e-4ab2-8f16-83d280f23b24@suse.com> (raw)
In-Reply-To: <7b7a677e-a5b9-42c8-beec-3c506b4eac52@suse.com>
mwait_idle_cpu_init() is only called for APs, yet MSR writes will
typically need re-doing post-S3 even for the BSP. When multiple cores /
threads are present (and to come back online) in a package, for package
scope MSRs this may be covered by APs doing the writes, but we can't rely
on that.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -28,6 +28,7 @@
#include <asm/io_apic.h>
#include <asm/irq.h>
#include <asm/microcode.h>
+#include <asm/mwait.h>
#include <asm/prot-key.h>
#include <asm/spec_ctrl.h>
#include <asm/tboot.h>
@@ -299,6 +300,7 @@ static int enter_state(u32 state)
acpi_sleep_post(state);
if ( hvm_cpu_up() )
BUG();
+ mwait_idle_resume();
cpufreq_add_cpu(0);
enable_cpu:
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -1680,6 +1680,28 @@ static int __init mwait_idle_probe(void)
return 0;
}
+static void mwait_idle_cpu_tweak(unsigned int cpu)
+{
+ if (icpu->auto_demotion_disable_flags)
+ on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1);
+
+ if (icpu->byt_auto_demotion_disable_flag)
+ on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable, NULL, 1);
+
+ switch (icpu->c1e_promotion) {
+ case C1E_PROMOTION_DISABLE:
+ on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1);
+ break;
+
+ case C1E_PROMOTION_ENABLE:
+ on_selected_cpus(cpumask_of(cpu), c1e_promotion_enable, NULL, 1);
+ break;
+
+ case C1E_PROMOTION_PRESERVE:
+ break;
+ }
+}
+
static int cf_check mwait_idle_cpu_init(
struct notifier_block *nfb, unsigned long action, void *hcpu)
{
@@ -1762,24 +1784,7 @@ static int cf_check mwait_idle_cpu_init(
dev->count++;
}
- if (icpu->auto_demotion_disable_flags)
- on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, NULL, 1);
-
- if (icpu->byt_auto_demotion_disable_flag)
- on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable, NULL, 1);
-
- switch (icpu->c1e_promotion) {
- case C1E_PROMOTION_DISABLE:
- on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 1);
- break;
-
- case C1E_PROMOTION_ENABLE:
- on_selected_cpus(cpumask_of(cpu), c1e_promotion_enable, NULL, 1);
- break;
-
- case C1E_PROMOTION_PRESERVE:
- break;
- }
+ mwait_idle_cpu_tweak(cpu);
return NOTIFY_DONE;
}
@@ -1811,6 +1816,14 @@ int __init mwait_idle_init(struct notifi
return err;
}
+void mwait_idle_resume(void)
+{
+ if (!icpu)
+ return;
+
+ mwait_idle_cpu_tweak(smp_processor_id());
+}
+
/* Helper function for HPET. */
bool __init mwait_pc10_supported(void)
{
--- a/xen/arch/x86/include/asm/mwait.h
+++ b/xen/arch/x86/include/asm/mwait.h
@@ -14,9 +14,12 @@
#define MWAIT_ECX_INTERRUPT_BREAK 0x1
void mwait_idle_with_hints(unsigned int eax, unsigned int ecx);
+
#ifdef CONFIG_INTEL
+void mwait_idle_resume(void);
bool mwait_pc10_supported(void);
#else
+static inline void mwait_idle_resume(void) {}
static inline bool mwait_pc10_supported(void)
{
return false;
next prev parent reply other threads:[~2026-03-12 16:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 16:53 [PATCH 0/9] x86/mwait-idle: sync up with Linux 7.0-rc Jan Beulich
2026-03-12 16:54 ` Jan Beulich [this message]
2026-04-24 14:34 ` [PATCH 1/9] x86/mwait-idle: arrange for BSP MSR adjustments during S3 resume Roger Pau Monné
2026-05-04 9:02 ` Jan Beulich
2026-03-12 16:54 ` [PATCH 2/9] x86/mwait-idle: clean up BYT/CHT auto demotion disable Jan Beulich
2026-04-24 14:47 ` Roger Pau Monné
2026-05-04 9:07 ` Jan Beulich
2026-03-12 16:55 ` [PATCH 3/9] x86/mwait-idle: latch struct idle_cpu contents Jan Beulich
2026-04-24 15:24 ` Roger Pau Monné
2026-03-12 16:55 ` [PATCH 4/9] x86/mwait-idle: move pre-initialized struct idle_cpu instances Jan Beulich
2026-04-24 15:33 ` Roger Pau Monné
2026-03-12 16:56 ` [PATCH 5/9] x86/mwait-idle: Remove unused driver version constant Jan Beulich
2026-04-24 15:35 ` Roger Pau Monné
2026-03-12 16:56 ` [PATCH 6/9] x86/mwait-idle: Remove the 'preferred_cstates' parameter Jan Beulich
2026-04-24 15:37 ` Roger Pau Monné
2026-03-12 16:57 ` [PATCH 7/9] x86/mwait-idle: drop const from struct cpuidle_state arrays Jan Beulich
2026-04-24 17:57 ` Roger Pau Monné
2026-05-04 9:14 ` Jan Beulich
2026-03-12 16:57 ` [PATCH 8/9] x86/mwait-idle: Add cmdline option to adjust C-states table Jan Beulich
2026-04-24 19:10 ` Roger Pau Monné
2026-05-04 9:29 ` Jan Beulich
2026-03-12 16:58 ` [PATCH 9/9] x86/mwait-idle: Add C-states validation Jan Beulich
2026-04-24 19:15 ` Roger Pau Monné
2026-05-04 9:34 ` Jan Beulich
2026-05-08 7:38 ` Roger Pau Monné
2026-05-11 10:41 ` Jan Beulich
2026-05-12 15:22 ` [PATCH 0/9] x86/mwait-idle: sync up with Linux 7.0-rc Oleksii Kurochko
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=e5e03239-1d4e-4ab2-8f16-83d280f23b24@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.