Skip to content

Commit

Permalink
hwmon: (k8temp) Bypass core swapping on single-core processors
Browse files Browse the repository at this point in the history
Commit a2e066b 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 a 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.

Additional comment from Andreas:

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

Signed-off-by: Jean Delvare <[email protected]>
Tested-by: Rick Moritz <[email protected]>
Acked-by: Andreas Herrmann <[email protected]>
Cc: [email protected]
  • Loading branch information
Jean Delvare committed Jun 20, 2010
1 parent 0e6c787 commit cd4de21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/k8temp.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *dev,
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;
Expand Down

0 comments on commit cd4de21

Please sign in to comment.