linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor
@ 2022-05-14 15:20 Ulf Hansson
  2022-05-14 16:48 ` Anup Patel
  0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2022-05-14 15:20 UTC (permalink / raw)
  To: Rafael J . Wysocki, Anup Patel, linux-pm
  Cc: Sudeep Holla, Lorenzo Pieralisi, Maulik Shah, Daniel Lezcano,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Atish Patra,
	Ulf Hansson, linux-arm-kernel, linux-riscv, linux-kernel

While factoring out the PM domain related code from PSCI domain driver into
a set of library functions, a regression when initializing the genpds got
introduced. More precisely, we fail to assign a genpd governor, so let's
fix this.

Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index 755bbdfc5b82..3db4fca1172b 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
 	struct generic_pm_domain *pd;
 	struct psci_pd_provider *pd_provider;
 	struct dev_power_governor *pd_gov;
-	int ret = -ENOMEM, state_count = 0;
+	int ret = -ENOMEM;
 
 	pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
 	if (!pd)
@@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
 		pd->flags |= GENPD_FLAG_ALWAYS_ON;
 
 	/* Use governor for CPU PM domains if it has some states to manage. */
-	pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
+	pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
 
 	ret = pm_genpd_init(pd, pd_gov, false);
 	if (ret)
-- 
2.25.1


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

* Re: [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor
  2022-05-14 15:20 [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor Ulf Hansson
@ 2022-05-14 16:48 ` Anup Patel
  2022-05-18 18:50   ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Anup Patel @ 2022-05-14 16:48 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rafael J . Wysocki, open list:THERMAL, Sudeep Holla,
	Lorenzo Pieralisi, Maulik Shah, Daniel Lezcano, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Atish Patra, linux-arm-kernel,
	linux-riscv, linux-kernel@vger.kernel.org List

On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> While factoring out the PM domain related code from PSCI domain driver into
> a set of library functions, a regression when initializing the genpds got
> introduced. More precisely, we fail to assign a genpd governor, so let's
> fix this.
>
> Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>  drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index 755bbdfc5b82..3db4fca1172b 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
>         struct generic_pm_domain *pd;
>         struct psci_pd_provider *pd_provider;
>         struct dev_power_governor *pd_gov;
> -       int ret = -ENOMEM, state_count = 0;
> +       int ret = -ENOMEM;
>
>         pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
>         if (!pd)
> @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
>                 pd->flags |= GENPD_FLAG_ALWAYS_ON;
>
>         /* Use governor for CPU PM domains if it has some states to manage. */
> -       pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
> +       pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
>
>         ret = pm_genpd_init(pd, pd_gov, false);
>         if (ret)
> --
> 2.25.1
>

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

* Re: [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor
  2022-05-14 16:48 ` Anup Patel
@ 2022-05-18 18:50   ` Rafael J. Wysocki
  2022-05-19 13:00     ` Ulf Hansson
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-05-18 18:50 UTC (permalink / raw)
  To: Anup Patel, Ulf Hansson
  Cc: Rafael J . Wysocki, open list:THERMAL, Sudeep Holla,
	Lorenzo Pieralisi, Maulik Shah, Daniel Lezcano, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Atish Patra, linux-arm-kernel,
	linux-riscv, linux-kernel@vger.kernel.org List

On Sat, May 14, 2022 at 6:49 PM Anup Patel <anup@brainfault.org> wrote:
>
> On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > While factoring out the PM domain related code from PSCI domain driver into
> > a set of library functions, a regression when initializing the genpds got
> > introduced. More precisely, we fail to assign a genpd governor, so let's
> > fix this.
> >
> > Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Looks good to me.
>
> Reviewed-by: Anup Patel <anup@brainfault.org>
>

Ulf, do you want me to take this lot or is it going to be handled elsewhere?

> > ---
> >  drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> > index 755bbdfc5b82..3db4fca1172b 100644
> > --- a/drivers/cpuidle/cpuidle-psci-domain.c
> > +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> > @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> >         struct generic_pm_domain *pd;
> >         struct psci_pd_provider *pd_provider;
> >         struct dev_power_governor *pd_gov;
> > -       int ret = -ENOMEM, state_count = 0;
> > +       int ret = -ENOMEM;
> >
> >         pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
> >         if (!pd)
> > @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> >                 pd->flags |= GENPD_FLAG_ALWAYS_ON;
> >
> >         /* Use governor for CPU PM domains if it has some states to manage. */
> > -       pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
> > +       pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
> >
> >         ret = pm_genpd_init(pd, pd_gov, false);
> >         if (ret)
> > --
> > 2.25.1
> >

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

* Re: [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor
  2022-05-18 18:50   ` Rafael J. Wysocki
@ 2022-05-19 13:00     ` Ulf Hansson
  2022-05-19 17:38       ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2022-05-19 13:00 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Anup Patel, Rafael J . Wysocki, open list:THERMAL, Sudeep Holla,
	Lorenzo Pieralisi, Maulik Shah, Daniel Lezcano, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Atish Patra, linux-arm-kernel,
	linux-riscv, linux-kernel@vger.kernel.org List

On Wed, 18 May 2022 at 20:50, Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Sat, May 14, 2022 at 6:49 PM Anup Patel <anup@brainfault.org> wrote:
> >
> > On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > >
> > > While factoring out the PM domain related code from PSCI domain driver into
> > > a set of library functions, a regression when initializing the genpds got
> > > introduced. More precisely, we fail to assign a genpd governor, so let's
> > > fix this.
> > >
> > > Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> >
> > Looks good to me.
> >
> > Reviewed-by: Anup Patel <anup@brainfault.org>
> >
>
> Ulf, do you want me to take this lot or is it going to be handled elsewhere?

I appreciate it if you can pick both this and the second patch.

Kind regards
Uffe

>
> > > ---
> > >  drivers/cpuidle/cpuidle-psci-domain.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> > > index 755bbdfc5b82..3db4fca1172b 100644
> > > --- a/drivers/cpuidle/cpuidle-psci-domain.c
> > > +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> > > @@ -52,7 +52,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> > >         struct generic_pm_domain *pd;
> > >         struct psci_pd_provider *pd_provider;
> > >         struct dev_power_governor *pd_gov;
> > > -       int ret = -ENOMEM, state_count = 0;
> > > +       int ret = -ENOMEM;
> > >
> > >         pd = dt_idle_pd_alloc(np, psci_dt_parse_state_node);
> > >         if (!pd)
> > > @@ -71,7 +71,7 @@ static int psci_pd_init(struct device_node *np, bool use_osi)
> > >                 pd->flags |= GENPD_FLAG_ALWAYS_ON;
> > >
> > >         /* Use governor for CPU PM domains if it has some states to manage. */
> > > -       pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
> > > +       pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
> > >
> > >         ret = pm_genpd_init(pd, pd_gov, false);
> > >         if (ret)
> > > --
> > > 2.25.1
> > >

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

* Re: [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor
  2022-05-19 13:00     ` Ulf Hansson
@ 2022-05-19 17:38       ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-05-19 17:38 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rafael J. Wysocki, Anup Patel, Rafael J . Wysocki,
	open list:THERMAL, Sudeep Holla, Lorenzo Pieralisi, Maulik Shah,
	Daniel Lezcano, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Atish Patra, linux-arm-kernel, linux-riscv,
	linux-kernel@vger.kernel.org List

On Thu, May 19, 2022 at 3:01 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Wed, 18 May 2022 at 20:50, Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Sat, May 14, 2022 at 6:49 PM Anup Patel <anup@brainfault.org> wrote:
> > >
> > > On Sat, May 14, 2022 at 8:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > >
> > > > While factoring out the PM domain related code from PSCI domain driver into
> > > > a set of library functions, a regression when initializing the genpds got
> > > > introduced. More precisely, we fail to assign a genpd governor, so let's
> > > > fix this.
> > > >
> > > > Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> > > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > >
> > > Looks good to me.
> > >
> > > Reviewed-by: Anup Patel <anup@brainfault.org>
> > >
> >
> > Ulf, do you want me to take this lot or is it going to be handled elsewhere?
>
> I appreciate it if you can pick both this and the second patch.

Both applied, thanks!

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

end of thread, other threads:[~2022-05-19 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-14 15:20 [PATCH 1/2] cpuidle: psci: Fix regression leading to no genpd governor Ulf Hansson
2022-05-14 16:48 ` Anup Patel
2022-05-18 18:50   ` Rafael J. Wysocki
2022-05-19 13:00     ` Ulf Hansson
2022-05-19 17:38       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).