Skip to contentSkip to conversation

hwmon: (ibmpowernv) Fix label for cores numbers not threads

PATCH Applied Michael Neuling 3 participants 4 messages Sep 13, 2016 – Sep 14, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (ibmpowernv) Fix label for cores numbers not threads

Currently the label says "Core" but lists the thread numbers. This ends up looking like this:

    # cat /sys/class/hwmon/hwmon0/temp[1-4]_label
    Core 0-7
    Core 8-15
    Core 16-23
    Core 24-31

This is misleading as it looks like it's cores 0-7 when it's actually threads 0-7.

This changes the print to just give the core number, so the output now looks like this:

    # cat /sys/class/hwmon/hwmon0/temp[1-4]_label
    Core 0
    Core 8
    Core 16
    Core 24
---
 drivers/hwmon/ibmpowernv.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hwmon/ibmpowernv.c +3 -5
index 55b5a8ff1c..6d2e660575 100644
@@ -143,13 +143,11 @@ static void __init make_sensor_label(struct device_node *np,
 		if (cpuid >= 0)
 			/*
 			 * The digital thermal sensors are associated
-			 * with a core. Let's print out the range of
-			 * cpu ids corresponding to the hardware
-			 * threads of the core.
+			 * with a core.
 			 */
 			n += snprintf(sdata->label + n,
-				      sizeof(sdata->label) - n, " %d-%d",
-				      cpuid, cpuid + threads_per_core - 1);
+				      sizeof(sdata->label) - n, " %d",
+				      cpuid);
 		else
 			n += snprintf(sdata->label + n,
 				      sizeof(sdata->label) - n, " phy%d", id);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Michael Neuling

Currently the label says "Core" but lists the thread numbers. This ends up looking like this:

    # cat /sys/class/hwmon/hwmon0/temp[1-4]_label
    Core 0-7
    Core 8-15
    Core 16-23
    Core 24-31

This is misleading as it looks like it's cores 0-7 when it's actually threads 0-7.

This changes the print to just give the core number, so the output now looks like this:

Quoted 7 lines
    # cat /sys/class/hwmon/hwmon0/temp[1-4]_label
    Core 0
    Core 8
    Core 16
    Core 24

Yes. This looks better. The DTS are related to the core so we don't really care about the threads.

Side question, should we use the Physical ID and not the Linux logical one ? I don't know if it is exposed elsewhere in user space.

Thanks,

C.

Quoted 26 lines
---
 drivers/hwmon/ibmpowernv.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hwmon/ibmpowernv.c +3 -5
index 55b5a8ff1c..6d2e660575 100644
@@ -143,13 +143,11 @@ static void __init make_sensor_label(struct device_node *np,
 		if (cpuid >= 0)
 			/*
 			 * The digital thermal sensors are associated
-			 * with a core. Let's print out the range of
-			 * cpu ids corresponding to the hardware
-			 * threads of the core.
+			 * with a core.
 			 */
 			n += snprintf(sdata->label + n,
-				      sizeof(sdata->label) - n, " %d-%d",
-				      cpuid, cpuid + threads_per_core - 1);
+				      sizeof(sdata->label) - n, " %d",
+				      cpuid);
 		else
 			n += snprintf(sdata->label + n,
 				      sizeof(sdata->label) - n, " phy%d", id);
maintainer Applied
#2 lore raw
Quoted 20 lines · Cédric Le Goater
Quoted 19 lines · Michael Neuling

Currently the label says "Core" but lists the thread numbers. This ends up looking like this:

    # cat /sys/class/hwmon/hwmon0/temp[1-4]_label
    Core 0-7
    Core 8-15
    Core 16-23
    Core 24-31

This is misleading as it looks like it's cores 0-7 when it's actually threads 0-7.

This changes the print to just give the core number, so the output now looks like this:

    # cat /sys/class/hwmon/hwmon0/temp[1-4]_label
    Core 0
    Core 8
    Core 16
    Core 24
Quoted 8 lines
Quoted 1 line

Yes. This looks better. The DTS are related to the core so we don't really care about the threads.

Applied to -next.

Guenter

Quoted 41 lines

Side question, should we use the Physical ID and not the Linux logical one ? I don't know if it is exposed elsewhere in user space.

Thanks,

C.

Quoted 16 lines
---
 drivers/hwmon/ibmpowernv.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hwmon/ibmpowernv.c +0 -3
index 55b5a8ff1c..6d2e660575 100644
@@ -143,13 +143,11 @@ static void __init make_sensor_label(struct device_node *np,
 		if (cpuid >= 0)
 			/*
 			 * The digital thermal sensors are associated
-			 * with a core. Let's print out the range of
-			 * cpu ids corresponding to the hardware
-			 * threads of the core.

drivers/hwmon/ibmpowernv.c static void __init make_sensor_label(struct device_node *np, · line 153

Quoted 10 lines
drivers/hwmon/ibmpowernv.c +3 -2
+			 * with a core.
 			 */
 			n += snprintf(sdata->label + n,
-				      sizeof(sdata->label) - n, " %d-%d",
-				      cpuid, cpuid + threads_per_core - 1);
+				      sizeof(sdata->label) - n, " %d",
+				      cpuid);
 		else
 			n += snprintf(sdata->label + n,
 				      sizeof(sdata->label) - n, " phy%d", id);

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

#3 lore raw
In reply to Cédric Le Goater
Quoted 6 lines
Quoted 2 lines

Yes. This looks better. The DTS are related to the core so we don't really care about the threads.

Thanks

Quoted 3 lines

Side question, should we use the Physical ID and not the Linux logical one ? I don't know if it is exposed elsewhere in user space.

Yeah Linux logical is what the user sees for sysfs interfaces, /proc/cpuinfo, taskset etc so that makes more sense than physical.

Mikey