Re: [PATCH 4/5] x86/nmi: Check MSR_MISC_ENABLE for all Intel platforms

Jan Beulich <[email protected]> Wed, 5 Aug 2026 16:02:06 +0200
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
On 05.08.2026 14:45, Andrew Cooper wrote:
> @@ -347,6 +343,14 @@ void setup_apic_nmi_watchdog(void)
>          break;
>  
>      case X86_VENDOR_INTEL:
> +        misc = rdmsr(MSR_IA32_MISC_ENABLE);
> +
> +        if ( !(misc & MSR_IA32_MISC_ENABLE_PERF_AVAIL) )
> +        {
> +            printk(XENLOG_WARNING "Intel Perfmon unavailable\n");
> +            goto disable;
> +        }

Please can we avoid "goto" when that's easily possible? You can use
"break" here instead, and ...

>          switch ( boot_cpu_data.family )
>          {
>          case 6:
> @@ -355,7 +359,7 @@ void setup_apic_nmi_watchdog(void)
>                                : CORE_EVENT_CPU_CLOCKS_NOT_HALTED);
>              break;
>          case 15:
> -            setup_p4_watchdog();
> +            setup_p4_watchdog(misc);
>              break;
>          }
>          break;
> @@ -363,6 +367,7 @@ void setup_apic_nmi_watchdog(void)
>  
>      if ( nmi_perfctr_msr == 0 )
>      {
> +    disable:
>          printk(XENLOG_WARNING "Failed to configure NMI watchdog\n");
>          nmi_watchdog = NMI_NONE;
>          return;

... we'll still end up here, as nmi_perfctr_msr won't be written.
Preferably with that change:
Reviewed-by: Jan Beulich <[email protected]>

Jan