hwmon: (k8temp) Bypass core swapping on
Subsystems (2)
PATCH 1/1 hwmon: (k8temp) Bypass core swapping on
Commit a2e066bba2aad6583e3ff648bf28339d6c9f0898 introduced core swapping for CPU models 64 and later. I recently had a report about a Sempron 3200+, model 95, for which this patch broke temperature reading. It happens that this is a single-core processor, so the effect of the swapping was to read the temperature value for a core that didn't exist, leading to an incorrect value (-49 degrees C.)
Disabling core swapping on singe-core processors should fix this.
---
Andreas, please comment on this. Is my fix correct for all single-core processors? I have to admit I am surprised that nobody reported this bug in well over a year if it affects all AM2 and AM3 socket Sempron processors.
drivers/hwmon/k8temp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/k8temp.c +1 -1
@@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *int temp;struct k8temp_data *data =k8temp_update_device (dev); -if (data->swap_core_select) +if (data->swap_core_select && (data->sensorsp &SEL_CORE )) core = core ?0 :1 ; temp =TEMP_FROM_REG (data->temp[core][place]) + data->temp_offset;
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 13 lines · Jean Delvare
Commit
a2e066bba2aad6583e3ff648bf28339d6c9f0898introduced core swapping for CPU models 64 and later. I recently had a report about a Sempron 3200+, model 95, for which this patch broke temperature reading. It happens that this is a single-core processor, so the effect of the swapping was to read the temperature value for a core that didn't exist, leading to an incorrect value (-49 degrees C.)Disabling core swapping on singe-core processors should fix this.
Signed-off-by Jean Delvare <[email protected]>Tested-by Rick Moritz <[email protected]>Cc Andreas Herrmann <[email protected]>
Quoted 5 lines
---
Andreas, please comment on this. Is my fix correct for all single-core processors? I have to admit I am surprised that nobody reported this bug in well over a year if it affects all AM2 and AM3 socket Sempron processors.
The BKDG says
Thermal Sensor Core Select (ThermSenseCoreSel)—Bit 2. This bit selects the CPU whose
temperature is reported in the CurTemp field. This bit only applies to dual core processors. For single core processors CPU0 Thermal Sensor is always selected. ...
k8temp_probe() correctly detected that SEL_CORE can't be used on single core CPU. Thus k8temp did never update the temperature values stored in temp[1][x] and -49 degrees was reported. For single core CPUs we must use the values read into temp[0][x].
Your patch fixes this.
Thanks,
Andreas
Quoted 19 lines
drivers/hwmon/k8temp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwmon/k8temp.c +1
-1@@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *int temp;struct k8temp_data *data =k8temp_update_device (dev); -if (data->swap_core_select) +if (data->swap_core_select && (data->sensorsp &SEL_CORE )) core = core ?0 :1 ; temp =TEMP_FROM_REG (data->temp[core][place]) + data->temp_offset;Signature · 2 lines
-- Jean Delvare
Signature · 12 lines
Operating | Advanced Micro Devices GmbH System | Einsteinring 24, 85609 Dornach b. München, Germany Research | Geschäftsführer: Alberto Bozzo, Andrew Bowd Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München (OSRC) | Registergericht München, HRB Nr. 43632 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Andreas,
Quoted 28 lines · Andreas Herrmann
Quoted 13 lines · Jean Delvare
Commit
a2e066bba2aad6583e3ff648bf28339d6c9f0898introduced core swapping for CPU models 64 and later. I recently had a report about a Sempron 3200+, model 95, for which this patch broke temperature reading. It happens that this is a single-core processor, so the effect of the swapping was to read the temperature value for a core that didn't exist, leading to an incorrect value (-49 degrees C.)Disabling core swapping on singe-core processors should fix this.
Signed-off-by Jean Delvare <[email protected]>Tested-by Rick Moritz <[email protected]>Cc Andreas Herrmann <[email protected]>Quoted 5 lines
---
Andreas, please comment on this. Is my fix correct for all single-core processors? I have to admit I am surprised that nobody reported this bug in well over a year if it affects all AM2 and AM3 socket Sempron processors.Acked-by Andreas Herrmann <[email protected]>The BKDG says
Thermal Sensor Core Select (ThermSenseCoreSel)—Bit 2. This bit selects the CPU whose
temperature is reported in the CurTemp field. This bit only applies to dual core processors. For single core processors CPU0 Thermal Sensor is always selected. ...
Quoted 6 lines
k8temp_probe()correctly detected thatSEL_COREcan't be used on single core CPU. Thus k8temp did never update the temperature values stored in temp[1][x] and -49 degrees was reported. For single core CPUs we must use the values read into temp[0][x].Your patch fixes this.
Thanks. My patch is in linux-next now, and I'll push it to Linus (and then stable branches) by newt week.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors