Commit f4e0bcf06b9771af04273473592aeeb860ca2816
Committed by
Linus Torvalds
1 parent
5f2e8e2b0b
Exists in
master
and in
39 other branches
hwmon: (coretemp) Add comments describing the handling of HT CPUs
The coretemp driver provides a single set of device attributes for each physical core of a HT CPU to avoid duplicate sensors. This functionality was introduced with commit d883b9f09772 ("hwmon: (coretemp) Skip duplicate CPU entries"). Commit e40cc4bdfd4b ("x86/hwmon: register alternate sibling upon CPU removal") extends this functionality to register the HT sibling of a CPU which is taken offline, to ensure that sensor attributes are provided if at least one HT sibling of a core is online. Add comments into the code describing the functionality in some more detail. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 18 additions and 2 deletions Side-by-side Diff
drivers/hwmon/coretemp.c
... | ... | @@ -506,7 +506,13 @@ |
506 | 506 | if (attr_no > MAX_CORE_DATA - 1) |
507 | 507 | return -ERANGE; |
508 | 508 | |
509 | - /* Skip if it is a HT core, Not an error */ | |
509 | + /* | |
510 | + * Provide a single set of attributes for all HT siblings of a core | |
511 | + * to avoid duplicate sensors (the processor ID and core ID of all | |
512 | + * HT siblings of a core is the same). | |
513 | + * Skip if a HT sibling of this core is already online. | |
514 | + * This is not an error. | |
515 | + */ | |
510 | 516 | if (pdata->core_data[attr_no] != NULL) |
511 | 517 | return 0; |
512 | 518 | |
513 | 519 | |
... | ... | @@ -763,10 +769,20 @@ |
763 | 769 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) |
764 | 770 | coretemp_remove_core(pdata, &pdev->dev, indx); |
765 | 771 | |
766 | - /* Online the HT version of this core, if any */ | |
772 | + /* | |
773 | + * If a core is taken offline, but a HT sibling of the same core is | |
774 | + * still online, register the alternate sibling. This ensures that | |
775 | + * exactly one set of attributes is provided as long as at least one | |
776 | + * HT sibling of a core is online. | |
777 | + */ | |
767 | 778 | for_each_sibling(i, cpu) { |
768 | 779 | if (i != cpu) { |
769 | 780 | get_core_online(i); |
781 | + /* | |
782 | + * Display temperature sensor data for one HT sibling | |
783 | + * per core only, so abort the loop after one such | |
784 | + * sibling has been found. | |
785 | + */ | |
770 | 786 | break; |
771 | 787 | } |
772 | 788 | } |