[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220510035259.5ep52sgahd2a6rie@vireshk-i7>
Date: Tue, 10 May 2022 09:22:59 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Schspa Shi <schspa@...il.com>
Cc: rafael@...nel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: fix race on cpufreq online
On 09-05-22, 23:06, Schspa Shi wrote:
> I am very sorry for this oversight.
No issues, I am partly to blame for not reviewing it as well.
> To fix this issue, there is no need to move cpufreq_driver->exit(policy)
> and cpufreq_driver->offline(policy) to inside of &policy->rwsem.
> I made this change because they are inside of &policy->rwsem write lock
> at cpufreq_offline. I think we should keep offline & exit call inside of
> policy->rwsem for better symmetry.
>
> static int cpufreq_offline(unsigned int cpu)
> {
> ...
> down_write(&policy->rwsem);
> ...
> /*
> * Perform the ->offline() during light-weight tear-down, as
> * that allows fast recovery when the CPU comes back.
> */
> if (cpufreq_driver->offline) {
> cpufreq_driver->offline(policy);
> } else if (cpufreq_driver->exit) {
> cpufreq_driver->exit(policy);
> policy->freq_table = NULL;
> }
>
> unlock:
> up_write(&policy->rwsem);
> return 0;
> }
>
> > The very first thing we need to do now is revert this patch. Lemme
> > send a patch for that and you can send a fresh fix over that once you
> > have a stable fix.
>
> For the next version of the stable fix, I'd be willing to keep exit and
> offline calls inside of policy->rwsem. But it's OK for me to keep offline
> & exit calls outside of policy->rwsem.
Just send a patch with whatever you think is the right fix and lets
take it from there.
--
viresh
Powered by blists - more mailing lists