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

Michael Ellerman mpe at ellerman.id.au
Thu Jun 22 22:14:24 AEST 2023


Thomas Gleixner <tglx at linutronix.de> writes:
> 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?

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


More information about the Linuxppc-dev mailing list