All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: qcom-hw: Don't do lmh things without a throttle interrupt
@ 2022-06-16 22:45 Stephen Boyd
  2022-06-17  0:21 ` Vladimir Zapolskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2022-06-16 22:45 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linux-kernel, patches, linux-pm, linux-arm-msm,
	Rafael J. Wysocki, Rob Clark, Vladimir Zapolskiy,
	Bjorn Andersson, Dmitry Baryshkov

Offlining cpu6 and cpu7 and then onlining cpu6 hangs on
sc7180-trogdor-lazor because the throttle interrupt doesn't exist.
Similarly, things go sideways when suspend/resume runs. That's because
the qcom_cpufreq_hw_cpu_online() and qcom_cpufreq_hw_lmh_exit()
functions are calling genirq APIs with an interrupt value of '-6', i.e.
-ENXIO, and that isn't good.

Check the value of the throttle interrupt like we already do in other
functions in this file and bail out early from lmh code to fix the hang.

Reported-by: Rob Clark <robdclark@chromium.org>
Cc: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fixes: a1eb080a0447 ("cpufreq: qcom-hw: provide online/offline operations")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/cpufreq/qcom-cpufreq-hw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 0253731d6d25..36c79580fba2 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -442,6 +442,9 @@ static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
 	struct platform_device *pdev = cpufreq_get_driver_data();
 	int ret;
 
+	if (data->throttle_irq <= 0)
+		return 0;
+
 	ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
 	if (ret)
 		dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
@@ -469,6 +472,9 @@ static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
 
 static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
 {
+	if (data->throttle_irq <= 0)
+		return;
+
 	free_irq(data->throttle_irq, data);
 }
 

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
https://chromeos.dev


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: qcom-hw: Don't do lmh things without a throttle interrupt
  2022-06-16 22:45 [PATCH] cpufreq: qcom-hw: Don't do lmh things without a throttle interrupt Stephen Boyd
@ 2022-06-17  0:21 ` Vladimir Zapolskiy
  2022-06-17  6:44   ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Zapolskiy @ 2022-06-17  0:21 UTC (permalink / raw)
  To: Stephen Boyd, Viresh Kumar
  Cc: linux-kernel, patches, linux-pm, linux-arm-msm,
	Rafael J. Wysocki, Rob Clark, Bjorn Andersson, Dmitry Baryshkov

On 6/17/22 01:45, Stephen Boyd wrote:
> Offlining cpu6 and cpu7 and then onlining cpu6 hangs on
> sc7180-trogdor-lazor because the throttle interrupt doesn't exist.
> Similarly, things go sideways when suspend/resume runs. That's because
> the qcom_cpufreq_hw_cpu_online() and qcom_cpufreq_hw_lmh_exit()
> functions are calling genirq APIs with an interrupt value of '-6', i.e.
> -ENXIO, and that isn't good.
> 
> Check the value of the throttle interrupt like we already do in other
> functions in this file and bail out early from lmh code to fix the hang.
> 
> Reported-by: Rob Clark <robdclark@chromium.org>
> Cc: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Fixes: a1eb080a0447 ("cpufreq: qcom-hw: provide online/offline operations")
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>   drivers/cpufreq/qcom-cpufreq-hw.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index 0253731d6d25..36c79580fba2 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -442,6 +442,9 @@ static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
>   	struct platform_device *pdev = cpufreq_get_driver_data();
>   	int ret;
>   
> +	if (data->throttle_irq <= 0)
> +		return 0;
> +
>   	ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
>   	if (ret)
>   		dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
> @@ -469,6 +472,9 @@ static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
>   
>   static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
>   {
> +	if (data->throttle_irq <= 0)
> +		return;
> +
>   	free_irq(data->throttle_irq, data);
>   }
>   
> 
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>

--
Best wishes,
Vladimir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: qcom-hw: Don't do lmh things without a throttle interrupt
  2022-06-17  0:21 ` Vladimir Zapolskiy
@ 2022-06-17  6:44   ` Viresh Kumar
  0 siblings, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2022-06-17  6:44 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Stephen Boyd, linux-kernel, patches, linux-pm, linux-arm-msm,
	Rafael J. Wysocki, Rob Clark, Bjorn Andersson, Dmitry Baryshkov

On 17-06-22, 03:21, Vladimir Zapolskiy wrote:
> On 6/17/22 01:45, Stephen Boyd wrote:
> > Offlining cpu6 and cpu7 and then onlining cpu6 hangs on
> > sc7180-trogdor-lazor because the throttle interrupt doesn't exist.
> > Similarly, things go sideways when suspend/resume runs. That's because
> > the qcom_cpufreq_hw_cpu_online() and qcom_cpufreq_hw_lmh_exit()
> > functions are calling genirq APIs with an interrupt value of '-6', i.e.
> > -ENXIO, and that isn't good.
> > 
> > Check the value of the throttle interrupt like we already do in other
> > functions in this file and bail out early from lmh code to fix the hang.
> > 
> > Reported-by: Rob Clark <robdclark@chromium.org>
> > Cc: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Fixes: a1eb080a0447 ("cpufreq: qcom-hw: provide online/offline operations")
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> > ---
> >   drivers/cpufreq/qcom-cpufreq-hw.c | 6 ++++++
> >   1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> > index 0253731d6d25..36c79580fba2 100644
> > --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> > +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> > @@ -442,6 +442,9 @@ static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
> >   	struct platform_device *pdev = cpufreq_get_driver_data();
> >   	int ret;
> > +	if (data->throttle_irq <= 0)
> > +		return 0;
> > +
> >   	ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
> >   	if (ret)
> >   		dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
> > @@ -469,6 +472,9 @@ static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
> >   static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
> >   {
> > +	if (data->throttle_irq <= 0)
> > +		return;
> > +
> >   	free_irq(data->throttle_irq, data);
> >   }
> > 
> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-17  6:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 22:45 [PATCH] cpufreq: qcom-hw: Don't do lmh things without a throttle interrupt Stephen Boyd
2022-06-17  0:21 ` Vladimir Zapolskiy
2022-06-17  6:44   ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.