mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jie Zhan <zhanjie9@hisilicon.com>
To: Sumit Gupta <sumitg@nvidia.com>, Will Deacon <will@kernel.org>
Cc: <catalin.marinas@arm.com>, <zhenglifeng1@huawei.com>,
	<viresh.kumar@linaro.org>, <rafael@kernel.org>,
	<beata.michalska@arm.com>, <pierre.gondois@arm.com>,
	<ionela.voinescu@arm.com>, <linux-arm-kernel@lists.infradead.org>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <treding@nvidia.com>,
	<jonathanh@nvidia.com>, <bbasu@nvidia.com>
Subject: Re: [PATCH] arm64: topology: Fix false warning in counters_read_on_cpu() for same-CPU reads
Date: Tue, 24 Feb 2026 09:42:17 +0800	[thread overview]
Message-ID: <b4c98160-e6b4-44a5-9396-0acc8334a39c@hisilicon.com> (raw)
In-Reply-To: <aZyciAy8zCvrvGB7@willie-the-truck>



On 2/24/2026 2:29 AM, Will Deacon wrote:
> On Wed, Jan 28, 2026 at 01:04:17PM +0000, Will Deacon wrote:
>> On Wed, Jan 28, 2026 at 06:50:42PM +0800, Jie Zhan wrote:
>>> On 1/27/2026 4:07 PM, Sumit Gupta wrote:
>>>> The counters_read_on_cpu() function warns when called with IRQs disabled
>>>> to prevent deadlock in smp_call_function_single(). However, this warning
>>>> is spurious when reading counters on the current CPU since no IPI is
>>>> needed for same-CPU reads.
>>>>
>>>> Commit 12eb8f4fff24 ("cpufreq: CPPC: Update FIE arch_freq_scale in ticks
>>>> for non-PCC regs") changed the CPPC Frequency Invariance Engine to read
>>>> AMU counters directly from the scheduler tick for non-PCC register
>>>> spaces (like FFH), instead of deferring to a kthread. This means
>>>> counters_read_on_cpu() is now called with IRQs disabled from the tick
>>>> handler, triggering the warning:
>>>>
>>>> | WARNING: arch/arm64/kernel/topology.c:410 at counters_read_on_cpu
>>>> | ...
>>>> | Call trace:
>>>> |  counters_read_on_cpu+0x88/0xa8 (P)
>>>> |  cpc_read_ffh+0xdc/0x148
>>>> |  cpc_read+0x260/0x518
>>>> |  cppc_get_perf_ctrs+0xf0/0x398
>>>> |  __cppc_scale_freq_tick+0x4c/0x148 [cppc_cpufreq]
>>>> |  cppc_scale_freq_tick+0x44/0x88 [cppc_cpufreq]
>>>> |  topology_scale_freq_tick+0x34/0x58
>>>> |  sched_tick+0x58/0x300
>>>> |  update_process_times+0xcc/0x120
>>>> |  tick_nohz_handler+0xa8/0x260
>>>> |  __hrtimer_run_queues+0x154/0x360
>>>> |  hrtimer_interrupt+0xf4/0x2b0
>>>> |  arch_timer_handler_phys+0x4c/0x78
>>>> |  ....
>>>> |  CPPC Cpufreq:__cppc_scale_freq_tick: failed to read perf counters
>>>> |  ....
>>>>
>>>> Fix this by calling the counter read function directly for same-CPU
>>>> case, bypassing smp_call_function_single() entirely. Use get_cpu() to
>>>> disable preemption as the counter read functions call this_cpu_has_cap()
>>>> which requires a non-preemptible context.
>>>>
>>>> Fixes: 12eb8f4fff24 ("cpufreq: CPPC: Update FIE arch_freq_scale in ticks for non-PCC regs")
>>>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>>>
>>> Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com>
>>>
>>> Looks fine for me except for the minor comment wrapping.
>>>
>>> Thanks for spotting this.
>>> I may have missed the warning log in the FFH test.
>>>
>>> This happens during the short window in cpufreq_policy_online() between
>>> driver->init() and the CREATE_POLICY notifier that gets AMU FIE ready.
>>> After that, CPPC FIE will be stopped.
>>>
>>> Ideally this can be merged together with Viresh's PR since the CPPC FIE
>>> changes are there.
>>> https://lore.kernel.org/all/j4qdid7iqmng4gzb5ozefemjkep3wx2b5z2yki5tnqc3vzvzf4@kvrnarvdod5p/
>>
>> Right, looks like this should go via Rafael but if it doesn't make the merge
>> window then I can pick it up at -rc1 (please remind me :)
> 
> Looks like this fix is still needed. Please can you post a new version,
> based on -rc1, so that I can pick it up?
> 
> You'll also need to fix the SHA in the commit message and the Fixes: tag,
> as 12eb8f4fff24 doesn't match the upstream change.
> 
> Will
> 
I believe this goes to Sumit because he's the author.

Sumit, can you update this patch?

Jie

  reply	other threads:[~2026-02-24  1:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  8:07 Sumit Gupta
2026-01-28 10:50 ` Jie Zhan
2026-01-28 13:04   ` Will Deacon
2026-02-23 18:29     ` Will Deacon
2026-02-24  1:42       ` Jie Zhan [this message]
2026-02-24  9:36         ` Sumit Gupta

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=b4c98160-e6b4-44a5-9396-0acc8334a39c@hisilicon.com \
    --to=zhanjie9@hisilicon.com \
    --cc=bbasu@nvidia.com \
    --cc=beata.michalska@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=ionela.voinescu@arm.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=pierre.gondois@arm.com \
    --cc=rafael@kernel.org \
    --cc=sumitg@nvidia.com \
    --cc=treding@nvidia.com \
    --cc=viresh.kumar@linaro.org \
    --cc=will@kernel.org \
    --cc=zhenglifeng1@huawei.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®