Skip to contentSkip to conversation

Hwmon: Add core_pkg Threshold Support to

PATCH Superseded Durgadoss R 3 participants 4 messages Jun 11, 2011 – Jul 5, 2011

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Hwmon: Add core_pkg Threshold Support to

This patch adds the core and pkg support to coretemp.
These thresholds can be configured via the sysfs interfaces tempX_max and tempX_max_hyst. An interrupt is generated when CPU temperature reaches or crosses above tempX_max OR drops below tempX_max_hyst.

This patch is based on the documentation in IA Manual vol 3A, that can be downloaded from here:
http://download.intel.com/design/processor/manuals/253668.pdf

---
v1
* Initial code to add core/pkg threshold support
v2
* Rearranged the attrs in rd/wr arrays in create_core_attrs function
* Added code to conditionally create the ttarget/tmin/max_alarm interfaces
* Changed the MAX_ATTRS definition
* Added attr_size variable to temp_data structure

 Documentation/hwmon/coretemp |    7 ++
 drivers/hwmon/coretemp.c     |  170 +++++++++++++++++++++++++++++++-----------
 2 files changed, 132 insertions(+), 45 deletions(-)
Documentation/hwmon/coretemp +7 -0
index f85e913..fa8776a 100644
@@ -35,6 +35,13 @@ the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
 All Sysfs entries are named with their core_id (represented here by 'X').
 tempX_input	 - Core temperature (in millidegrees Celsius).
 tempX_max	 - All cooling devices should be turned on (on Core2).
+		   Initialized with IA32_THERM_INTERRUPT. When the CPU
+		   temperature reaches this temperature, an interrupt is
+		   generated and tempX_max_alarm is set.
+tempX_max_hyst   - If the CPU temperature falls below than temperature,
+		   an interrupt is generated and tempX_max_alarm is reset.
+tempX_max_alarm  - Set if the temperature reaches or exceeds tempX_max.
+		   Reset if the temperature drops to or below tempX_max_hyst.
 tempX_crit	 - Maximum junction temperature (in millidegrees Celsius).
 tempX_crit_alarm - Set when Out-of-spec bit is set, never clears.
 		   Correct CPU operation is no longer guaranteed.
drivers/hwmon/coretemp.c +125 -45

249 lines not on this page · raw message

Signature · 7 lines
1.6.1


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

Re: [lm-sensors] [PATCHv2 1/1] Hwmon: Add core_pkg Threshold

Hi Durga,

Quoted 10 lines · Durgadoss R

This patch adds the core and pkg support to coretemp.
These thresholds can be configured via the sysfs interfaces tempX_max and tempX_max_hyst. An interrupt is generated when CPU temperature reaches or crosses above tempX_max OR drops below tempX_max_hyst.

This patch is based on the documentation in IA Manual vol 3A, that can be downloaded from here:
http://download.intel.com/design/processor/manuals/253668.pdf

[ ... ]

drivers/hwmon/coretemp.c static int create_core_attrs(struct temp_data *tdata, struct device *dev, · line 466

Quoted 7 lines
drivers/hwmon/coretemp.c +4 -2
+			size_t count) = { NULL, NULL, NULL, NULL, NULL,
+					store_ttarget, store_tmin };
+	static const char *names[TOTAL_ATTRS] = {
 					"temp%d_label", "temp%d_crit_alarm",
-					"temp%d_max", "temp%d_input",
-					"temp%d_crit" };
+					"temp%d_imput", "temp%d_crit",

s/imput/input/

Seems like we need another round of detailed testing ...

Quoted 5 lines
drivers/hwmon/coretemp.c +3 -1
+					"temp%d_max_alarm", "temp%d_max",
+					"temp%d_max_hyst" };
 
-	for (i = 0; i < MAX_ATTRS; i++) {
+	for (i = 0; i < tdata->attr_size; i++) {

drivers/hwmon/coretemp.c static int create_core_attrs(struct temp_data *tdata, struct device *dev, · line 479

Quoted 10 lines
drivers/hwmon/coretemp.c +3 -1
 		snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i],
 			attr_no);
 		sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr);
 		tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i];
 		tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO;
+		if (rw_ptr[i])
+			tdata->sd_attrs[i].dev_attr.attr.mode |= S_IWUSR;
 		tdata->sd_attrs[i].dev_attr.show = rd_ptr[i];
-		tdata->sd_attrs[i].dev_attr.store = NULL;
+		tdata->sd_attrs[i].dev_attr.store = rw_ptr[i];

Since you check for rw_ptr above anyway, you might as well move this assignment into the if branch above. The NULL assignment is not necessary anyway, since the entire structure is pre-initialized from kzalloc().

Thanks,
Guenter

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

#2 lore raw

Re: [lm-sensors] [PATCHv2 1/1] Hwmon: Add core_pkg Threshold

In reply to Durgadoss R
Quoted 31 lines · Guenter Roeck

Hi Durga,

Quoted 10 lines · Durgadoss R

This patch adds the core and pkg support to coretemp.
These thresholds can be configured via the sysfs interfaces tempX_max and tempX_max_hyst. An interrupt is generated when CPU temperature reaches or crosses above tempX_max OR drops below tempX_max_hyst.

This patch is based on the documentation in IA Manual vol 3A, that can be downloaded from here:
http://download.intel.com/design/processor/manuals/253668.pdf

[ ... ]

drivers/hwmon/coretemp.c static int create_core_attrs(struct temp_data *tdata, struct device *dev, · line 466

Quoted 7 lines
drivers/hwmon/coretemp.c +4 -2
+			size_t count) = { NULL, NULL, NULL, NULL, NULL,
+					store_ttarget, store_tmin };
+	static const char *names[TOTAL_ATTRS] = {
 					"temp%d_label", "temp%d_crit_alarm",
-					"temp%d_max", "temp%d_input",
-					"temp%d_crit" };
+					"temp%d_imput", "temp%d_crit",

s/imput/input/

Seems like we need another round of detailed testing ...

Quoted 3 lines
drivers/hwmon/coretemp.c +2 -0
+					"temp%d_max_alarm", "temp%d_max",
+					"temp%d_max_hyst" };
Quoted 16 lines

drivers/hwmon/coretemp.c static int create_core_attrs(struct temp_data *tdata, struct device *dev, · line 479

Quoted 12 lines
drivers/hwmon/coretemp.c +4 -2
-	for (i = 0; i < MAX_ATTRS; i++) {
+	for (i = 0; i < tdata->attr_size; i++) {
 		snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i],
 			attr_no);
 		sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr);
 		tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i];
 		tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO;
+		if (rw_ptr[i])
+			tdata->sd_attrs[i].dev_attr.attr.mode |= S_IWUSR;
 		tdata->sd_attrs[i].dev_attr.show = rd_ptr[i];
-		tdata->sd_attrs[i].dev_attr.store = NULL;
+		tdata->sd_attrs[i].dev_attr.store = rw_ptr[i];

Since you check for rw_ptr above anyway, you might as well move this assignment into the if branch above. The NULL assignment is not necessary anyway, since the entire structure is pre-initialized from kzalloc().

Durgadoss, any progress on this? I also have coretemp patches pending, I was originally waiting for yours to go in first, to avoid conflicts, but I don't want to wait too long either...

Signature · 6 lines
Jean Delvare

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

Re: [lm-sensors] [PATCHv2 1/1] Hwmon: Add core_pkg Threshold

In reply to Durgadoss R

Hi Jean,

Quoted 5 lines

Durgadoss, any progress on this? I also have coretemp patches pending, I was originally waiting for yours to go in first, to avoid conflicts, but I don't want to wait too long either...

Sorry.. I will submit a v3 of this patch, in an hour..

Thanks,
Durga

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