linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Expose all known Intel DPTF policies
@ 2018-10-10  8:30 Matthew Garrett
  2018-10-10  8:30 ` [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs Matthew Garrett
  2018-10-10  8:30 ` [PATCH 2/2] thermal/int340x_thermal: fix mode setting Matthew Garrett
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew Garrett @ 2018-10-10  8:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-pm

Intel's Dynamic Platform and Thermal Framework is a combination
firmware/OS framework for allowing userland to implement more complex
thermal policies in conjunction with the platform firmware. The rough
gist is that the firmware exposes a set of information describing the
relationships between various heat generating and heat removing
components in the system, the OS makes a reasonable decision about what
sort of policy will work best given the constraints the system is
currently operating under and passes that decision back to the firmware,
and the firmware does some magic (potentially including reprogramming
various CPU MSRs) to match the OS policy. Depending on the policy, the
OS may then be responsible for ensuring that the system stays within the
appropriate thermal envelope.

Linux already has a driver that exposes the firmware interface for
setting the policy, but it's somewhat broken - it only exposes a very
small subset of the defined policies, and most new systems don't
intersect with the exposed ones (strangely, support for some policies
was actively removed in 31908f45a583e8f21db37f402b6e8d5739945afd). It
also doesn't actually /work/ on any new systems, since the PASSIVE_1
policy seems to have been replaced by the PASSIVE_2 policy and therefore
it's impossible to actually trigger a new UUID write.

The consequence of this right now is that various new systems (such as
most current Thinkpads) default to a safe policy that throttles the CPU
at a low temperature, dramatically reducing system performance. Since
Linux provides no mechanism to set any of the other policies the
platform supports, users are stuck. This patchset adds all the UUIDs
I've been able to find from scraping various ACPI tables, and fixes the
mode setting in order to make it possible to actually set the new modes.
It should be noted that this is nowhere near an actual solution - doing
this properly requires appropriate userspace management tooling, and
Intel haven't documented most of the ACPI information required to make
it possible to write such tooling. However, this is a first step in
making it possible to do that work.



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

* [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs
  2018-10-10  8:30 Expose all known Intel DPTF policies Matthew Garrett
@ 2018-10-10  8:30 ` Matthew Garrett
  2018-12-03 15:08   ` Zhang Rui
  2018-10-10  8:30 ` [PATCH 2/2] thermal/int340x_thermal: fix mode setting Matthew Garrett
  1 sibling, 1 reply; 6+ messages in thread
From: Matthew Garrett @ 2018-10-10  8:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-pm, Matthew Garrett, Matthew Garrett, Zhang Rui, Nisha Aram

Platforms support more DPTF policies than the driver currently exposes.
Add them. This effectively reverts
31908f45a583e8f21db37f402b6e8d5739945afd which removed several UUIDs
without explaining why.

Signed-off-by: Matthew Garrett <mjg59@google.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Nisha Aram <nisha.aram@intel.com>
---
 drivers/thermal/int340x_thermal/int3400_thermal.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c
index e26b01c05e82..51c9097eaf7a 100644
--- a/drivers/thermal/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
@@ -22,6 +22,13 @@ enum int3400_thermal_uuid {
 	INT3400_THERMAL_PASSIVE_1,
 	INT3400_THERMAL_ACTIVE,
 	INT3400_THERMAL_CRITICAL,
+	INT3400_THERMAL_ADAPTIVE_PERFORMANCE,
+	INT3400_THERMAL_EMERGENCY_CALL_MODE,
+	INT3400_THERMAL_PASSIVE_2,
+	INT3400_THERMAL_POWER_BOSS,
+	INT3400_THERMAL_VIRTUAL_SENSOR,
+	INT3400_THERMAL_COOLING_MODE,
+	INT3400_THERMAL_HARDWARE_DUTY_CYCLING,
 	INT3400_THERMAL_MAXIMUM_UUID,
 };
 
@@ -29,6 +36,13 @@ static char *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
 	"42A441D6-AE6A-462b-A84B-4A8CE79027D3",
 	"3A95C389-E4B8-4629-A526-C52C88626BAE",
 	"97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
+	"63BE270F-1C11-48FD-A6F7-3AF253FF3E2D",
+	"5349962F-71E6-431D-9AE8-0A635B710AEE",
+	"9E04115A-AE87-4D1C-9500-0F3E340BFE75",
+	"F5A35014-C209-46A4-993A-EB56DE7530A1",
+	"6ED722A7-9240-48A5-B479-31EEF723D7CF",
+	"16CAF1B7-DD38-40ED-B1C1-1B8A1913D531",
+	"BE84BABF-C4D4-403D-B495-3128FD44dAC1",
 };
 
 struct int3400_thermal_priv {
-- 
2.19.0.605.g01d371f741-goog


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

* [PATCH 2/2] thermal/int340x_thermal: fix mode setting
  2018-10-10  8:30 Expose all known Intel DPTF policies Matthew Garrett
  2018-10-10  8:30 ` [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs Matthew Garrett
@ 2018-10-10  8:30 ` Matthew Garrett
  1 sibling, 0 replies; 6+ messages in thread
From: Matthew Garrett @ 2018-10-10  8:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-pm, Matthew Garrett, Matthew Garrett, Zhang Rui

int3400 only pushes the UUID into the firmware when the mode is flipped
to "enable". The current code only exposes the mode flag if the firmware
supports the PASSIVE_1 UUID, which not all machines do. Remove the
restriction.

Signed-off-by: Matthew Garrett <mjg59@google.com>
Cc: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/int340x_thermal/int3400_thermal.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c
index 51c9097eaf7a..e9d58de8b5da 100644
--- a/drivers/thermal/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
@@ -316,10 +316,9 @@ static int int3400_thermal_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
-	if (priv->uuid_bitmap & 1 << INT3400_THERMAL_PASSIVE_1) {
-		int3400_thermal_ops.get_mode = int3400_thermal_get_mode;
-		int3400_thermal_ops.set_mode = int3400_thermal_set_mode;
-	}
+	int3400_thermal_ops.get_mode = int3400_thermal_get_mode;
+	int3400_thermal_ops.set_mode = int3400_thermal_set_mode;
+
 	priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0,
 						priv, &int3400_thermal_ops,
 						&int3400_thermal_params, 0, 0);
-- 
2.19.0.605.g01d371f741-goog


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

* Re: [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs
  2018-10-10  8:30 ` [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs Matthew Garrett
@ 2018-12-03 15:08   ` Zhang Rui
  2019-01-23  0:44     ` Joel Stanley
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang Rui @ 2018-12-03 15:08 UTC (permalink / raw)
  To: Matthew Garrett, linux-kernel; +Cc: linux-pm, Matthew Garrett, Nisha Aram

Hi, Matthew,

On 三, 2018-10-10 at 01:30 -0700, Matthew Garrett wrote:
> Platforms support more DPTF policies than the driver currently
> exposes.
> Add them. This effectively reverts
> 31908f45a583e8f21db37f402b6e8d5739945afd which removed several UUIDs
> without explaining why.
> 
I'm going to apply this patch series, just with two minor changes,
1. 31908f45a583e8f21db37f402b6e8d5739945afd does not follow the git
commit description style 'commit <12+ chars of sha1> ("<title line>")'
2. the UUIDs were removed previously because these policies were not
used.

thanks,
rui

> Signed-off-by: Matthew Garrett <mjg59@google.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Nisha Aram <nisha.aram@intel.com>
> ---
>  drivers/thermal/int340x_thermal/int3400_thermal.c | 14
> ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c
> b/drivers/thermal/int340x_thermal/int3400_thermal.c
> index e26b01c05e82..51c9097eaf7a 100644
> --- a/drivers/thermal/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
> @@ -22,6 +22,13 @@ enum int3400_thermal_uuid {
>  	INT3400_THERMAL_PASSIVE_1,
>  	INT3400_THERMAL_ACTIVE,
>  	INT3400_THERMAL_CRITICAL,
> +	INT3400_THERMAL_ADAPTIVE_PERFORMANCE,
> +	INT3400_THERMAL_EMERGENCY_CALL_MODE,
> +	INT3400_THERMAL_PASSIVE_2,
> +	INT3400_THERMAL_POWER_BOSS,
> +	INT3400_THERMAL_VIRTUAL_SENSOR,
> +	INT3400_THERMAL_COOLING_MODE,
> +	INT3400_THERMAL_HARDWARE_DUTY_CYCLING,
>  	INT3400_THERMAL_MAXIMUM_UUID,
>  };
>  
> @@ -29,6 +36,13 @@ static char
> *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
>  	"42A441D6-AE6A-462b-A84B-4A8CE79027D3",
>  	"3A95C389-E4B8-4629-A526-C52C88626BAE",
>  	"97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
> +	"63BE270F-1C11-48FD-A6F7-3AF253FF3E2D",
> +	"5349962F-71E6-431D-9AE8-0A635B710AEE",
> +	"9E04115A-AE87-4D1C-9500-0F3E340BFE75",
> +	"F5A35014-C209-46A4-993A-EB56DE7530A1",
> +	"6ED722A7-9240-48A5-B479-31EEF723D7CF",
> +	"16CAF1B7-DD38-40ED-B1C1-1B8A1913D531",
> +	"BE84BABF-C4D4-403D-B495-3128FD44dAC1",
>  };
>  
>  struct int3400_thermal_priv {

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

* Re: [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs
  2018-12-03 15:08   ` Zhang Rui
@ 2019-01-23  0:44     ` Joel Stanley
  2019-01-23  5:58       ` Zhang Rui
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Stanley @ 2019-01-23  0:44 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Matthew Garrett, Linux Kernel Mailing List, linux-pm,
	Matthew Garrett, Nisha Aram

Hello Rui,

On Tue, 4 Dec 2018 at 02:12, Zhang Rui <rui.zhang@intel.com> wrote:
> On 三, 2018-10-10 at 01:30 -0700, Matthew Garrett wrote:
> > Platforms support more DPTF policies than the driver currently
> > exposes.
> > Add them. This effectively reverts
> > 31908f45a583e8f21db37f402b6e8d5739945afd which removed several UUIDs
> > without explaining why.
> >
> I'm going to apply this patch series, just with two minor changes,
> 1. 31908f45a583e8f21db37f402b6e8d5739945afd does not follow the git
> commit description style 'commit <12+ chars of sha1> ("<title line>")'
> 2. the UUIDs were removed previously because these policies were not
> used.

Which tree did this series get applied to?

Cheers,

Joel

>
> thanks,
> rui
>
> > Signed-off-by: Matthew Garrett <mjg59@google.com>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Nisha Aram <nisha.aram@intel.com>
> > ---
> >  drivers/thermal/int340x_thermal/int3400_thermal.c | 14
> > ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c
> > b/drivers/thermal/int340x_thermal/int3400_thermal.c
> > index e26b01c05e82..51c9097eaf7a 100644
> > --- a/drivers/thermal/int340x_thermal/int3400_thermal.c
> > +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
> > @@ -22,6 +22,13 @@ enum int3400_thermal_uuid {
> >       INT3400_THERMAL_PASSIVE_1,
> >       INT3400_THERMAL_ACTIVE,
> >       INT3400_THERMAL_CRITICAL,
> > +     INT3400_THERMAL_ADAPTIVE_PERFORMANCE,
> > +     INT3400_THERMAL_EMERGENCY_CALL_MODE,
> > +     INT3400_THERMAL_PASSIVE_2,
> > +     INT3400_THERMAL_POWER_BOSS,
> > +     INT3400_THERMAL_VIRTUAL_SENSOR,
> > +     INT3400_THERMAL_COOLING_MODE,
> > +     INT3400_THERMAL_HARDWARE_DUTY_CYCLING,
> >       INT3400_THERMAL_MAXIMUM_UUID,
> >  };
> >
> > @@ -29,6 +36,13 @@ static char
> > *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
> >       "42A441D6-AE6A-462b-A84B-4A8CE79027D3",
> >       "3A95C389-E4B8-4629-A526-C52C88626BAE",
> >       "97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
> > +     "63BE270F-1C11-48FD-A6F7-3AF253FF3E2D",
> > +     "5349962F-71E6-431D-9AE8-0A635B710AEE",
> > +     "9E04115A-AE87-4D1C-9500-0F3E340BFE75",
> > +     "F5A35014-C209-46A4-993A-EB56DE7530A1",
> > +     "6ED722A7-9240-48A5-B479-31EEF723D7CF",
> > +     "16CAF1B7-DD38-40ED-B1C1-1B8A1913D531",
> > +     "BE84BABF-C4D4-403D-B495-3128FD44dAC1",
> >  };
> >
> >  struct int3400_thermal_priv {

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

* Re: [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs
  2019-01-23  0:44     ` Joel Stanley
@ 2019-01-23  5:58       ` Zhang Rui
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang Rui @ 2019-01-23  5:58 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Matthew Garrett, Linux Kernel Mailing List, linux-pm,
	Matthew Garrett, Nisha Aram

On 三, 2019-01-23 at 11:44 +1100, Joel Stanley wrote:
> Hello Rui,
> 
> On Tue, 4 Dec 2018 at 02:12, Zhang Rui <rui.zhang@intel.com> wrote:
> > 
> > On 三, 2018-10-10 at 01:30 -0700, Matthew Garrett wrote:
> > > 
> > > Platforms support more DPTF policies than the driver currently
> > > exposes.
> > > Add them. This effectively reverts
> > > 31908f45a583e8f21db37f402b6e8d5739945afd which removed several
> > > UUIDs
> > > without explaining why.
> > > 
> > I'm going to apply this patch series, just with two minor changes,
> > 1. 31908f45a583e8f21db37f402b6e8d5739945afd does not follow the git
> > commit description style 'commit <12+ chars of sha1> ("<title
> > line>")'
> > 2. the UUIDs were removed previously because these policies were
> > not
> > used.
> Which tree did this series get applied to?
> 
it is in my next branch, and I will queue it for 5.1.
https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/log/?h
=next

thanks,
rui
> Cheers,
> 
> Joel
> 
> > 
> > 
> > thanks,
> > rui
> > 
> > > 
> > > Signed-off-by: Matthew Garrett <mjg59@google.com>
> > > Cc: Zhang Rui <rui.zhang@intel.com>
> > > Cc: Nisha Aram <nisha.aram@intel.com>
> > > ---
> > >  drivers/thermal/int340x_thermal/int3400_thermal.c | 14
> > > ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > > 
> > > diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c
> > > b/drivers/thermal/int340x_thermal/int3400_thermal.c
> > > index e26b01c05e82..51c9097eaf7a 100644
> > > --- a/drivers/thermal/int340x_thermal/int3400_thermal.c
> > > +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
> > > @@ -22,6 +22,13 @@ enum int3400_thermal_uuid {
> > >       INT3400_THERMAL_PASSIVE_1,
> > >       INT3400_THERMAL_ACTIVE,
> > >       INT3400_THERMAL_CRITICAL,
> > > +     INT3400_THERMAL_ADAPTIVE_PERFORMANCE,
> > > +     INT3400_THERMAL_EMERGENCY_CALL_MODE,
> > > +     INT3400_THERMAL_PASSIVE_2,
> > > +     INT3400_THERMAL_POWER_BOSS,
> > > +     INT3400_THERMAL_VIRTUAL_SENSOR,
> > > +     INT3400_THERMAL_COOLING_MODE,
> > > +     INT3400_THERMAL_HARDWARE_DUTY_CYCLING,
> > >       INT3400_THERMAL_MAXIMUM_UUID,
> > >  };
> > > 
> > > @@ -29,6 +36,13 @@ static char
> > > *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
> > >       "42A441D6-AE6A-462b-A84B-4A8CE79027D3",
> > >       "3A95C389-E4B8-4629-A526-C52C88626BAE",
> > >       "97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
> > > +     "63BE270F-1C11-48FD-A6F7-3AF253FF3E2D",
> > > +     "5349962F-71E6-431D-9AE8-0A635B710AEE",
> > > +     "9E04115A-AE87-4D1C-9500-0F3E340BFE75",
> > > +     "F5A35014-C209-46A4-993A-EB56DE7530A1",
> > > +     "6ED722A7-9240-48A5-B479-31EEF723D7CF",
> > > +     "16CAF1B7-DD38-40ED-B1C1-1B8A1913D531",
> > > +     "BE84BABF-C4D4-403D-B495-3128FD44dAC1",
> > >  };
> > > 
> > >  struct int3400_thermal_priv {

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

end of thread, other threads:[~2019-01-23  5:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10  8:30 Expose all known Intel DPTF policies Matthew Garrett
2018-10-10  8:30 ` [PATCH 1/2] thermal/int340x_thermal: Add additional UUIDs Matthew Garrett
2018-12-03 15:08   ` Zhang Rui
2019-01-23  0:44     ` Joel Stanley
2019-01-23  5:58       ` Zhang Rui
2018-10-10  8:30 ` [PATCH 2/2] thermal/int340x_thermal: fix mode setting Matthew Garrett

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).