From: Zeng Heng <zengheng4@huawei.com>
To: Pierre Gondois <pierre.gondois@arm.com>,
Ionela Voinescu <Ionela.Voinescu@arm.com>, <sumitg@nvidia.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
<wangxiongfeng2@huawei.com>, <xiexiuqi@huawei.com>,
<liwei391@huawei.com>, <linux-acpi@vger.kernel.org>,
<lenb@kernel.org>, <viresh.kumar@linaro.org>, <rafael@kernel.org>,
Yang Shi <yang@os.amperecomputing.com>
Subject: Re: [PATCH v2 1/2] cpufreq: CPPC: keep target core awake when reading its cpufreq rate
Date: Fri, 26 May 2023 16:58:45 +0800 [thread overview]
Message-ID: <9025b93a-faec-bc84-00c4-34a3b1c01b35@huawei.com> (raw)
In-Reply-To: <a1075da1-4ff1-4a8b-2902-3954db717ded@arm.com>
在 2023/5/17 16:17, Pierre Gondois 写道:
> +Ionela, Sumit, Yang,
>
> Hello Zeng,
>
> I think solutions around related issues were suggested at:
>
> [1] https://lore.kernel.org/all/20230418113459.12860-7-sumitg@nvidia.com/
> [2]
> https://lore.kernel.org/all/20230328193846.8757-1-yang@os.amperecomputing.com/
> [3] https://lore.kernel.org/all/ZEl1Fms%2FJmdEZsVn@arm.com/
>
> About this patch, it seems to mean that CPPC counters of CPUx are always
> accessed from CPUx, even when they are not AMUs. For instance CPPC
> counters could be memory mapped and accessible from any CPU.
> cpu_has_amu_feat() should allow to probe if a CPU uses AMUs or not,
> and [2] had an implementation using it.
>
> Another comment about PATCH 2/2 is that if the counters are accessed
> through FFH, arm64 version of cpc_read_ffh() is calling
> counters_read_on_cpu(), and a comment in counters_read_on_cpu() seems
> to specify the function must be called with interrupt enabled.
>
> I think the best solution so far was the one at [3], suggested by Ionela,
> but it doesn't seem to solve your issue. Indeed, it is not checked
> whether
> the counters are AMU counters and that they must be remotely read (to
> have the CPU awake),
>
> Regards,
> Pierre
Here is segment I picked from patch[3], and there is a modification is
deserved to be discussed:
---------------------------------------------------------------------------
@@ -1336,8 +1361,25 @@ int cppc_get_perf_ctrs(int cpunum, struct
cppc_perf_fb_ctrs *perf_fb_ctrs)
}
}
- cpc_read(cpunum, delivered_reg, &delivered);
- cpc_read(cpunum, reference_reg, &reference);
+ ctrs.cpunum = cpunum;
+ ctrs.delivered_reg = delivered_reg;
+ ctrs.reference_reg = reference_reg;
+ ctrs.delivered = &delivered;
+ ctrs.reference = &reference;
+
+ if (CPC_IN_FFH(delivered_reg) && CPC_IN_FFH(reference_reg)) {
Here we call cpu_has_amu_feat() as precondition (like Sumit's mail
mentions), which could be compatible with
any SoCs with AMU that could be accessible via sys-register and system
memory both.
+ ret = smp_call_on_cpu(cpunum, cppc_get_cycle_ctrs, &ctrs, false);
+ } else {
+ if (CPC_IN_SYSTEM_MEMORY(delivered_reg) &&
+ CPC_IN_SYSTEM_MEMORY(reference_reg)) {
+ local_irq_save(flags);
+ cppc_get_cycle_ctrs(&ctrs);
+ local_irq_restore(flags);
+ } else {
+ cppc_get_cycle_ctrs(&ctrs);
+ }
+ }
+
cpc_read(cpunum, ref_perf_reg, &ref_perf);
-----------------------------------------------------------------------------------
If there were a new version patch released, please loop me at that time.
Thanks a lot in advance.
B.R.,
Zeng Heng
prev parent reply other threads:[~2023-05-26 8:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 13:32 Zeng Heng
2023-05-16 13:32 ` [PATCH v2 2/2] acpi: CPPC: read delivered_reg and reference_reg in critical section Zeng Heng
2023-05-16 13:32 ` [PATCH 0/2] drivers/cpufreq: gain accurate CPU frequency from cpufreq/scaling_cur_freq Zeng Heng
2023-05-17 8:17 ` [PATCH v2 1/2] cpufreq: CPPC: keep target core awake when reading its cpufreq rate Pierre Gondois
2023-05-17 15:03 ` Sumit Gupta
2023-05-17 18:46 ` Yang Shi
2023-05-18 14:40 ` Sumit Gupta
2023-05-19 16:39 ` Beata Michalska
2023-05-24 18:08 ` Yang Shi
2023-05-18 1:44 ` Zeng Heng
2023-05-26 8:58 ` Zeng Heng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9025b93a-faec-bc84-00c4-34a3b1c01b35@huawei.com \
--to=zengheng4@huawei.com \
--cc=Ionela.Voinescu@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=liwei391@huawei.com \
--cc=pierre.gondois@arm.com \
--cc=rafael@kernel.org \
--cc=sumitg@nvidia.com \
--cc=viresh.kumar@linaro.org \
--cc=wangxiongfeng2@huawei.com \
--cc=xiexiuqi@huawei.com \
--cc=yang@os.amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®