* Re: [PATCH] PM: domains: not update genpd status when power on fail
2021-07-06 10:05 [PATCH] PM: domains: not update genpd status when power on fail peng.fan
@ 2021-07-06 9:44 ` Ulf Hansson
2021-07-06 9:52 ` Peng Fan (OSS)
0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2021-07-06 9:44 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Rafael J. Wysocki, Kevin Hilman, Pavel Machek, Len Brown,
Linux PM, Linux Kernel Mailing List, Peng Fan
On Tue, 6 Jul 2021 at 11:31, <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> When _genpd_power_on fail, the generic power domain status
> should not be changed to GENPD_STATE_ON.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/base/power/domain.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index ab0b740cc0f1..754a5d384479 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1101,6 +1101,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
> unsigned int depth)
> {
> struct gpd_link *link;
> + int ret;
>
> if (genpd_status_on(genpd))
> return;
> @@ -1117,8 +1118,9 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
> genpd_unlock(link->parent);
> }
>
> - _genpd_power_on(genpd, false);
> - genpd->status = GENPD_STATE_ON;
> + ret = _genpd_power_on(genpd, false);
> + if (!ret)
To support this error path, a lot more code needs to be added. Just
have a look at the callers of genpd_sync_power_on() and compare it
with genpd_power_on().
In my opinion, supporting this error path isn't really worth it, at
least until someone comes with a valid use case. Do you have one - or
did you send the $subject patch based solely on code inspection?
> + genpd->status = GENPD_STATE_ON;
> }
>
> /**
> --
> 2.30.0
>
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] PM: domains: not update genpd status when power on fail
2021-07-06 9:44 ` Ulf Hansson
@ 2021-07-06 9:52 ` Peng Fan (OSS)
2021-07-07 9:50 ` Ulf Hansson
0 siblings, 1 reply; 4+ messages in thread
From: Peng Fan (OSS) @ 2021-07-06 9:52 UTC (permalink / raw)
To: Ulf Hansson, Peng Fan (OSS)
Cc: Rafael J. Wysocki, Kevin Hilman, Pavel Machek, Len Brown,
Linux PM, Linux Kernel Mailing List
Hi Ulf,
> Subject: Re: [PATCH] PM: domains: not update genpd status when power on
> fail
>
> On Tue, 6 Jul 2021 at 11:31, <peng.fan@oss.nxp.com> wrote:
> >
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > When _genpd_power_on fail, the generic power domain status should not
> > be changed to GENPD_STATE_ON.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > drivers/base/power/domain.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> > index ab0b740cc0f1..754a5d384479 100644
> > --- a/drivers/base/power/domain.c
> > +++ b/drivers/base/power/domain.c
> > @@ -1101,6 +1101,7 @@ static void genpd_sync_power_on(struct
> generic_pm_domain *genpd, bool use_lock,
> > unsigned int depth) {
> > struct gpd_link *link;
> > + int ret;
> >
> > if (genpd_status_on(genpd))
> > return;
> > @@ -1117,8 +1118,9 @@ static void genpd_sync_power_on(struct
> generic_pm_domain *genpd, bool use_lock,
> > genpd_unlock(link->parent);
> > }
> >
> > - _genpd_power_on(genpd, false);
> > - genpd->status = GENPD_STATE_ON;
> > + ret = _genpd_power_on(genpd, false);
> > + if (!ret)
>
> To support this error path, a lot more code needs to be added. Just
> have a look at the callers of genpd_sync_power_on() and compare it
> with genpd_power_on().
>
> In my opinion, supporting this error path isn't really worth it, at
> least until someone comes with a valid use case. Do you have one - or
> did you send the $subject patch based solely on code inspection?
This is two patchset:
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210604111005.6804-1-peng.fan@oss.nxp.com/
https://patchwork.kernel.org/project/linux-arm-kernel/cover/20210629072941.7980-1-peng.fan@oss.nxp.com/
I collected in github with a few fixes:
https://github.com/MrVan/linux/tree/linux-next-master-628-blk-ctl-test
In my test, when suspend/resume, I see
pgc_vpu_h1/g1/g2 has status on, but actually they are not on in hardware.
Because vpumix_blk_ctl bus domain is not on, pgc_vpu_h1/g1/g2 runtime
power off will fail.
Thanks,
Peng.
>
> > + genpd->status = GENPD_STATE_ON;
> > }
> >
> > /**
> > --
> > 2.30.0
> >
>
> Kind regards
> Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] PM: domains: not update genpd status when power on fail
@ 2021-07-06 10:05 peng.fan
2021-07-06 9:44 ` Ulf Hansson
0 siblings, 1 reply; 4+ messages in thread
From: peng.fan @ 2021-07-06 10:05 UTC (permalink / raw)
To: rjw, khilman, ulf.hansson, pavel, len.brown, linux-pm
Cc: linux-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
When _genpd_power_on fail, the generic power domain status
should not be changed to GENPD_STATE_ON.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/base/power/domain.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ab0b740cc0f1..754a5d384479 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1101,6 +1101,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
unsigned int depth)
{
struct gpd_link *link;
+ int ret;
if (genpd_status_on(genpd))
return;
@@ -1117,8 +1118,9 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
genpd_unlock(link->parent);
}
- _genpd_power_on(genpd, false);
- genpd->status = GENPD_STATE_ON;
+ ret = _genpd_power_on(genpd, false);
+ if (!ret)
+ genpd->status = GENPD_STATE_ON;
}
/**
--
2.30.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PM: domains: not update genpd status when power on fail
2021-07-06 9:52 ` Peng Fan (OSS)
@ 2021-07-07 9:50 ` Ulf Hansson
0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-07-07 9:50 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Rafael J. Wysocki, Kevin Hilman, Pavel Machek, Len Brown,
Linux PM, Linux Kernel Mailing List
On Tue, 6 Jul 2021 at 11:52, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> Hi Ulf,
>
> > Subject: Re: [PATCH] PM: domains: not update genpd status when power on
> > fail
> >
> > On Tue, 6 Jul 2021 at 11:31, <peng.fan@oss.nxp.com> wrote:
> > >
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > When _genpd_power_on fail, the generic power domain status should not
> > > be changed to GENPD_STATE_ON.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > > drivers/base/power/domain.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> > > index ab0b740cc0f1..754a5d384479 100644
> > > --- a/drivers/base/power/domain.c
> > > +++ b/drivers/base/power/domain.c
> > > @@ -1101,6 +1101,7 @@ static void genpd_sync_power_on(struct
> > generic_pm_domain *genpd, bool use_lock,
> > > unsigned int depth) {
> > > struct gpd_link *link;
> > > + int ret;
> > >
> > > if (genpd_status_on(genpd))
> > > return;
> > > @@ -1117,8 +1118,9 @@ static void genpd_sync_power_on(struct
> > generic_pm_domain *genpd, bool use_lock,
> > > genpd_unlock(link->parent);
> > > }
> > >
> > > - _genpd_power_on(genpd, false);
> > > - genpd->status = GENPD_STATE_ON;
> > > + ret = _genpd_power_on(genpd, false);
> > > + if (!ret)
> >
> > To support this error path, a lot more code needs to be added. Just
> > have a look at the callers of genpd_sync_power_on() and compare it
> > with genpd_power_on().
> >
> > In my opinion, supporting this error path isn't really worth it, at
> > least until someone comes with a valid use case. Do you have one - or
> > did you send the $subject patch based solely on code inspection?
>
> This is two patchset:
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20210604111005.6804-1-peng.fan@oss.nxp.com/
> https://patchwork.kernel.org/project/linux-arm-kernel/cover/20210629072941.7980-1-peng.fan@oss.nxp.com/
>
> I collected in github with a few fixes:
> https://github.com/MrVan/linux/tree/linux-next-master-628-blk-ctl-test
I looked at some of the changes there - and I especially don't quite
understand why you enable runtime PM for the genpd->dev. That looks
wrong to me. I am referring to:
"soc: imx: blk-ctl: fix to v8 patchset".
>
>
> In my test, when suspend/resume, I see
> pgc_vpu_h1/g1/g2 has status on, but actually they are not on in hardware.
That sounds like a bug somewhere. Did genpd fail to power off the PM
domain or what happened, more exactly?
> Because vpumix_blk_ctl bus domain is not on, pgc_vpu_h1/g1/g2 runtime
> power off will fail.
What is pgc_vpu_h1/g1/g2?
I am happy to help/guide you forward, but it sounds a bit that more
in-depth debugging is needed at your side. At least I need some stack
trace or kernel logs with debug messages enabled.
[...]
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-07 9:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 10:05 [PATCH] PM: domains: not update genpd status when power on fail peng.fan
2021-07-06 9:44 ` Ulf Hansson
2021-07-06 9:52 ` Peng Fan (OSS)
2021-07-07 9:50 ` Ulf Hansson
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.