* [PATCH] thermal: intel_powerclamp: Return last requested state as cur_state
@ 2023-02-01 21:07 Srinivas Pandruvada
2023-02-02 16:44 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2023-02-01 21:07 UTC (permalink / raw)
To: rafael
Cc: linux-pm, linux-kernel, daniel.lezcano, rui.zhang, Srinivas Pandruvada
When the user is reading cur_state from the thermal cooling device for
Intel powerclamp device:
- It returns the idle ratio from Package C-state counters when
there is active idle injection session.
- -1, when there is no active idle injection session.
This information is not very useful as the package C-state counters vary
a lot from read to read. Instead just return the last requested cur_state.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 2f4cbfdf26a0..72a45cf2708c 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -590,17 +590,7 @@ static int powerclamp_get_max_state(struct thermal_cooling_device *cdev,
static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev,
unsigned long *state)
{
- if (clamping) {
- if (poll_pkg_cstate_enable)
- *state = pkg_cstate_ratio_cur;
- else
- *state = set_target_ratio;
- } else {
- /* to save power, do not poll idle ratio while not clamping */
- *state = -1; /* indicates invalid state */
- }
-
- return 0;
+ return set_target_ratio;
}
static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev,
--
2.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal: intel_powerclamp: Return last requested state as cur_state
2023-02-01 21:07 [PATCH] thermal: intel_powerclamp: Return last requested state as cur_state Srinivas Pandruvada
@ 2023-02-02 16:44 ` Rafael J. Wysocki
2023-02-02 22:21 ` srinivas pandruvada
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2023-02-02 16:44 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: rafael, linux-pm, linux-kernel, daniel.lezcano, rui.zhang
On Wed, Feb 1, 2023 at 10:07 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> When the user is reading cur_state from the thermal cooling device for
> Intel powerclamp device:
> - It returns the idle ratio from Package C-state counters when
> there is active idle injection session.
> - -1, when there is no active idle injection session.
>
> This information is not very useful as the package C-state counters vary
> a lot from read to read. Instead just return the last requested cur_state.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index 2f4cbfdf26a0..72a45cf2708c 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -590,17 +590,7 @@ static int powerclamp_get_max_state(struct thermal_cooling_device *cdev,
> static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev,
> unsigned long *state)
> {
> - if (clamping) {
> - if (poll_pkg_cstate_enable)
> - *state = pkg_cstate_ratio_cur;
> - else
> - *state = set_target_ratio;
> - } else {
> - /* to save power, do not poll idle ratio while not clamping */
> - *state = -1; /* indicates invalid state */
> - }
> -
> - return 0;
> + return set_target_ratio;
*state = set_target_ratio;
return 0;
> }
>
> static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev,
> --
And please rebase it on top of the idle_inject series (which is being
added to my bleeding-edge branch right now).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal: intel_powerclamp: Return last requested state as cur_state
2023-02-02 16:44 ` Rafael J. Wysocki
@ 2023-02-02 22:21 ` srinivas pandruvada
2023-02-03 13:59 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: srinivas pandruvada @ 2023-02-02 22:21 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-pm, linux-kernel, daniel.lezcano, rui.zhang
On Thu, 2023-02-02 at 17:44 +0100, Rafael J. Wysocki wrote:
> On Wed, Feb 1, 2023 at 10:07 PM Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com> wrote:
> >
> > When the user is reading cur_state from the thermal cooling device
> > for
> > Intel powerclamp device:
> > - It returns the idle ratio from Package C-state counters when
> > there is active idle injection session.
> > - -1, when there is no active idle injection session.
> >
> > This information is not very useful as the package C-state counters
> > vary
> > a lot from read to read. Instead just return the last requested
> > cur_state.
> >
> > Signed-off-by: Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com>
> > ---
> > drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
> > 1 file changed, 1 insertion(+), 11 deletions(-)
> >
> > diff --git a/drivers/thermal/intel/intel_powerclamp.c
> > b/drivers/thermal/intel/intel_powerclamp.c
> > index 2f4cbfdf26a0..72a45cf2708c 100644
> > --- a/drivers/thermal/intel/intel_powerclamp.c
> > +++ b/drivers/thermal/intel/intel_powerclamp.c
> > @@ -590,17 +590,7 @@ static int powerclamp_get_max_state(struct
> > thermal_cooling_device *cdev,
> > static int powerclamp_get_cur_state(struct thermal_cooling_device
> > *cdev,
> > unsigned long *state)
> > {
> > - if (clamping) {
> > - if (poll_pkg_cstate_enable)
> > - *state = pkg_cstate_ratio_cur;
> > - else
> > - *state = set_target_ratio;
> > - } else {
> > - /* to save power, do not poll idle ratio while not
> > clamping */
> > - *state = -1; /* indicates invalid state */
> > - }
> > -
> > - return 0;
> > + return set_target_ratio;
>
> *state = set_target_ratio;
> return 0;
>
Sorry.
What a blunder! Sent patch from 37000 ft. Should never do that.
Thanks,
Srinivas
> > }
> >
> > static int powerclamp_set_cur_state(struct thermal_cooling_device
> > *cdev,
> > --
>
> And please rebase it on top of the idle_inject series (which is being
> added to my bleeding-edge branch right now).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal: intel_powerclamp: Return last requested state as cur_state
2023-02-02 22:21 ` srinivas pandruvada
@ 2023-02-03 13:59 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2023-02-03 13:59 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Rafael J. Wysocki, linux-pm, linux-kernel, daniel.lezcano, rui.zhang
On Thu, Feb 2, 2023 at 11:21 PM srinivas pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> On Thu, 2023-02-02 at 17:44 +0100, Rafael J. Wysocki wrote:
> > On Wed, Feb 1, 2023 at 10:07 PM Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com> wrote:
> > >
> > > When the user is reading cur_state from the thermal cooling device
> > > for
> > > Intel powerclamp device:
> > > - It returns the idle ratio from Package C-state counters when
> > > there is active idle injection session.
> > > - -1, when there is no active idle injection session.
> > >
> > > This information is not very useful as the package C-state counters
> > > vary
> > > a lot from read to read. Instead just return the last requested
> > > cur_state.
> > >
> > > Signed-off-by: Srinivas Pandruvada
> > > <srinivas.pandruvada@linux.intel.com>
> > > ---
> > > drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
> > > 1 file changed, 1 insertion(+), 11 deletions(-)
> > >
> > > diff --git a/drivers/thermal/intel/intel_powerclamp.c
> > > b/drivers/thermal/intel/intel_powerclamp.c
> > > index 2f4cbfdf26a0..72a45cf2708c 100644
> > > --- a/drivers/thermal/intel/intel_powerclamp.c
> > > +++ b/drivers/thermal/intel/intel_powerclamp.c
> > > @@ -590,17 +590,7 @@ static int powerclamp_get_max_state(struct
> > > thermal_cooling_device *cdev,
> > > static int powerclamp_get_cur_state(struct thermal_cooling_device
> > > *cdev,
> > > unsigned long *state)
> > > {
> > > - if (clamping) {
> > > - if (poll_pkg_cstate_enable)
> > > - *state = pkg_cstate_ratio_cur;
> > > - else
> > > - *state = set_target_ratio;
> > > - } else {
> > > - /* to save power, do not poll idle ratio while not
> > > clamping */
> > > - *state = -1; /* indicates invalid state */
> > > - }
> > > -
> > > - return 0;
> > > + return set_target_ratio;
> >
> > *state = set_target_ratio;
> > return 0;
> >
> Sorry.
>
> What a blunder! Sent patch from 37000 ft. Should never do that.
No worries.
I didn't realize that you were traveling.
I can prepare this patch myself just fine if that helps.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-03 14:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 21:07 [PATCH] thermal: intel_powerclamp: Return last requested state as cur_state Srinivas Pandruvada
2023-02-02 16:44 ` Rafael J. Wysocki
2023-02-02 22:21 ` srinivas pandruvada
2023-02-03 13:59 ` Rafael J. Wysocki
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.