On 06.02.2025 09:32, Penny Zheng wrote:
> --- a/xen/arch/x86/cpu/amd.c
> +++ b/xen/arch/x86/cpu/amd.c
> @@ -56,6 +56,8 @@ bool __initdata amd_virt_spec_ctrl;
>  
>  static bool __read_mostly fam17_c6_disabled;
>  
> +DEFINE_PER_CPU_READ_MOSTLY(uint64_t, max_freq_mhz);

Such an AMD-only variable would better have an amd_ prefix.

> @@ -669,7 +671,12 @@ void amd_log_freq(const struct cpuinfo_x86 *c)
>               printk("CPU%u: %lu ... %lu MHz\n",
>                      smp_processor_id(), FREQ(lo), FREQ(hi));
>       else
> +     {
>               printk("CPU%u: %lu MHz\n", smp_processor_id(), FREQ(lo));
> +             return;
> +     }
> +
> +     per_cpu(max_freq_mhz, smp_processor_id()) = FREQ(hi);

this_cpu() please, or latch the result of smp_processor_id() into a
local variable (there are further uses in the function which then
would want replacing).

The function has "log" in its name for a reason. Did you look at the
conditional at its very top? You won't get here for all CPUs. You
won't get here at all for Fam1A CPUs, as for them the logic will first
need amending.

Jan

Reply via email to