Messages in this thread | | | Date | Thu, 21 Jan 2021 16:55:36 +0530 | From | Viresh Kumar <> | Subject | Re: [PATCH] opp: Prepare for ->set_opp() helper to work without regulators |
| |
On 20-01-21, 17:50, Dmitry Osipenko wrote: > If OPP API was meant to be thread-safe, then the > dev_pm_opp_unregister_set_opp_helper() should unset the > opp_table->set_opp_data under the lock since it races with > dev_pm_opp_set_regulators().
Right, I will fix that.
> Secondly, functions like dev_pm_opp_set_rate() don't have any locks at all.
It was on purpose. It is expected that this routine specially will only have a single caller and calls will be in sequence. This gets called a lot and we wanted to make it as much efficient as possible.
> It should be better not to add "random" locks into the code because it > only creates an illusion for an oblivious API user that OPP API cares > about thread safety, IMO. > > Making OPP API thread-safe will take some effort and a careful review of > every lock will be needed.
I agree, we have kept some part out of the lock intentionally, but every other thing which can happen in parallel is well protected. There maybe bugs, which I am not aware of.
Another reason you see less locks is because of the way I have used the kref thing here. That allows us to take locks for very small section of code and not big routines.
-- viresh
| |