linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Andrea Arcangeli <aarcange@redhat.com>,
	Waiman Long <longman@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Jiri Kosina <jikos@kernel.org>
Subject: Re: [PATCH] cpu/hotplug: Create SMT sysfs interface for all arches
Date: Tue, 26 Mar 2019 19:34:57 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1903261934280.1789@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20190326180348.fzerpltlf62dnurd@treble>

On Tue, 26 Mar 2019, Josh Poimboeuf wrote:
> On Tue, Mar 26, 2019 at 02:53:04PM +0100, Thomas Gleixner wrote:
> > > Makes sense.  I like #3.  I can post another version.
> > 
> > Yes, please.
> 
> Something like so (on top of the original patch)?
> 
> diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
> index 4a11cba73085..5eea46fefcb2 100644
> --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
> +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
> @@ -511,11 +511,12 @@ Description:	Control Symetric Multi Threading (SMT)
>  		control: Read/write interface to control SMT. Possible
>  			 values:
>  
> -			 "on"		SMT is enabled
> -			 "off"		SMT is disabled
> -			 "forceoff"	SMT is force disabled. Cannot be changed.
> -			 "notsupported" Runtime SMT toggling is not currently
> -					supported for the architecture
> +			 "on"		  SMT is enabled
> +			 "off"		  SMT is disabled
> +			 "forceoff"	  SMT is force disabled. Cannot be changed.
> +			 "notsupported"   SMT is not supported by the CPU
> +			 "notimplemented" SMT runtime toggling is not
> +					  implemented for the architecture
>  
>  			 If control status is "forceoff" or "notsupported" writes
>  			 are rejected.
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 517ab1803a22..05a71ee98440 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -2145,7 +2145,11 @@ static const char *smt_states[] = {
>  static ssize_t
>  show_smt_control(struct device *dev, struct device_attribute *attr, char *buf)
>  {
> -	return snprintf(buf, PAGE_SIZE - 2, "%s\n", smt_states[cpu_smt_control]);
> +	const char *state = IS_ENABLED(CONFIG_HOTPLUG_SMT) ?
> +				smt_states[cpu_smt_control] :
> +				"notimplemented";
> +
> +	return snprintf(buf, PAGE_SIZE - 2, "%s\n", state);
>  }

Looks good!

Thanks,

	tglx

      reply	other threads:[~2019-03-26 18:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 17:42 [PATCH] cpu/hotplug: Create SMT sysfs interface for all arches Josh Poimboeuf
2019-03-06 15:44 ` Thomas Gleixner
2019-03-24 20:13 ` Thomas Gleixner
2019-03-26 13:32   ` Josh Poimboeuf
2019-03-26 13:53     ` Thomas Gleixner
2019-03-26 18:03       ` Josh Poimboeuf
2019-03-26 18:34         ` Thomas Gleixner [this message]

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=alpine.DEB.2.21.1903261934280.1789@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=aarcange@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=peterz@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).