RE: [PATCH v6 16/16] cpumask: Add enabled cpumask for present CPUs that can be brought online

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  From: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
>  Sent: Wednesday, April 17, 2024 2:19 PM
>  
>  From: James Morse <james.morse@xxxxxxx>
>  
>  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@xxxxxxx>
>  Tested-by: Miguel Luis <miguel.luis@xxxxxxxxxx>
>  Tested-by: Vishnu Pajjuri <vishnu@xxxxxxxxxxxxxxxxxxxxxx>
>  Tested-by: Jianyong Wu <jianyong.wu@xxxxxxx>
>  Acked-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>  Signed-off-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
>  Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
>  
>  ---
>  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.







[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux