mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
tools/power turbostat: Remember global max_die_id
[ Upstream commitcda2033886] This is necessary to gracefully handle sparse die_id's. no functional change Signed-off-by: Len Brown <len.brown@intel.com> Stable-dep-of:3559ea813a("tools/power turbostat: Avoid possible memory corruption due to sparse topology IDs") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e809bc1127
commit
902ceb51d2
@@ -1415,6 +1415,7 @@ struct topo_params {
|
|||||||
int allowed_cpus;
|
int allowed_cpus;
|
||||||
int allowed_cores;
|
int allowed_cores;
|
||||||
int max_cpu_num;
|
int max_cpu_num;
|
||||||
|
int max_die_id;
|
||||||
int max_node_num;
|
int max_node_num;
|
||||||
int nodes_per_pkg;
|
int nodes_per_pkg;
|
||||||
int cores_per_node;
|
int cores_per_node;
|
||||||
@@ -6967,7 +6968,6 @@ void topology_probe(bool startup)
|
|||||||
int i;
|
int i;
|
||||||
int max_core_id = 0;
|
int max_core_id = 0;
|
||||||
int max_package_id = 0;
|
int max_package_id = 0;
|
||||||
int max_die_id = 0;
|
|
||||||
int max_siblings = 0;
|
int max_siblings = 0;
|
||||||
|
|
||||||
/* Initialize num_cpus, max_cpu_num */
|
/* Initialize num_cpus, max_cpu_num */
|
||||||
@@ -7084,8 +7084,8 @@ void topology_probe(bool startup)
|
|||||||
|
|
||||||
/* get die information */
|
/* get die information */
|
||||||
cpus[i].die_id = get_die_id(i);
|
cpus[i].die_id = get_die_id(i);
|
||||||
if (cpus[i].die_id > max_die_id)
|
if (cpus[i].die_id > topo.max_die_id)
|
||||||
max_die_id = cpus[i].die_id;
|
topo.max_die_id = cpus[i].die_id;
|
||||||
|
|
||||||
/* get numa node information */
|
/* get numa node information */
|
||||||
cpus[i].physical_node_id = get_physical_node_id(&cpus[i]);
|
cpus[i].physical_node_id = get_physical_node_id(&cpus[i]);
|
||||||
@@ -7111,9 +7111,9 @@ void topology_probe(bool startup)
|
|||||||
if (!summary_only && topo.cores_per_node > 1)
|
if (!summary_only && topo.cores_per_node > 1)
|
||||||
BIC_PRESENT(BIC_Core);
|
BIC_PRESENT(BIC_Core);
|
||||||
|
|
||||||
topo.num_die = max_die_id + 1;
|
topo.num_die = topo.max_die_id + 1;
|
||||||
if (debug > 1)
|
if (debug > 1)
|
||||||
fprintf(outf, "max_die_id %d, sizing for %d die\n", max_die_id, topo.num_die);
|
fprintf(outf, "max_die_id %d, sizing for %d die\n", topo.max_die_id, topo.num_die);
|
||||||
if (!summary_only && topo.num_die > 1)
|
if (!summary_only && topo.num_die > 1)
|
||||||
BIC_PRESENT(BIC_Die);
|
BIC_PRESENT(BIC_Die);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user