[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8337c5eee0cadb797bacf26b00f1ca303c5147f.camel@mediatek.com>
Date: Thu, 20 Mar 2025 08:22:20 +0000
From: Chun-Jen Tseng (曾俊仁)
<Chun-Jen.Tseng@...iatek.com>
To: "viresh.kumar@...aro.org" <viresh.kumar@...aro.org>
CC: "cw00.choi@...sung.com" <cw00.choi@...sung.com>, "rafael@...nel.org"
<rafael@...nel.org>, Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>, "AngeloGioacchino Del
Regno" <angelogioacchino.delregno@...labora.com>, "myungjoo.ham@...sung.com"
<myungjoo.ham@...sung.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "kyungmin.park@...sung.com"
<kyungmin.park@...sung.com>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "linux-pm@...r.kernel.org"
<linux-pm@...r.kernel.org>, "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v3 1/3] cpufreq: mediatek: using global lock avoid race
condition
Hi viresh,
Thanks your review and reply.
The struct mtk_cpu_dvfs_info instance is per-policy and the reg_lock is
also in this structure. when I have two "policy-0" and "policy-6" use
the same mtk_cpufreq_set_target() function but the info->reg_lock
is from 2 instance(policy-0 and policy-6). when the policy-0 and
policy-6 call set_target target, the mutex_lock is locked by per-
policy. So, I change to global lock avoid per-policy lock.
BRs,
Mark Tseng
On Wed, 2025-02-19 at 11:12 +0530, Viresh Kumar wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On 14-02-25, 15:43, Mark Tseng wrote:
> > In mtk_cpufreq_set_target() is re-enter function but the mutex lock
> > decalre in mtk_cpu_dvfs_info structure for each policy. It should
> > change to global variable for critical session avoid race condition
> > with 2 or more policy.
>
> And what exactly is the race condition here ? Can you please explain
> that ?
> Since the struct mtk_cpu_dvfs_info instance is per-policy, I don't
> think there
> is any race here.
>
> The lock was introduced earlier to avoid a potential race with
> notifiers, but it
> has nothing to do with calling target simultaneously.
>
> commit c210063b40ac ("cpufreq: mediatek: Add opp notification
> support")
>
> --
> viresh
Powered by blists - more mailing lists