On 06.03.2025 09:39, 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, amd_max_freq_mhz);
> +
>  static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo,
>                                unsigned int *hi)
>  {
> @@ -681,9 +683,15 @@ void amd_log_freq(const struct cpuinfo_x86 *c)
>               printk("CPU%u: %lu ... %lu MHz\n",
>                      smp_processor_id(),
>                      amd_parse_freq(c, lo), amd_parse_freq(c, hi));
> -     else
> +     else {
>               printk("CPU%u: %lu MHz\n", smp_processor_id(),
>                      amd_parse_freq(c, lo));
> +             return;
> +     }
> +
> +     /* Store max frequency for amd-cppc cpufreq driver */
> +     if (hi >> 63)
> +             this_cpu(amd_max_freq_mhz) = amd_parse_freq(c, hi);
>  }

As before - typically only the BSP will make it here, due to the conditional
at the top of the function. IOW you'll observe zeros in the per-CPU data for
all other CPUs.

> --- a/xen/arch/x86/include/asm/amd.h
> +++ b/xen/arch/x86/include/asm/amd.h
> @@ -174,4 +174,5 @@ bool amd_setup_legacy_ssbd(void);
>  void amd_set_legacy_ssbd(bool enable);
>  void amd_set_cpuid_user_dis(bool enable);
>  
> +DECLARE_PER_CPU(uint64_t, amd_max_freq_mhz);
>  #endif /* __AMD_H__ */

I'm also pretty sure that I did ask before to maintain a blank line ahead of
the #endif. Please may I ask that you thoroughly address earlier review
comments, before submitting a new version?

Jan

Reply via email to