2023-10-04 18:36:11

by Ville Syrjälä

[permalink] [raw]
Subject: [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

From: Ville Syrjälä <[email protected]>

Restore enough of the original behaviour to stop spamming
dmesg with warnings about BIOS locked limits when trying
to restore them during resume.

This still doesn't 100% match the original behaviour
as we no longer attempt to blindly restore the BIOS locked
limits. No idea if that makes any difference in practice.

Cc: Zhang Rui <[email protected]>
Cc: Wang Wendy <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits support")
Signed-off-by: Ville Syrjälä <[email protected]>
---
drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 40a2cc649c79..9a6a40c83f82 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain *rd, int pl,
return rapl_read_data_raw(rd, prim, xlate, data);
}

-static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
- enum pl_prims pl_prim,
- unsigned long long value)
+static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl,
+ enum pl_prims pl_prim,
+ unsigned long long value)
{
enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim);

if (!is_pl_valid(rd, pl))
return -EINVAL;

- if (rd->rpl[pl].locked) {
- pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
+ if (rd->rpl[pl].locked)
return -EACCES;
- }

return rapl_write_data_raw(rd, prim, value);
}
+
+static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
+ enum pl_prims pl_prim,
+ unsigned long long value)
+{
+ int ret;
+
+ ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value);
+ if (ret == -EACCES)
+ pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
+
+ return ret;
+}
+
/*
* Raw RAPL data stored in MSRs are in certain scales. We need to
* convert them into standard units based on the units reported in
@@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void)
rd = power_zone_to_rapl_domain(rp->power_zone);
for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++)
if (rd->rpl[i].last_power_limit)
- rapl_write_pl_data(rd, i, PL_LIMIT,
- rd->rpl[i].last_power_limit);
+ rapl_write_pl_data_nowarn(rd, i, PL_LIMIT,
+ rd->rpl[i].last_power_limit);
}
cpus_read_unlock();
}
--
2.41.0


2023-10-04 18:46:04

by Pandruvada, Srinivas

[permalink] [raw]
Subject: Re: [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <[email protected]>
>
> Restore enough of the original behaviour to stop spamming
> dmesg with warnings about BIOS locked limits when trying
> to restore them during resume.
>
> This still doesn't 100% match the original behaviour
> as we no longer attempt to blindly restore the BIOS locked
> limits. No idea if that makes any difference in practice.
>
I lost the context here. Why can't we simply change pr_warn to pr_debug
here?

Thanks,
Srinivas

> Cc: Zhang Rui <[email protected]>
> Cc: Wang Wendy <[email protected]>
> Cc: Rafael J. Wysocki <[email protected]>
> Cc: Srinivas Pandruvada <[email protected]>
> Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits
> support")
> Signed-off-by: Ville Syrjälä <[email protected]>
> ---
>  drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------
> --
>  1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/powercap/intel_rapl_common.c
> b/drivers/powercap/intel_rapl_common.c
> index 40a2cc649c79..9a6a40c83f82 100644
> --- a/drivers/powercap/intel_rapl_common.c
> +++ b/drivers/powercap/intel_rapl_common.c
> @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain
> *rd, int pl,
>         return rapl_read_data_raw(rd, prim, xlate, data);
>  }
>  
> -static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> -                              enum pl_prims pl_prim,
> -                              unsigned long long value)
> +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl,
> +                                    enum pl_prims pl_prim,
> +                                    unsigned long long value)
>  {
>         enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim);
>  
>         if (!is_pl_valid(rd, pl))
>                 return -EINVAL;
>  
> -       if (rd->rpl[pl].locked) {
> -               pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> rd->name, pl_names[pl]);
> +       if (rd->rpl[pl].locked)
>                 return -EACCES;
> -       }
>  
>         return rapl_write_data_raw(rd, prim, value);
>  }
> +
> +static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> +                             enum pl_prims pl_prim,
> +                             unsigned long long value)
> +{
> +       int ret;
> +
> +       ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value);
> +       if (ret == -EACCES)
> +               pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> rd->name, pl_names[pl]);
> +
> +       return ret;
> +}
> +
>  /*
>   * Raw RAPL data stored in MSRs are in certain scales. We need to
>   * convert them into standard units based on the units reported in
> @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void)
>                 rd = power_zone_to_rapl_domain(rp->power_zone);
>                 for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++)
>                         if (rd->rpl[i].last_power_limit)
> -                               rapl_write_pl_data(rd, i, PL_LIMIT,
> -                                              rd-
> >rpl[i].last_power_limit);
> +                               rapl_write_pl_data_nowarn(rd, i,
> PL_LIMIT,
> +                                                         rd-
> >rpl[i].last_power_limit);
>         }
>         cpus_read_unlock();
>  }

2023-10-04 19:05:06

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote:
> On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote:
> > From: Ville Syrj?l? <[email protected]>
> >
> > Restore enough of the original behaviour to stop spamming
> > dmesg with warnings about BIOS locked limits when trying
> > to restore them during resume.
> >
> > This still doesn't 100% match the original behaviour
> > as we no longer attempt to blindly restore the BIOS locked
> > limits. No idea if that makes any difference in practice.
> >
> I lost the context here. Why can't we simply change pr_warn to pr_debug
> here?

I presume someone wanted to make it pr_warn() for a reason.
I don't mind either way.

>
> Thanks,
> Srinivas
>
> > Cc: Zhang Rui <[email protected]>
> > Cc: Wang Wendy <[email protected]>
> > Cc: Rafael J. Wysocki <[email protected]>
> > Cc: Srinivas Pandruvada <[email protected]>
> > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits
> > support")
> > Signed-off-by: Ville Syrj?l? <[email protected]>
> > ---
> > ?drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------
> > --
> > ?1 file changed, 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/powercap/intel_rapl_common.c
> > b/drivers/powercap/intel_rapl_common.c
> > index 40a2cc649c79..9a6a40c83f82 100644
> > --- a/drivers/powercap/intel_rapl_common.c
> > +++ b/drivers/powercap/intel_rapl_common.c
> > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain
> > *rd, int pl,
> > ????????return rapl_read_data_raw(rd, prim, xlate, data);
> > ?}
> > ?
> > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > -????????????????????????????? enum pl_prims pl_prim,
> > -????????????????????????????? unsigned long long value)
> > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl,
> > +??????????????????????????????????? enum pl_prims pl_prim,
> > +??????????????????????????????????? unsigned long long value)
> > ?{
> > ????????enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim);
> > ?
> > ????????if (!is_pl_valid(rd, pl))
> > ????????????????return -EINVAL;
> > ?
> > -???????if (rd->rpl[pl].locked) {
> > -???????????????pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > rd->name, pl_names[pl]);
> > +???????if (rd->rpl[pl].locked)
> > ????????????????return -EACCES;
> > -???????}
> > ?
> > ????????return rapl_write_data_raw(rd, prim, value);
> > ?}
> > +
> > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > +???????????????????????????? enum pl_prims pl_prim,
> > +???????????????????????????? unsigned long long value)
> > +{
> > +???????int ret;
> > +
> > +???????ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value);
> > +???????if (ret == -EACCES)
> > +???????????????pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > rd->name, pl_names[pl]);
> > +
> > +???????return ret;
> > +}
> > +
> > ?/*
> > ? * Raw RAPL data stored in MSRs are in certain scales. We need to
> > ? * convert them into standard units based on the units reported in
> > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void)
> > ????????????????rd = power_zone_to_rapl_domain(rp->power_zone);
> > ????????????????for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++)
> > ????????????????????????if (rd->rpl[i].last_power_limit)
> > -???????????????????????????????rapl_write_pl_data(rd, i, PL_LIMIT,
> > -????????????????????????????????????????????? rd-
> > >rpl[i].last_power_limit);
> > +???????????????????????????????rapl_write_pl_data_nowarn(rd, i,
> > PL_LIMIT,
> > +???????????????????????????????????????????????????????? rd-
> > >rpl[i].last_power_limit);
> > ????????}
> > ????????cpus_read_unlock();
> > ?}
>

--
Ville Syrj?l?
Intel

2023-10-24 17:11:39

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrj?l? wrote:
> On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote:
> > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote:
> > > From: Ville Syrj?l? <[email protected]>
> > >
> > > Restore enough of the original behaviour to stop spamming
> > > dmesg with warnings about BIOS locked limits when trying
> > > to restore them during resume.
> > >
> > > This still doesn't 100% match the original behaviour
> > > as we no longer attempt to blindly restore the BIOS locked
> > > limits. No idea if that makes any difference in practice.
> > >
> > I lost the context here. Why can't we simply change pr_warn to pr_debug
> > here?
>
> I presume someone wanted to make it pr_warn() for a reason.
> I don't mind either way.

Ping. Can someone make a decision on how this should get fixed
so we get this moving forward?

>
> >
> > Thanks,
> > Srinivas
> >
> > > Cc: Zhang Rui <[email protected]>
> > > Cc: Wang Wendy <[email protected]>
> > > Cc: Rafael J. Wysocki <[email protected]>
> > > Cc: Srinivas Pandruvada <[email protected]>
> > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits
> > > support")
> > > Signed-off-by: Ville Syrj?l? <[email protected]>
> > > ---
> > > ?drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------
> > > --
> > > ?1 file changed, 20 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/powercap/intel_rapl_common.c
> > > b/drivers/powercap/intel_rapl_common.c
> > > index 40a2cc649c79..9a6a40c83f82 100644
> > > --- a/drivers/powercap/intel_rapl_common.c
> > > +++ b/drivers/powercap/intel_rapl_common.c
> > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain
> > > *rd, int pl,
> > > ????????return rapl_read_data_raw(rd, prim, xlate, data);
> > > ?}
> > > ?
> > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > > -????????????????????????????? enum pl_prims pl_prim,
> > > -????????????????????????????? unsigned long long value)
> > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl,
> > > +??????????????????????????????????? enum pl_prims pl_prim,
> > > +??????????????????????????????????? unsigned long long value)
> > > ?{
> > > ????????enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim);
> > > ?
> > > ????????if (!is_pl_valid(rd, pl))
> > > ????????????????return -EINVAL;
> > > ?
> > > -???????if (rd->rpl[pl].locked) {
> > > -???????????????pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > > rd->name, pl_names[pl]);
> > > +???????if (rd->rpl[pl].locked)
> > > ????????????????return -EACCES;
> > > -???????}
> > > ?
> > > ????????return rapl_write_data_raw(rd, prim, value);
> > > ?}
> > > +
> > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > > +???????????????????????????? enum pl_prims pl_prim,
> > > +???????????????????????????? unsigned long long value)
> > > +{
> > > +???????int ret;
> > > +
> > > +???????ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value);
> > > +???????if (ret == -EACCES)
> > > +???????????????pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > > rd->name, pl_names[pl]);
> > > +
> > > +???????return ret;
> > > +}
> > > +
> > > ?/*
> > > ? * Raw RAPL data stored in MSRs are in certain scales. We need to
> > > ? * convert them into standard units based on the units reported in
> > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void)
> > > ????????????????rd = power_zone_to_rapl_domain(rp->power_zone);
> > > ????????????????for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++)
> > > ????????????????????????if (rd->rpl[i].last_power_limit)
> > > -???????????????????????????????rapl_write_pl_data(rd, i, PL_LIMIT,
> > > -????????????????????????????????????????????? rd-
> > > >rpl[i].last_power_limit);
> > > +???????????????????????????????rapl_write_pl_data_nowarn(rd, i,
> > > PL_LIMIT,
> > > +???????????????????????????????????????????????????????? rd-
> > > >rpl[i].last_power_limit);
> > > ????????}
> > > ????????cpus_read_unlock();
> > > ?}
> >
>
> --
> Ville Syrj?l?
> Intel

--
Ville Syrj?l?
Intel

2023-10-24 18:32:05

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

On Tue, Oct 24, 2023 at 7:11 PM Ville Syrjälä
<[email protected]> wrote:
>
> On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote:
> > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote:
> > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote:
> > > > From: Ville Syrjälä <[email protected]>
> > > >
> > > > Restore enough of the original behaviour to stop spamming
> > > > dmesg with warnings about BIOS locked limits when trying
> > > > to restore them during resume.
> > > >
> > > > This still doesn't 100% match the original behaviour
> > > > as we no longer attempt to blindly restore the BIOS locked
> > > > limits. No idea if that makes any difference in practice.
> > > >
> > > I lost the context here. Why can't we simply change pr_warn to pr_debug
> > > here?
> >
> > I presume someone wanted to make it pr_warn() for a reason.
> > I don't mind either way.
>
> Ping. Can someone make a decision on how this should get fixed
> so we get this moving forward?

I thought we were going to replace the pr_warn() with pr_debug().

> > > > Cc: Zhang Rui <[email protected]>
> > > > Cc: Wang Wendy <[email protected]>
> > > > Cc: Rafael J. Wysocki <[email protected]>
> > > > Cc: Srinivas Pandruvada <[email protected]>
> > > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits
> > > > support")
> > > > Signed-off-by: Ville Syrjälä <[email protected]>
> > > > ---
> > > > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------
> > > > --
> > > > 1 file changed, 20 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/drivers/powercap/intel_rapl_common.c
> > > > b/drivers/powercap/intel_rapl_common.c
> > > > index 40a2cc649c79..9a6a40c83f82 100644
> > > > --- a/drivers/powercap/intel_rapl_common.c
> > > > +++ b/drivers/powercap/intel_rapl_common.c
> > > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain
> > > > *rd, int pl,
> > > > return rapl_read_data_raw(rd, prim, xlate, data);
> > > > }
> > > >
> > > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > > > - enum pl_prims pl_prim,
> > > > - unsigned long long value)
> > > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl,
> > > > + enum pl_prims pl_prim,
> > > > + unsigned long long value)
> > > > {
> > > > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim);
> > > >
> > > > if (!is_pl_valid(rd, pl))
> > > > return -EINVAL;
> > > >
> > > > - if (rd->rpl[pl].locked) {
> > > > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > > > rd->name, pl_names[pl]);
> > > > + if (rd->rpl[pl].locked)
> > > > return -EACCES;
> > > > - }
> > > >
> > > > return rapl_write_data_raw(rd, prim, value);
> > > > }
> > > > +
> > > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > > > + enum pl_prims pl_prim,
> > > > + unsigned long long value)
> > > > +{
> > > > + int ret;
> > > > +
> > > > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value);
> > > > + if (ret == -EACCES)
> > > > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > > > rd->name, pl_names[pl]);
> > > > +
> > > > + return ret;
> > > > +}
> > > > +
> > > > /*
> > > > * Raw RAPL data stored in MSRs are in certain scales. We need to
> > > > * convert them into standard units based on the units reported in
> > > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void)
> > > > rd = power_zone_to_rapl_domain(rp->power_zone);
> > > > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++)
> > > > if (rd->rpl[i].last_power_limit)
> > > > - rapl_write_pl_data(rd, i, PL_LIMIT,
> > > > - rd-
> > > > >rpl[i].last_power_limit);
> > > > + rapl_write_pl_data_nowarn(rd, i,
> > > > PL_LIMIT,
> > > > + rd-
> > > > >rpl[i].last_power_limit);
> > > > }
> > > > cpus_read_unlock();
> > > > }
> > >
> >
> > --

2023-10-24 18:49:13

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

On Tue, Oct 24, 2023 at 08:31:34PM +0200, Rafael J. Wysocki wrote:
> On Tue, Oct 24, 2023 at 7:11 PM Ville Syrjälä
> <[email protected]> wrote:
> >
> > On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote:
> > > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote:
> > > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote:
> > > > > From: Ville Syrjälä <[email protected]>
> > > > >
> > > > > Restore enough of the original behaviour to stop spamming
> > > > > dmesg with warnings about BIOS locked limits when trying
> > > > > to restore them during resume.
> > > > >
> > > > > This still doesn't 100% match the original behaviour
> > > > > as we no longer attempt to blindly restore the BIOS locked
> > > > > limits. No idea if that makes any difference in practice.
> > > > >
> > > > I lost the context here. Why can't we simply change pr_warn to pr_debug
> > > > here?
> > >
> > > I presume someone wanted to make it pr_warn() for a reason.
> > > I don't mind either way.
> >
> > Ping. Can someone make a decision on how this should get fixed
> > so we get this moving forward?
>
> I thought we were going to replace the pr_warn() with pr_debug().

I didn't get any answer whether anyone wants to keep the pr_warn().
If everyone is happy with pr_debug() that then I can send a patch
for it.

>
> > > > > Cc: Zhang Rui <[email protected]>
> > > > > Cc: Wang Wendy <[email protected]>
> > > > > Cc: Rafael J. Wysocki <[email protected]>
> > > > > Cc: Srinivas Pandruvada <[email protected]>
> > > > > Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits
> > > > > support")
> > > > > Signed-off-by: Ville Syrjälä <[email protected]>
> > > > > ---
> > > > > drivers/powercap/intel_rapl_common.c | 28 ++++++++++++++++++++------
> > > > > --
> > > > > 1 file changed, 20 insertions(+), 8 deletions(-)
> > > > >
> > > > > diff --git a/drivers/powercap/intel_rapl_common.c
> > > > > b/drivers/powercap/intel_rapl_common.c
> > > > > index 40a2cc649c79..9a6a40c83f82 100644
> > > > > --- a/drivers/powercap/intel_rapl_common.c
> > > > > +++ b/drivers/powercap/intel_rapl_common.c
> > > > > @@ -882,22 +882,34 @@ static int rapl_read_pl_data(struct rapl_domain
> > > > > *rd, int pl,
> > > > > return rapl_read_data_raw(rd, prim, xlate, data);
> > > > > }
> > > > >
> > > > > -static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > > > > - enum pl_prims pl_prim,
> > > > > - unsigned long long value)
> > > > > +static int rapl_write_pl_data_nowarn(struct rapl_domain *rd, int pl,
> > > > > + enum pl_prims pl_prim,
> > > > > + unsigned long long value)
> > > > > {
> > > > > enum rapl_primitives prim = get_pl_prim(rd, pl, pl_prim);
> > > > >
> > > > > if (!is_pl_valid(rd, pl))
> > > > > return -EINVAL;
> > > > >
> > > > > - if (rd->rpl[pl].locked) {
> > > > > - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > > > > rd->name, pl_names[pl]);
> > > > > + if (rd->rpl[pl].locked)
> > > > > return -EACCES;
> > > > > - }
> > > > >
> > > > > return rapl_write_data_raw(rd, prim, value);
> > > > > }
> > > > > +
> > > > > +static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> > > > > + enum pl_prims pl_prim,
> > > > > + unsigned long long value)
> > > > > +{
> > > > > + int ret;
> > > > > +
> > > > > + ret = rapl_write_pl_data_nowarn(rd, pl, pl_prim, value);
> > > > > + if (ret == -EACCES)
> > > > > + pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name,
> > > > > rd->name, pl_names[pl]);
> > > > > +
> > > > > + return ret;
> > > > > +}
> > > > > +
> > > > > /*
> > > > > * Raw RAPL data stored in MSRs are in certain scales. We need to
> > > > > * convert them into standard units based on the units reported in
> > > > > @@ -1634,8 +1646,8 @@ static void power_limit_state_restore(void)
> > > > > rd = power_zone_to_rapl_domain(rp->power_zone);
> > > > > for (i = POWER_LIMIT1; i < NR_POWER_LIMITS; i++)
> > > > > if (rd->rpl[i].last_power_limit)
> > > > > - rapl_write_pl_data(rd, i, PL_LIMIT,
> > > > > - rd-
> > > > > >rpl[i].last_power_limit);
> > > > > + rapl_write_pl_data_nowarn(rd, i,
> > > > > PL_LIMIT,
> > > > > + rd-
> > > > > >rpl[i].last_power_limit);
> > > > > }
> > > > > cpus_read_unlock();
> > > > > }
> > > >
> > >
> > > --

--
Ville Syrjälä
Intel

2023-10-24 18:52:54

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH] powercap: intel_rapl: Don't warn about BIOS locked limits during resume

On Tue, Oct 24, 2023 at 8:48 PM Ville Syrjälä
<[email protected]> wrote:
>
> On Tue, Oct 24, 2023 at 08:31:34PM +0200, Rafael J. Wysocki wrote:
> > On Tue, Oct 24, 2023 at 7:11 PM Ville Syrjälä
> > <[email protected]> wrote:
> > >
> > > On Wed, Oct 04, 2023 at 09:59:47PM +0300, Ville Syrjälä wrote:
> > > > On Wed, Oct 04, 2023 at 06:45:22PM +0000, Pandruvada, Srinivas wrote:
> > > > > On Wed, 2023-10-04 at 21:34 +0300, Ville Syrjala wrote:
> > > > > > From: Ville Syrjälä <[email protected]>
> > > > > >
> > > > > > Restore enough of the original behaviour to stop spamming
> > > > > > dmesg with warnings about BIOS locked limits when trying
> > > > > > to restore them during resume.
> > > > > >
> > > > > > This still doesn't 100% match the original behaviour
> > > > > > as we no longer attempt to blindly restore the BIOS locked
> > > > > > limits. No idea if that makes any difference in practice.
> > > > > >
> > > > > I lost the context here. Why can't we simply change pr_warn to pr_debug
> > > > > here?
> > > >
> > > > I presume someone wanted to make it pr_warn() for a reason.
> > > > I don't mind either way.
> > >
> > > Ping. Can someone make a decision on how this should get fixed
> > > so we get this moving forward?
> >
> > I thought we were going to replace the pr_warn() with pr_debug().
>
> I didn't get any answer whether anyone wants to keep the pr_warn().
> If everyone is happy with pr_debug() that then I can send a patch
> for it.

Yes, please.

2023-10-24 19:17:37

by Ville Syrjälä

[permalink] [raw]
Subject: [PATCH v2] powercap: intel_rapl: Downgrade BIOS locked limits pr_warn() to pr_debug()

From: Ville Syrjälä <[email protected]>

Before the refactoring the pr_warn() only triggered when
someone explicitly tried to write to a BIOS locked limit.
After the refactoring the warning is also triggering during
system resume. The user can't do anything about this so
printing scary warnings doesn't make sense

Keep the printk but make it pr_debug() instead of pr_warn()
to make it clear it's not a serious issue.

Cc: Zhang Rui <[email protected]>
Cc: Wang Wendy <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits support")
Signed-off-by: Ville Syrjälä <[email protected]>
---
drivers/powercap/intel_rapl_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 40a2cc649c79..2feed036c1cd 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -892,7 +892,7 @@ static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
return -EINVAL;

if (rd->rpl[pl].locked) {
- pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
+ pr_debug("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
return -EACCES;
}

--
2.41.0

2023-10-24 20:08:37

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2] powercap: intel_rapl: Downgrade BIOS locked limits pr_warn() to pr_debug()

On Tue, Oct 24, 2023 at 9:17 PM Ville Syrjala
<[email protected]> wrote:
>
> From: Ville Syrjälä <[email protected]>
>
> Before the refactoring the pr_warn() only triggered when
> someone explicitly tried to write to a BIOS locked limit.
> After the refactoring the warning is also triggering during
> system resume. The user can't do anything about this so
> printing scary warnings doesn't make sense
>
> Keep the printk but make it pr_debug() instead of pr_warn()
> to make it clear it's not a serious issue.
>
> Cc: Zhang Rui <[email protected]>
> Cc: Wang Wendy <[email protected]>
> Cc: Rafael J. Wysocki <[email protected]>
> Cc: Srinivas Pandruvada <[email protected]>
> Fixes: 9050a9cd5e4c ("powercap: intel_rapl: Cleanup Power Limits support")
> Signed-off-by: Ville Syrjälä <[email protected]>
> ---
> drivers/powercap/intel_rapl_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
> index 40a2cc649c79..2feed036c1cd 100644
> --- a/drivers/powercap/intel_rapl_common.c
> +++ b/drivers/powercap/intel_rapl_common.c
> @@ -892,7 +892,7 @@ static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
> return -EINVAL;
>
> if (rd->rpl[pl].locked) {
> - pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
> + pr_debug("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
> return -EACCES;
> }
>
> --

Applied, thanks!