Re: [patch v2 25/30] x86/cpu/topology: Use topology logical mapping mechanism

From: Zhang, Rui
Date: Fri Feb 02 2024 - 01:49:10 EST


Hi, Thomas,

> @@ -147,6 +148,9 @@ static void topo_set_ids(struct topo_sca
>         c->topo.pkg_id = topo_shift_apicid(apicid, TOPO_PKG_DOMAIN);
>         c->topo.die_id = topo_shift_apicid(apicid, TOPO_DIE_DOMAIN);
>  
> +       c->topo.logical_pkg_id = topology_get_logical_id(apicid,
> TOPO_PKG_DOMAIN);
> +       c->topo.logical_die_id = topology_get_logical_id(apicid,
> TOPO_DIE_DOMAIN);
> +

Just wondering if we could have logical_core_id.

drivers/hwmon/coretemp.c uses an array to save per core temperature
information. We cannot use core_id as array index because it can be
sparse. Currently, to get the temperature info for a specified core,
we need to traverse the array to know which core each entry maps to.

Ideally, we could have a global logical_core_id, and use that as the
array index directly.
This can also simplify kernel code in many places when checking if two
cpus are in the same core or not.

For now, I don't see a need to expose this info to userspace.

thanks,
rui