]> git.baikalelectronics.ru Git - kernel.git/commit
soc: qcom: rpmh-rsc: Remove the pm_lock
authorDouglas Anderson <dianders@chromium.org>
Mon, 4 May 2020 17:50:19 +0000 (10:50 -0700)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Fri, 15 May 2020 18:45:21 +0000 (11:45 -0700)
commit8511a8cb8f520624c5282fc3c056d92e53e17d55
tree4610bbcfc44e8d0c4b615934375973afd9483b0b
parent1815b1638a5765d7860aa745f9ef4eba10d4526e
soc: qcom: rpmh-rsc: Remove the pm_lock

It has been postulated that the pm_lock is bad for performance because
a CPU currently running rpmh_flush() could block other CPUs from
coming out of idle.  Similarly CPUs coming out of / going into idle
all need to contend with each other for the spinlock just to update
the variable tracking who's in PM.

Let's optimize this a bit.  Specifically:

- Use a count rather than a bitmask.  This is faster to access and
  also means we can use the atomic_inc_return() function to really
  detect who the last one to enter PM was.
- Accept that it's OK if we race and are doing the flush (because we
  think we're last) while another CPU is coming out of idle.  As long
  as we block that CPU if/when it tries to do an active-only transfer
  we're OK.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20200504104917.v6.5.I295cb72bc5334a2af80313cbe97cb5c9dcb1442c@changeid
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/soc/qcom/rpmh-internal.h
drivers/soc/qcom/rpmh-rsc.c
drivers/soc/qcom/rpmh.c