Thread (14 messages) 14 messages, 3 authors, 2023-06-22

Re: [PATCH 07/10] cpu/SMT: Allow enabling partial SMT states via sysfs

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2023-06-22 12:14:34
Also in: linux-arch, lkml

Thomas Gleixner [off-list ref] writes:
On Thu, Jun 15 2023 at 17:46, Laurent Dufour wrote:
quoted
 
-	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?
Yes, I think so.

I'll fold that in and do a respin of this series for 6.6 in the next
week or two.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help