Re: [PATCH] arch_topology: Support SMT control on arm64

From: Dietmar Eggemann
Date: Fri Sep 22 2023 - 07:13:57 EST


On 21/09/2023 10:56, Yicong Yang wrote:
> On 2023/9/21 1:08, Dietmar Eggemann wrote:
>> On 19/09/2023 14:33, Yicong Yang wrote:
>>> From: Yicong Yang <yangyicong@xxxxxxxxxxxxx>

[...]

> If you manually disable SMT by offline each CPUs the cpu_smt_control will
> not be updated. It'll updated when using the interface like
> `/sys/devices/system/cpu/smt/control` or cmdline. By these means,
> the framework will use topology_is_primary_thread() to decide which CPU
> in the SMT will keep online:
>
> // e.g. echo off > /sys/devices/system/cpu/smt/control
> [ kernel/cpu.c ]
> control_store()
> __store_smt_control()
> cpuhp_smt_disable()
> for_each_online_cpu(cpu)
> if (topology_is_primary_thread(cpu))
> continue; <---------- will skip the primary thread
> [...]
> cpu_smt_control = CPU_SMT_DISABLED;
>
> topology_is_primary_thread() checking only applies to the SMT control but
> not to the CPU offline.

I see, make sense. Retested on my SMT4 Arm64 server with 256 CPUs.