[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/9] x86/mwait-idle: arrange for BSP MSR adjustments during S3 resume


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 24 Apr 2026 16:34:07 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gIkADVF/UMmjEt2yNFcwUJFEVG0YBO+Enjx1llxOZO4=; b=TiHFiyTS6gTAo/J8ickQMCPd5NZf3ToWoaeH5aP6Tt6aaVqU1vdDaRiFrw3eji6WREBjCcWvO+5RBv04W2qjz/tOcAOt1lIvylJUr+VHDCK6NRgaYCZ3keoj0G5O8dAo4vg8uvSyEbfNLIL6lgfoAse5leRBmOutp8l4GtXwq/yuXg+rYRGzV2KM1aS7DaqO5mTpsRS9vp40BwycFdh16wyHJ7d4nT/cakfU2ttxckhDaEAqqvjgygCSZd40mderAzCys4iguScEIYo8jpwILAIDfm22rfimxFgHLlAbgx75kWDW4pKsdQ7UiWTzuTzCSaMAKVSahRcXVMUnyoCv9Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M8wQXJLccYafABNEraAMkCHT388USbpCNzLxcKNAACmxVGBbByCrr3cmG3p7Hzu293KkYUO6yQ3kewyjiqY/LMc32tHIT8ZpVD5KSU8XWNbAdXGxVsvIK8UGn3rATVM2owqMFHuZju5Ap4zG+ko2SK0ohLFuIkmBhBuBynuq+TZ5/DP6SdA7R4r2ns9mpb5lHF89/02LUjlPKfYbTJGY+MCR+USTNEO3hXnPehKXS8Zf7T+iE/poG0XxWQPL8WFbbGVZ5dzJlamoyJBRdm720nv27uSYCtJJfYU/Sh6XK0xCCW5beIykqRBnZWMD1HOmaEKAABlfIw6UN7kP6bXRdQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Fri, 24 Apr 2026 14:34:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Mar 12, 2026 at 05:54:30PM +0100, Jan Beulich wrote:
> 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@xxxxxxxx>
> 
> --- 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;

I'm possibly missing some context here, but why do we use
on_selected_cpus and the CPU_ONLINE hook?  Won't it be easier to use
CPU_STARTING and avoid the use of on_selected_cpus(), as CPU_STARTING
runs in the context of the CPU being onlined.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.