mbox series

[0/3] Even moar rpmh cleanups

Message ID 20200424045414.133381-1-swboyd@chromium.org
Headers show
Series Even moar rpmh cleanups | expand

Message

Stephen Boyd April 24, 2020, 4:54 a.m. UTC
Patches based on Doug's latest series[1] on top of linux-next. We remove
the tcs_is_free() API and then do super micro optimizations on the irq
handler. I haven't tested anything here so most likely there's a bug!

Stephen Boyd (3):
  soc: qcom: rpmh-rsc: Remove tcs_is_free() API
  soc: qcom: rpmh-rsc: Loop over less bits in irq handler
  soc: qcom: rpmh-rsc: Fold WARN_ON() into if condition

 drivers/soc/qcom/rpmh-rsc.c | 64 ++++++++++++-------------------------
 1 file changed, 20 insertions(+), 44 deletions(-)

Cc: Maulik Shah <mkshah@codeaurora.org>
Cc: Douglas Anderson <dianders@chromium.org>

[1] https://lore.kernel.org/r/20200422145408.v4.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid

base-commit: 02d8ecc18b8f392389ac9e7b785b0230ecb80833
prerequisite-patch-id: 0d383ea46ef52ab4044886a7d88d85c3c506f4ed
prerequisite-patch-id: a02b0b018404d1a0c79270ab567051656f123b23
prerequisite-patch-id: e59d990462b004a9f8335e87c2d0d747afec49ea
prerequisite-patch-id: 00d26aeb99c48521f74b32d3a6c57919d82ac1b1
prerequisite-patch-id: bb479b9adbe28c58b3ac8f363a306de80b6dcb74

Comments

Bjorn Andersson April 24, 2020, 5:37 a.m. UTC | #1
On Thu 23 Apr 21:54 PDT 2020, Stephen Boyd wrote:

> Move the WARN_ON() into the if condition so the compiler can see that
> the branch is unlikely() and possibly optimize it better.
> 
> Cc: Maulik Shah <mkshah@codeaurora.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
>  drivers/soc/qcom/rpmh-rsc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index 462dd267afef..f7763f008e03 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -373,10 +373,8 @@ static irqreturn_t tcs_tx_done(int irq, void *p)
>  
>  	for_each_set_bit(i, &irq_status, BITS_PER_TYPE(u32)) {
>  		req = get_req_from_tcs(drv, i);
> -		if (!req) {
> -			WARN_ON(1);
> +		if (WARN_ON(!req))
>  			goto skip;
> -		}
>  
>  		err = 0;
>  		for (j = 0; j < req->num_cmds; j++) {
> -- 
> Sent by a computer, using git, on the internet
>
Doug Anderson April 24, 2020, 5:11 p.m. UTC | #2
Hi,

On Thu, Apr 23, 2020 at 9:54 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> readl returns a u32, and BITS_PER_LONG is different on 32-bit vs. 64-bit
> architectures. Let's make the type we stash the readl into a u32 and
> then loop over the bits set in that type instead of potentially looping
> over more bits than we will ever need to.
>
> Cc: Maulik Shah <mkshah@codeaurora.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  drivers/soc/qcom/rpmh-rsc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Doug Anderson April 24, 2020, 5:13 p.m. UTC | #3
Hi,

On Fri, Apr 24, 2020 at 10:11 AM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Thu, Apr 23, 2020 at 9:54 PM Stephen Boyd <swboyd@chromium.org> wrote:
> >
> > readl returns a u32, and BITS_PER_LONG is different on 32-bit vs. 64-bit
> > architectures. Let's make the type we stash the readl into a u32 and
> > then loop over the bits set in that type instead of potentially looping
> > over more bits than we will ever need to.
> >
> > Cc: Maulik Shah <mkshah@codeaurora.org>
> > Cc: Douglas Anderson <dianders@chromium.org>
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> > ---
> >  drivers/soc/qcom/rpmh-rsc.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>

Oh, I suppose one nit is s/less/fewer/ in the subject.  "bits" are
discrete / countable, not continuous / uncountable.

-Doug