[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87legb7tdz.ffs@tglx>
Date: Thu, 22 Jun 2023 11:12:24 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Laurent Dufour <ldufour@...ux.ibm.com>,
linux-kernel@...r.kernel.org
Cc: linux-arch@...r.kernel.org, x86@...nel.org,
linuxppc-dev@...ts.ozlabs.org, mpe@...erman.id.au,
npiggin@...il.com, christophe.leroy@...roup.eu,
dave.hansen@...ux.intel.com, mingo@...hat.com, bp@...en8.de
Subject: Re: [PATCH 07/10] cpu/SMT: Allow enabling partial SMT states via sysfs
On Thu, Jun 15 2023 at 17:46, Laurent Dufour wrote:
>
> - if (ctrlval != cpu_smt_control) {
> + orig_threads = cpu_smt_num_threads;
> + cpu_smt_num_threads = num_threads;
> +
> + if (num_threads > orig_threads) {
> + ret = cpuhp_smt_enable();
> + } else if (num_threads < orig_threads) {
> + ret = cpuhp_smt_disable(ctrlval);
> + } else if (ctrlval != cpu_smt_control) {
> switch (ctrlval) {
> case CPU_SMT_ENABLED:
> ret = cpuhp_smt_enable();
This switch() is still as pointless as in the previous version.
OFF -> ON, ON -> OFF, ON -> FORCE_OFF are covered by the num_threads
comparisons.
So the only case where (ctrlval != cpu_smt_control) is relevant is the
OFF -> FORCE_OFF transition because in that case the number of threads
is not changing.
force_off = ctrlval != cpu_smt_control && ctrval == CPU_SMT_FORCE_DISABLED;
if (num_threads > orig_threads)
ret = cpuhp_smt_enable();
else if (num_threads < orig_threads || force_off)
ret = cpuhp_smt_disable(ctrlval);
Should just work, no?
Thanks,
tglx
Powered by blists - more mailing lists