]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/power/x86/intel-speed-select: Prevent increasing MAX_DIE_PER_PACKAGE
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 5 Mar 2025 18:53:53 +0000 (10:53 -0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 7 Mar 2025 16:00:21 +0000 (08:00 -0800)
commitd74e6e29d2b29919253f625f0c560f4ca2606900
tree0e62f3644fc23b01d2ae1a67e023fa7c81a99d0c
parent6ad1b2dc0f2a76b23a31fc7a52ed4ec06e4344a3
tools/power/x86/intel-speed-select: Prevent increasing MAX_DIE_PER_PACKAGE

In the function for_each_online_power_domain_in_set() to pick one CPU
from each power domain a three-dimensional array is used, which assumes
that a package contains multiple dies, that means the die_id from
/sys/devices/system/cpu/cpu0/topology/die_id is only local to package.

If it is not unique, still there will be no functional issues in the
current generation of products, but the MAX_DIE_PER_PACKAGE will need to
be increased for future products with many packages.

After kernel version 6.9 die ID is unique system wide not per package.
Even if the CPU topology has no dies, the ID will still increment across
package. In this case the die_id in package 0 will be 0 and die_id in
package 1 will be 1 in a 2-package system.

Since the die count must be same for packages, just count the number of
dies in package 0 and calculate die index from
/sys/devices/system/cpu/cpu0/topology/die_id which is only unique within
a package.

In this way the array size
"int cpus[MAX_PACKAGE_COUNT][MAX_DIE_PER_PACKAGE][MAX_PUNIT_PER_DIE]"
doesn't have to increase with increasing package count.

No functional change is expected.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c