All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Laurent Dufour <ldufour@linux.ibm.com>, linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, x86@kernel.org,
	linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au,
	npiggin@gmail.com, christophe.leroy@csgroup.eu,
	dave.hansen@linux.intel.com, mingo@redhat.com, bp@alien8.de
Subject: Re: [PATCH 07/10] cpu/SMT: Allow enabling partial SMT states via sysfs
Date: Thu, 22 Jun 2023 11:12:24 +0200	[thread overview]
Message-ID: <87legb7tdz.ffs@tglx> (raw)
In-Reply-To: <20230615154635.13660-8-ldufour@linux.ibm.com>

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



WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: Laurent Dufour <ldufour@linux.ibm.com>, linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, dave.hansen@linux.intel.com,
	x86@kernel.org, mingo@redhat.com, bp@alien8.de,
	npiggin@gmail.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 07/10] cpu/SMT: Allow enabling partial SMT states via sysfs
Date: Thu, 22 Jun 2023 11:12:24 +0200	[thread overview]
Message-ID: <87legb7tdz.ffs@tglx> (raw)
In-Reply-To: <20230615154635.13660-8-ldufour@linux.ibm.com>

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



  reply	other threads:[~2023-06-22  9:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 15:46 [PATCH 00/10] Introduce SMT level and add PowerPC support Laurent Dufour
2023-06-15 15:46 ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 01/10] cpu/SMT: Move SMT prototypes into cpu_smt.h Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-22  8:51   ` Thomas Gleixner
2023-06-22  8:51     ` Thomas Gleixner
2023-06-15 15:46 ` [PATCH 02/10] cpu/SMT: Move smt/control simple exit cases earlier Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 03/10] cpu/SMT: Store the current/max number of threads Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 04/10] cpu/SMT: Remove topology_smt_supported() Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 05/10] cpu/SMT: Create topology_smt_threads_supported() Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 06/10] cpu/SMT: Create topology_smt_thread_allowed() Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 07/10] cpu/SMT: Allow enabling partial SMT states via sysfs Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-22  9:12   ` Thomas Gleixner [this message]
2023-06-22  9:12     ` Thomas Gleixner
2023-06-22 12:14     ` Michael Ellerman
2023-06-22 12:14       ` Michael Ellerman
2023-06-15 15:46 ` [PATCH 08/10] powerpc/pseries: Initialise CPU hotplug callbacks earlier Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 09/10] powerpc: Add HOTPLUG_SMT support Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour
2023-06-15 15:46 ` [PATCH 10/10] powerpc/pseries: Honour current SMT state when DLPAR onlining CPUs Laurent Dufour
2023-06-15 15:46   ` Laurent Dufour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87legb7tdz.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@linux.intel.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.