Skip to contentSkip to conversation

thermal threshold and notification v2.0

PATCH In review Srinivas Pandruvada 4 participants 8 messages Apr 9, 2013 – Apr 16, 2013

lore
Share & tools
lore
#0 lore raw

cover thermal threshold and notification v2.0

v2.0
As suggested by Guenter Roeck, used the previous development in this area as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the following additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

The notification mechanism is implemented for package level by using uevent. Also a debugfs interface is added to check count of interrupts and worker fn scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp sysfs, during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the market. Unfortunately these devices reach maximum temperature with relatively less workloads, causing BIOS to do thermal throttling. There are real performance issues due to aggressive BIOS action to control thermals and also thermal breakdown in some cases.

Even the most expensive laptops, don't have correct ACPI thermal configuration, so that kernel thermal driver can act. In some case even the trip point is higher than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system very efficiently. They include RAPL based cooling driver, Powerclamp driver and P state driver. To utilize these cooling device a closed loop user mode program is required, which will utilize these method and dynamically compensate for high CPU temperatures, without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details can be obtained from "https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon_Introduction.pdf". This daemon polls for cpu temperature and apply compensation once the CPU reach target temperature.

This polling can be mostly avoided, by getting notification for the temperature, where it needs to wake up and get ready for apply compensation. In most of the normal use cases, there may not be any threshold events. So very minimal number of user space notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize events. Also interrupts are enabled only when a non tj_max(default) value is written to thresholds.

Once thresholds are violated, it uses a rate control of 5 seconds, reducing the number of interrupts, when temperature is hanging around trip point. Using the sticky log bit, it sends kboject uevent change notification for corresponding package sysfs. Once the thermal daemon receives notification, it can change to new threshold or act immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

 Documentation/hwmon/coretemp             |   8 +
 arch/x86/include/asm/mce.h               |   7 +
 arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
 drivers/hwmon/coretemp.c                 | 292 +++++++++++++++++++++++++++++--
 4 files changed, 356 insertions(+), 14 deletions(-)
Signature · 7 lines
1.7.11.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 70 lines · Srinivas Pandruvada

v2.0
As suggested by Guenter Roeck, used the previous development in this area as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the following additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

The notification mechanism is implemented for package level by using uevent. Also a debugfs interface is added to check count of interrupts and worker fn scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp sysfs, during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the market. Unfortunately these devices reach maximum temperature with relatively less workloads, causing BIOS to do thermal throttling. There are real performance issues due to aggressive BIOS action to control thermals and also thermal breakdown in some cases.

Even the most expensive laptops, don't have correct ACPI thermal configuration, so that kernel thermal driver can act. In some case even the trip point is higher than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system very efficiently. They include RAPL based cooling driver, Powerclamp driver and P state driver. To utilize these cooling device a closed loop user mode program is required, which will utilize these method and dynamically compensate for high CPU temperatures, without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details can be obtained from "https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon_Introduction.pdf". This daemon polls for cpu temperature and apply compensation once the CPU reach target temperature.

This polling can be mostly avoided, by getting notification for the temperature, where it needs to wake up and get ready for apply compensation. In most of the normal use cases, there may not be any threshold events. So very minimal number of user space notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize events. Also interrupts are enabled only when a non tj_max(default) value is written to thresholds.

Once thresholds are violated, it uses a rate control of 5 seconds, reducing the number of interrupts, when temperature is hanging around trip point. Using the sticky log bit, it sends kboject uevent change notification for corresponding package sysfs. Once the thermal daemon receives notification, it can change to new threshold or act immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

Quoted 6 lines
 Documentation/hwmon/coretemp             |   8 +
 arch/x86/include/asm/mce.h               |   7 +
 arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
 drivers/hwmon/coretemp.c                 | 292 +++++++++++++++++++++++++++++--
 4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters if hwmon is really the right place for this. I may be wrong, but it seems to me it would better fit into thermal.

Thanks,
Guenter

#2 lore raw
Quoted 78 lines · Guenter Roeck
Quoted 69 lines · Srinivas Pandruvada

v2.0
As suggested by Guenter Roeck, used the previous development in this area as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the following additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

The notification mechanism is implemented for package level by using uevent. Also a debugfs interface is added to check count of interrupts and worker fn scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp sysfs, during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the market. Unfortunately these devices reach maximum temperature with relatively less workloads, causing BIOS to do thermal throttling. There are real performance issues due to aggressive BIOS action to control thermals and also thermal breakdown in some cases.

Even the most expensive laptops, don't have correct ACPI thermal configuration, so that kernel thermal driver can act. In some case even the trip point is higher than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system very efficiently. They include RAPL based cooling driver, Powerclamp driver and P state driver. To utilize these cooling device a closed loop user mode program is required, which will utilize these method and dynamically compensate for high CPU temperatures, without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details can be obtained from "https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon_Introduction.pdf". This daemon polls for cpu temperature and apply compensation once the CPU reach target temperature.

This polling can be mostly avoided, by getting notification for the temperature, where it needs to wake up and get ready for apply compensation. In most of the normal use cases, there may not be any threshold events. So very minimal number of user space notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize events. Also interrupts are enabled only when a non tj_max(default) value is written to thresholds.

Once thresholds are violated, it uses a rate control of 5 seconds, reducing the number of interrupts, when temperature is hanging around trip point. Using the sticky log bit, it sends kboject uevent change notification for corresponding package sysfs. Once the thermal daemon receives notification, it can change to new threshold or act immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

Quoted 6 lines
  Documentation/hwmon/coretemp             |   8 +
  arch/x86/include/asm/mce.h               |   7 +
  arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
  drivers/hwmon/coretemp.c                 | 292 +++++++++++++++++++++++++++++--
  4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

Quoted 8 lines

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters if hwmon is really the right place for this. I may be wrong, but it seems to me it would better fit into thermal.

Thanks,
Guenter

I am fine using thermal zones, but the coretemp will be duplicated in both coretemp and thermal sysfs and lot of code duplication. Also trip point in this case is not for activating any cooling device, but just to notify user space. So this will be a zone with no associated cdevs.

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 124 lines

-----Original Message-----
From: [email protected] [mailto:lm-sensors- [email protected]] On Behalf Of Srinivas Pandruvada
Sent: Monday, April 15, 2013 8:51 PM
To: Guenter Roeck
Cc: Yu, Fenghua; Luck, Tony; [email protected]; lm-sensors@lm- sensors.org; [email protected]; Zhang, Rui
Subject: Re: [lm-sensors] [PATCH 0/4] thermal threshold and notification v2.0

Quoted 3 lines · Guenter Roeck
Quoted 2 lines · Srinivas Pandruvada

v2.0
As suggested by Guenter Roeck, used the previous development in this

area

Quoted 2 lines
Quoted 2 lines

as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the

following

Quoted 11 lines
Quoted 11 lines

additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

Quoted 1 line
Quoted 1 line

The notification mechanism is implemented for package level by using

uevent.

Quoted 1 line
Quoted 1 line

Also a debugfs interface is added to check count of interrupts and worker

fn

Quoted 6 lines
Quoted 6 lines

scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp

sysfs,

Quoted 4 lines
Quoted 4 lines

during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the

market.

Quoted 1 line
Quoted 1 line

Unfortunately these devices reach maximum temperature with relatively

less

Quoted 1 line
Quoted 1 line

workloads, causing BIOS to do thermal throttling. There are real

performance

Quoted 1 line
Quoted 1 line

issues due to aggressive BIOS action to control thermals and also thermal

breakdown

Quoted 3 lines
Quoted 3 lines

in some cases.

Even the most expensive laptops, don't have correct ACPI thermal

configuration,

Quoted 1 line
Quoted 1 line

so that kernel thermal driver can act. In some case even the trip point is

higher

Quoted 3 lines
Quoted 3 lines

than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system

very efficiently.

Quoted 1 line
Quoted 1 line

They include RAPL based cooling driver, Powerclamp driver and P state

driver.

Quoted 1 line
Quoted 1 line

To utilize these cooling device a closed loop user mode program is

required, which

Quoted 1 line
Quoted 1 line

will utilize these method and dynamically compensate for high CPU

temperatures,

Quoted 2 lines
Quoted 2 lines

without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details

can be

Quoted 2 lines
Quoted 2 lines

obtained from

"https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon _Introduction.pdf".

Quoted 1 line
Quoted 1 line

This daemon polls for cpu temperature and apply compensation once the

CPU reach target

Quoted 3 lines
Quoted 3 lines

temperature.

This polling can be mostly avoided, by getting notification for the

temperature, where

Quoted 1 line
Quoted 1 line

it needs to wake up and get ready for apply compensation. In most of the

normal use

Quoted 1 line
Quoted 1 line

cases, there may not be any threshold events. So very minimal number of

user space

Quoted 3 lines
Quoted 3 lines

notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize

events. Also

Quoted 1 line
Quoted 1 line

interrupts are enabled only when a non tj_max(default) value is written

to thresholds.

Quoted 2 lines
Quoted 2 lines

Once thresholds are violated, it uses a rate control of 5 seconds, reducing

the number

Quoted 1 line
Quoted 1 line

of interrupts, when temperature is hanging around trip point. Using the

sticky log bit,

Quoted 1 line
Quoted 1 line

it sends kboject uevent change notification for corresponding package

sysfs.

Quoted 1 line
Quoted 1 line

Once the thermal daemon receives notification, it can change to new

threshold or act

Quoted 10 lines
Quoted 10 lines

immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

Quoted 4 lines
Quoted 4 lines
  Documentation/hwmon/coretemp             |   8 +
  arch/x86/include/asm/mce.h               |   7 +
  arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
  drivers/hwmon/coretemp.c                 | 292

+++++++++++++++++++++++++++++--

Quoted 7 lines
Quoted 2 lines
  4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters if

hwmon

Quoted 3 lines

is really the right place for this. I may be wrong, but it seems to me it would better fit into thermal.

Quoted 7 lines
Quoted 2 lines

Thanks,
Guenter

I am fine using thermal zones, but the coretemp will be duplicated in both coretemp and thermal sysfs and lot of code duplication. Also trip point in this case is not for activating any cooling device, but just to notify user space. So this will be a zone with no associated cdevs.

Yes, this was the idea which we discussed in lm-sensors a few months ago. [I could not locate the thread in the web]. Except that we will register as 'thermal sensor' and not as 'thermal zones' because of the changes happening to the thermal framework recently[1].

This way, we can expose trip points and configure them, without having a need to associate any cdevs.

[1] https://lkml.org/lkml/2013/2/5/228

Thanks,
Durga

Quoted 8 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 4 lines

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
Quoted 132 lines · Durgadoss
Quoted 124 lines

-----Original Message-----
From: [email protected] [mailto:lm-sensors- [email protected]] On Behalf Of Srinivas Pandruvada
Sent: Monday, April 15, 2013 8:51 PM
To: Guenter Roeck
Cc: Yu, Fenghua; Luck, Tony; [email protected]; lm-sensors@lm- sensors.org; [email protected]; Zhang, Rui
Subject: Re: [lm-sensors] [PATCH 0/4] thermal threshold and notification v2.0

Quoted 3 lines · Guenter Roeck
Quoted 2 lines · Srinivas Pandruvada

v2.0
As suggested by Guenter Roeck, used the previous development in this

area

Quoted 2 lines
Quoted 2 lines

as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the

following

Quoted 11 lines
Quoted 11 lines

additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

Quoted 1 line
Quoted 1 line

The notification mechanism is implemented for package level by using

uevent.

Quoted 1 line
Quoted 1 line

Also a debugfs interface is added to check count of interrupts and worker

fn

Quoted 6 lines
Quoted 6 lines

scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp

sysfs,

Quoted 4 lines
Quoted 4 lines

during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the

market.

Quoted 1 line
Quoted 1 line

Unfortunately these devices reach maximum temperature with relatively

less

Quoted 1 line
Quoted 1 line

workloads, causing BIOS to do thermal throttling. There are real

performance

Quoted 1 line
Quoted 1 line

issues due to aggressive BIOS action to control thermals and also thermal

breakdown

Quoted 3 lines
Quoted 3 lines

in some cases.

Even the most expensive laptops, don't have correct ACPI thermal

configuration,

Quoted 1 line
Quoted 1 line

so that kernel thermal driver can act. In some case even the trip point is

higher

Quoted 3 lines
Quoted 3 lines

than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system

very efficiently.

Quoted 1 line
Quoted 1 line

They include RAPL based cooling driver, Powerclamp driver and P state

driver.

Quoted 1 line
Quoted 1 line

To utilize these cooling device a closed loop user mode program is

required, which

Quoted 1 line
Quoted 1 line

will utilize these method and dynamically compensate for high CPU

temperatures,

Quoted 2 lines
Quoted 2 lines

without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details

can be

Quoted 2 lines
Quoted 2 lines

obtained from

"https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon _Introduction.pdf".

Quoted 1 line
Quoted 1 line

This daemon polls for cpu temperature and apply compensation once the

CPU reach target

Quoted 3 lines
Quoted 3 lines

temperature.

This polling can be mostly avoided, by getting notification for the

temperature, where

Quoted 1 line
Quoted 1 line

it needs to wake up and get ready for apply compensation. In most of the

normal use

Quoted 1 line
Quoted 1 line

cases, there may not be any threshold events. So very minimal number of

user space

Quoted 3 lines
Quoted 3 lines

notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize

events. Also

Quoted 1 line
Quoted 1 line

interrupts are enabled only when a non tj_max(default) value is written

to thresholds.

Quoted 2 lines
Quoted 2 lines

Once thresholds are violated, it uses a rate control of 5 seconds, reducing

the number

Quoted 1 line
Quoted 1 line

of interrupts, when temperature is hanging around trip point. Using the

sticky log bit,

Quoted 1 line
Quoted 1 line

it sends kboject uevent change notification for corresponding package

sysfs.

Quoted 1 line
Quoted 1 line

Once the thermal daemon receives notification, it can change to new

threshold or act

Quoted 10 lines
Quoted 10 lines

immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

Quoted 4 lines
Quoted 4 lines
  Documentation/hwmon/coretemp             |   8 +
  arch/x86/include/asm/mce.h               |   7 +
  arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
  drivers/hwmon/coretemp.c                 | 292

+++++++++++++++++++++++++++++--

Quoted 7 lines
Quoted 2 lines
  4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters if

hwmon

Quoted 3 lines

is really the right place for this. I may be wrong, but it seems to me it would better fit into thermal.

Quoted 7 lines
Quoted 2 lines

Thanks,
Guenter

I am fine using thermal zones, but the coretemp will be duplicated in both coretemp and thermal sysfs and lot of code duplication. Also trip point in this case is not for activating any cooling device, but just to notify user space. So this will be a zone with no associated cdevs.

Quoted 8 lines

Yes, this was the idea which we discussed in lm-sensors a few months ago. [I could not locate the thread in the web]. Except that we will register as 'thermal sensor' and not as 'thermal zones' because of the changes happening to the thermal framework recently[1].

This way, we can expose trip points and configure them, without having a need to associate any cdevs.

Agreed.
But note that this is also true in current code as well.

thanks,
rui

Quoted 16 lines

[1] https://lkml.org/lkml/2013/2/5/228

Thanks,
Durga

Quoted 12 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#5 lore raw
Quoted 163 lines

-----Original Message-----
From: Zhang, Rui
Sent: Tuesday, April 16, 2013 10:28 AM
To: R, Durgadoss
Cc: Srinivas Pandruvada; Guenter Roeck; Yu, Fenghua; Luck, Tony; linux- [email protected]; [email protected]; [email protected]
Subject: RE: [lm-sensors] [PATCH 0/4] thermal threshold and notification v2.0

Quoted 8 lines · Durgadoss
Quoted 8 lines

-----Original Message-----
From: [email protected] [mailto:lm-sensors- [email protected]] On Behalf Of Srinivas Pandruvada
Sent: Monday, April 15, 2013 8:51 PM
To: Guenter Roeck
Cc: Yu, Fenghua; Luck, Tony; [email protected]; lm-sensors@lm- sensors.org; [email protected]; Zhang, Rui
Subject: Re: [lm-sensors] [PATCH 0/4] thermal threshold and notification

v2.0

Quoted 5 lines
Quoted 5 lines · Guenter Roeck
Quoted 3 lines · Srinivas Pandruvada
Quoted 2 lines

v2.0
As suggested by Guenter Roeck, used the previous development in

this

Quoted 2 lines
Quoted 2 lines

area

Quoted 1 line
Quoted 1 line

as starting point. The first patch is same as what Guenter Roeck

submitted

Quoted 13 lines
Quoted 13 lines
Quoted 1 line
Quoted 1 line

before except for checkpatch error for strtoul.As per this patch, the

following

Quoted 11 lines
Quoted 11 lines

additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

The notification mechanism is implemented for package level by using

uevent.

Quoted 1 line
Quoted 1 line

Also a debugfs interface is added to check count of interrupts and

worker

Quoted 4 lines
Quoted 4 lines

fn

Quoted 3 lines
Quoted 3 lines

scheduling.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

v1.0

This is clear that there is reluctance in adding thresholds in coretemp

sysfs,

Quoted 4 lines
Quoted 4 lines

during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in

the

Quoted 2 lines
Quoted 2 lines

market.

Quoted 1 line
Quoted 1 line

Unfortunately these devices reach maximum temperature with

relatively

Quoted 4 lines
Quoted 4 lines

less

Quoted 1 line
Quoted 1 line

workloads, causing BIOS to do thermal throttling. There are real

performance

Quoted 1 line
Quoted 1 line

issues due to aggressive BIOS action to control thermals and also

thermal

Quoted 6 lines
Quoted 6 lines

breakdown

Quoted 3 lines
Quoted 3 lines

in some cases.

Even the most expensive laptops, don't have correct ACPI thermal

configuration,

Quoted 1 line
Quoted 1 line

so that kernel thermal driver can act. In some case even the trip point

is

Quoted 4 lines
Quoted 4 lines

higher

Quoted 3 lines
Quoted 3 lines

than critical temperature setting.

Intel has developed several drivers, which can be used to cool the

system

Quoted 9 lines
Quoted 9 lines

very efficiently.

Quoted 1 line
Quoted 1 line

They include RAPL based cooling driver, Powerclamp driver and P state

driver.

Quoted 1 line
Quoted 1 line

To utilize these cooling device a closed loop user mode program is

required, which

Quoted 1 line
Quoted 1 line

will utilize these method and dynamically compensate for high CPU

temperatures,

Quoted 2 lines
Quoted 2 lines

without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More

details

Quoted 4 lines
Quoted 4 lines

can be

Quoted 2 lines
Quoted 2 lines

obtained from

"https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon

Quoted 2 lines
Quoted 2 lines

_Introduction.pdf".

Quoted 1 line
Quoted 1 line

This daemon polls for cpu temperature and apply compensation once

the

Quoted 6 lines
Quoted 6 lines

CPU reach target

Quoted 3 lines
Quoted 3 lines

temperature.

This polling can be mostly avoided, by getting notification for the

temperature, where

Quoted 1 line
Quoted 1 line

it needs to wake up and get ready for apply compensation. In most of

the

Quoted 2 lines
Quoted 2 lines

normal use

Quoted 1 line
Quoted 1 line

cases, there may not be any threshold events. So very minimal

number of

Quoted 6 lines
Quoted 6 lines

user space

Quoted 3 lines
Quoted 3 lines

notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize

events. Also

Quoted 1 line
Quoted 1 line

interrupts are enabled only when a non tj_max(default) value is

written

Quoted 3 lines
Quoted 3 lines

to thresholds.

Quoted 2 lines
Quoted 2 lines

Once thresholds are violated, it uses a rate control of 5 seconds,

reducing

Quoted 2 lines
Quoted 2 lines

the number

Quoted 1 line
Quoted 1 line

of interrupts, when temperature is hanging around trip point. Using

the

Quoted 19 lines
Quoted 19 lines

sticky log bit,

Quoted 1 line
Quoted 1 line

it sends kboject uevent change notification for corresponding package

sysfs.

Quoted 1 line
Quoted 1 line

Once the thermal daemon receives notification, it can change to new

threshold or act

Quoted 14 lines
Quoted 14 lines

immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

  Documentation/hwmon/coretemp             |   8 +
  arch/x86/include/asm/mce.h               |   7 +
  arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
  drivers/hwmon/coretemp.c                 | 292
Quoted 8 lines
Quoted 8 lines

+++++++++++++++++++++++++++++--

Quoted 7 lines
Quoted 2 lines
  4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters

if

Quoted 2 lines
Quoted 2 lines

hwmon

Quoted 1 line

is really the right place for this. I may be wrong, but it seems to me it

would

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

better fit into thermal.

Thanks,
Guenter

Quoted 8 lines
Quoted 4 lines

I am fine using thermal zones, but the coretemp will be duplicated in both coretemp and thermal sysfs and lot of code duplication. Also trip point in this case is not for activating any cooling device, but just to notify user space. So this will be a zone with no associated cdevs.

Yes, this was the idea which we discussed in lm-sensors a few months ago. [I could not locate the thread in the web]. Except that we will register as 'thermal sensor' and not as 'thermal zones' because of the changes

Quoted 8 lines

happening

Quoted 5 lines

to the thermal framework recently[1].

This way, we can expose trip points and configure them, without having a need to associate any cdevs.

Agreed.
But note that this is also true in current code as well.

Yes, I agree.

Thanks,
Durga

Quoted 20 lines

thanks,
rui

Quoted 16 lines

[1] https://lkml.org/lkml/2013/2/5/228

Thanks,
Durga

Quoted 12 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#6 lore raw
In reply to Srinivas Pandruvada
Quoted 85 lines · Srinivas Pandruvada
Quoted 84 lines · Guenter Roeck
Quoted 69 lines · Srinivas Pandruvada

v2.0
As suggested by Guenter Roeck, used the previous development in this area as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the following additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

The notification mechanism is implemented for package level by using uevent. Also a debugfs interface is added to check count of interrupts and worker fn scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp sysfs, during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the market. Unfortunately these devices reach maximum temperature with relatively less workloads, causing BIOS to do thermal throttling. There are real performance issues due to aggressive BIOS action to control thermals and also thermal breakdown in some cases.

Even the most expensive laptops, don't have correct ACPI thermal configuration, so that kernel thermal driver can act. In some case even the trip point is higher than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system very efficiently. They include RAPL based cooling driver, Powerclamp driver and P state driver. To utilize these cooling device a closed loop user mode program is required, which will utilize these method and dynamically compensate for high CPU temperatures, without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details can be obtained from "https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon_Introduction.pdf". This daemon polls for cpu temperature and apply compensation once the CPU reach target temperature.

This polling can be mostly avoided, by getting notification for the temperature, where it needs to wake up and get ready for apply compensation. In most of the normal use cases, there may not be any threshold events. So very minimal number of user space notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize events. Also interrupts are enabled only when a non tj_max(default) value is written to thresholds.

Once thresholds are violated, it uses a rate control of 5 seconds, reducing the number of interrupts, when temperature is hanging around trip point. Using the sticky log bit, it sends kboject uevent change notification for corresponding package sysfs. Once the thermal daemon receives notification, it can change to new threshold or act immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

Quoted 6 lines
  Documentation/hwmon/coretemp             |   8 +
  arch/x86/include/asm/mce.h               |   7 +
  arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
  drivers/hwmon/coretemp.c                 | 292 +++++++++++++++++++++++++++++--
  4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters if hwmon is really the right place for this. I may be wrong, but it seems to me it would better fit into thermal.

Quoted 5 lines
Quoted 2 lines

Thanks,
Guenter

I am fine using thermal zones, but the coretemp will be duplicated in both coretemp and thermal sysfs and lot of code duplication.

is it possible to introduce code in coretemp driver to register with thermal subsystem?

Quoted 4 lines

Also trip
point in this case is not for activating any cooling device, but just to notify user space. So this will be a zone with no associated cdevs.

trip points for thermal zones does not have to bind with cdevs. if you bind the p-state driver, rapl, intel_powerclamp and t-state driver to this thermal zone, all the thermal management work can be done in kernel.
But if you do not bind any cooling devices to trip points, you can use "userspace" thermal governor, and provide your own thermal_zone_device_ops->notify() callback.
In this case, .notify() will be called instead, and you can do whatever you want in that callback.

thanks,
rui

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#7 lore raw
Quoted 86 lines · Zhang Rui
Quoted 85 lines · Srinivas Pandruvada
Quoted 84 lines · Guenter Roeck
Quoted 69 lines · Srinivas Pandruvada

v2.0
As suggested by Guenter Roeck, used the previous development in this area as starting point. The first patch is same as what Guenter Roeck submitted before except for checkpatch error for strtoul.As per this patch, the following additional coretemp sysfs entries will be added:
tempX_threshold1 - Reflects value of CPU thermal threshold T0. tempX_threshold1_triggered
- Reflects status of CPU thermal status register bit 6 (THERM_STATUS_THRESHOLD0).
tempX_threshold2 - Reflects value of CPU thermal threshold T1. tempX_threshold2_triggered
- Reflects status of CPU thermal status register bit 8 (THERM_STATUS_THRESHOLD1).

The notification mechanism is implemented for package level by using uevent. Also a debugfs interface is added to check count of interrupts and worker fn scheduling.

v1.0

This is clear that there is reluctance in adding thresholds in coretemp sysfs, during previous attempts. Proably because of lake of use cases. But this time use case may be more compelling.

We have many small form factor devices like ultrabooks, slate PCs in the market. Unfortunately these devices reach maximum temperature with relatively less workloads, causing BIOS to do thermal throttling. There are real performance issues due to aggressive BIOS action to control thermals and also thermal breakdown in some cases.

Even the most expensive laptops, don't have correct ACPI thermal configuration, so that kernel thermal driver can act. In some case even the trip point is higher than critical temperature setting.

Intel has developed several drivers, which can be used to cool the system very efficiently. They include RAPL based cooling driver, Powerclamp driver and P state driver. To utilize these cooling device a closed loop user mode program is required, which will utilize these method and dynamically compensate for high CPU temperatures, without relying on any configuration data.
One such solution is developed is "Linux thermal daemon". More details can be obtained from "https://github.com/01org/thermal_daemon/blob/master/ThermalDaemon_Introduction.pdf". This daemon polls for cpu temperature and apply compensation once the CPU reach target temperature.

This polling can be mostly avoided, by getting notification for the temperature, where it needs to wake up and get ready for apply compensation. In most of the normal use cases, there may not be any threshold events. So very minimal number of user space notification for thermal thresholds.

Notification are added only for package level thresholds, to minimize events. Also interrupts are enabled only when a non tj_max(default) value is written to thresholds.

Once thresholds are violated, it uses a rate control of 5 seconds, reducing the number of interrupts, when temperature is hanging around trip point. Using the sticky log bit, it sends kboject uevent change notification for corresponding package sysfs. Once the thermal daemon receives notification, it can change to new threshold or act immediately to reduce CPU temperature.*

Guenter Roeck (1):
hwmon: (coretemp) Add support for thermal threshold attributes

Srinivas Pandruvada (3):
x86, mcheck, therm_throt: Process package thresholds
hwmon: (coretemp) : Add notification support
hwmon: (coretemp) : Add debugfs to support thresholds

Quoted 6 lines
  Documentation/hwmon/coretemp             |   8 +
  arch/x86/include/asm/mce.h               |   7 +
  arch/x86/kernel/cpu/mcheck/therm_throt.c |  63 ++++++-
  drivers/hwmon/coretemp.c                 | 292 +++++++++++++++++++++++++++++--
  4 files changed, 356 insertions(+), 14 deletions(-)

Rui,

can you have a look at this series ?

I would like to get some feedback from thermal subsystem supporters if hwmon is really the right place for this. I may be wrong, but it seems to me it would better fit into thermal.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Thanks,
Guenter

I am fine using thermal zones, but the coretemp will be duplicated in both coretemp and thermal sysfs and lot of code duplication.

is it possible to introduce code in coretemp driver to register with thermal subsystem?

Should be possible. As mentioned in my other mail, I think we should find some automated way to do that (ie in the infrastructure), but that is something we can deal with later on.

Guenter

Quoted 18 lines
Quoted 4 lines

Also trip
point in this case is not for activating any cooling device, but just to notify user space. So this will be a zone with no associated cdevs.

trip points for thermal zones does not have to bind with cdevs. if you bind the p-state driver, rapl, intel_powerclamp and t-state driver to this thermal zone, all the thermal management work can be done in kernel.
But if you do not bind any cooling devices to trip points, you can use "userspace" thermal governor, and provide your own thermal_zone_device_ops->notify() callback.
In this case, .notify() will be called instead, and you can do whatever you want in that callback.

thanks,
rui