[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231025111301.ng5eaeaixfs3jjpg@bogus>
Date: Wed, 25 Oct 2023 12:13:01 +0100
From: Sudeep Holla <sudeep.holla@....com>
To: Zeng Heng <zengheng4@...wei.com>
Cc: broonie@...nel.org, joey.gouly@....com, will@...nel.org,
Sudeep Holla <sudeep.holla@....com>, amit.kachhap@....com,
rafael@...nel.org, catalin.marinas@....com, james.morse@....com,
mark.rutland@....com, maz@...nel.org, viresh.kumar@...aro.org,
sumitg@...dia.com, yang@...amperecomputing.com,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, wangxiongfeng2@...wei.com,
xiexiuqi@...wei.com
Subject: Re: [PATCH 2/3] cpufreq: CPPC: Keep the target core awake when
reading its cpufreq rate
On Wed, Oct 25, 2023 at 05:38:46PM +0800, Zeng Heng wrote:
> As ARM AMU's document says, all counters are subject to any changes
> in clock frequency, including clock stopping caused by the WFI and WFE
> instructions.
>
> Therefore, using smp_call_on_cpu() to trigger target CPU to
> read self's AMU counters, which ensures the counters are working
> properly while cstate feature is enabled.
>
> Reported-by: Sumit Gupta <sumitg@...dia.com>
> Link: https://lore.kernel.org/all/20230418113459.12860-7-sumitg@nvidia.com/
> Signed-off-by: Zeng Heng <zengheng4@...wei.com>
> ---
> drivers/cpufreq/cppc_cpufreq.c | 39 ++++++++++++++++++++++++++--------
> 1 file changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index fe08ca419b3d..321a9dc9484d 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
[...]
> @@ -850,18 +871,18 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
>
> cpufreq_cpu_put(policy);
>
> - ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0);
> - if (ret)
> - return 0;
> -
> - udelay(2); /* 2usec delay between sampling */
> + if (cpu_has_amu_feat(cpu))
Have you compiled this on x86 ? Even if you have somehow managed to,
this is not the right place to check the presence of AMU feature on
the CPU.
If AMU registers are used in CPPC, they must be using FFH GAS, in which
case the interpretation of FFH is architecture dependent code.
--
Regards,
Sudeep
Powered by blists - more mailing lists