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] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b821e5521664c58bc1990230ed757c5@huawei.com>
Date: Wed, 17 Apr 2024 17:01:17 +0000
From: Salil Mehta <salil.mehta@...wei.com>
To: Jonathan Cameron <jonathan.cameron@...wei.com>, Thomas Gleixner
	<tglx@...utronix.de>, Peter Zijlstra <peterz@...radead.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"loongarch@...ts.linux.dev" <loongarch@...ts.linux.dev>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "kvmarm@...ts.linux.dev"
	<kvmarm@...ts.linux.dev>, "x86@...nel.org" <x86@...nel.org>, Russell King
	<linux@...linux.org.uk>, "Rafael J . Wysocki" <rafael@...nel.org>, "Miguel
 Luis" <miguel.luis@...cle.com>, James Morse <james.morse@....com>,
	Jean-Philippe Brucker <jean-philippe@...aro.org>, Catalin Marinas
	<catalin.marinas@....com>, Will Deacon <will@...nel.org>
CC: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, "Dave
 Hansen" <dave.hansen@...ux.intel.com>, Linuxarm <linuxarm@...wei.com>,
	"justin.he@....com" <justin.he@....com>, "jianyong.wu@....com"
	<jianyong.wu@....com>
Subject: RE: [PATCH v6 16/16] cpumask: Add enabled cpumask for present CPUs
 that can be brought online

>  From: Jonathan Cameron <jonathan.cameron@...wei.com>
>  Sent: Wednesday, April 17, 2024 2:19 PM
>  
>  From: James Morse <james.morse@....com>
>  
>  The 'offline' file in sysfs shows all offline CPUs, including those that aren't
>  present. User-space is expected to remove not-present CPUs from this list
>  to learn which CPUs could be brought online.
>  
>  CPUs can be present but not-enabled. These CPUs can't be brought online
>  until the firmware policy changes, which comes with an ACPI notification
>  that will register the CPUs.
>  
>  With only the offline and present files, user-space is unable to determine
>  which CPUs it can try to bring online. Add a new CPU mask that shows this
>  based on all the registered CPUs.
>  
>  Signed-off-by: James Morse <james.morse@....com>
>  Tested-by: Miguel Luis <miguel.luis@...cle.com>
>  Tested-by: Vishnu Pajjuri <vishnu@...amperecomputing.com>
>  Tested-by: Jianyong Wu <jianyong.wu@....com>
>  Acked-by: Thomas Gleixner <tglx@...utronix.de>
>  Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
>  Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
>  
>  ---
>  v5: No change
>  ---
>   .../ABI/testing/sysfs-devices-system-cpu      |  6 +++++
>   drivers/base/cpu.c                            | 10 ++++++++
>   include/linux/cpumask.h                       | 25 +++++++++++++++++++
>   kernel/cpu.c                                  |  3 +++
>   4 files changed, 44 insertions(+)
>  

[...]


>  diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index
>  b9d0d14e5960..4713b86d20f2 100644
>  --- a/drivers/base/cpu.c
>  +++ b/drivers/base/cpu.c
>  @@ -95,6 +95,7 @@ void unregister_cpu(struct cpu *cpu)  {
>   	int logical_cpu = cpu->dev.id;
>  
>  +	set_cpu_enabled(logical_cpu, false);


sorry, It is being done here in context to (un)register)cpu().


>   	unregister_cpu_under_node(logical_cpu,
>  cpu_to_node(logical_cpu));
>  
>   	device_unregister(&cpu->dev);
>  @@ -273,6 +274,13 @@ static ssize_t print_cpus_offline(struct device *dev,
>  }  static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
>  
>  +static ssize_t print_cpus_enabled(struct device *dev,
>  +				  struct device_attribute *attr, char *buf) {
>  +	return sysfs_emit(buf, "%*pbl\n",
>  cpumask_pr_args(cpu_enabled_mask));
>  +}
>  +static DEVICE_ATTR(enabled, 0444, print_cpus_enabled, NULL);
>  +
>   static ssize_t print_cpus_isolated(struct device *dev,
>   				  struct device_attribute *attr, char *buf)  {
>  @@ -413,6 +421,7 @@ int register_cpu(struct cpu *cpu, int num)
>   	register_cpu_under_node(num, cpu_to_node(num));
>   	dev_pm_qos_expose_latency_limit(&cpu->dev,
>  
>  	PM_QOS_RESUME_LATENCY_NO_CONSTRAINT);
>  +	set_cpu_enabled(num, true);


and here.

Thanks
Salil.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ