lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1903261934280.1789@nanos.tec.linutronix.de>
Date:   Tue, 26 Mar 2019 19:34:57 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Andrea Arcangeli <aarcange@...hat.com>,
        Waiman Long <longman@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Kosina <jikos@...nel.org>
Subject: Re: [PATCH] cpu/hotplug: Create SMT sysfs interface for all arches

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ