* [PATCH] s390/topology: Switch to common cpu capacity code
@ 2026-08-25 12:58 Mete Durlu
2026-08-25 13:06 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mete Durlu @ 2026-08-25 12:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle
Cc: linux-s390, Mete Durlu
s390 implementation of cpu capacity management infrastructure code does
not do anything different than its common code counterpart. Switch to
common code functions and remove the smp_cpu_*_capacity() functions.
Make s390 code better align with other architectures which utilize
cpu_capacity. No functional changes.
Allow cpu_capacity attributes inside sysfs to accurately reflect cpu
capacity.
ex:
$ cat /sys/devices/system/cpu/cpu0/polarization
vertical:high
$ cat /sys/devices/system/cpu/cpu0/cpu_capacity
1024
$ cat /sys/devices/system/cpu/cpu40/polarization
vertical:low
$ cat /sys/devices/system/cpu/cpu40/cpu_capacity
128
Prior to commit 6bceea7a1e07 ("arch_topology: Relocate cpu_scale to
topology.[h|c]") cpu_capacity attribute was only available to the common
arch_topology driver's users. Reflect the correct values to the newly
made available attributes.
Signed-off-by: Mete Durlu <meted@linux.ibm.com>
---
arch/s390/include/asm/processor.h | 1 -
arch/s390/include/asm/smp.h | 4 +---
arch/s390/kernel/smp.c | 16 +++-------------
arch/s390/kernel/topology.c | 2 +-
4 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index be8369115f6d..9434c76c25b8 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -46,7 +46,6 @@ struct pcpu {
unsigned long ec_mask; /* bit mask for ec_xxx functions */
unsigned long ec_clk; /* sigp timestamp for ec_xxx */
unsigned long flags; /* per CPU flags */
- unsigned long capacity; /* cpu capacity for scheduler */
signed char state; /* physical cpu state */
signed char polarization; /* physical polarization */
u16 address; /* physical cpu address */
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index fb2bdbf35da5..a6c621e0491c 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -30,7 +30,7 @@ static __always_inline unsigned int raw_smp_processor_id(void)
return cpu;
}
-#define arch_scale_cpu_capacity smp_cpu_get_capacity
+#define arch_scale_cpu_capacity topology_get_cpu_scale
extern struct mutex smp_cpu_state_mutex;
extern unsigned int smp_cpu_mt_shift;
@@ -53,9 +53,7 @@ extern void smp_save_dump_secondary_cpus(void);
extern void smp_yield_cpu(int cpu);
extern void smp_cpu_set_polarization(int cpu, int val);
extern int smp_cpu_get_polarization(int cpu);
-extern void smp_cpu_set_capacity(int cpu, unsigned long val);
extern void smp_set_core_capacity(int cpu, unsigned long val);
-extern unsigned long smp_cpu_get_capacity(int cpu);
extern int smp_cpu_get_cpu_address(int cpu);
extern void smp_fill_possible_mask(void);
extern void smp_detect_cpus(void);
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 167c72803ccf..32499cad86f0 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -659,23 +659,13 @@ int smp_cpu_get_polarization(int cpu)
return per_cpu(pcpu_devices, cpu).polarization;
}
-void smp_cpu_set_capacity(int cpu, unsigned long val)
-{
- per_cpu(pcpu_devices, cpu).capacity = val;
-}
-
-unsigned long smp_cpu_get_capacity(int cpu)
-{
- return per_cpu(pcpu_devices, cpu).capacity;
-}
-
void smp_set_core_capacity(int cpu, unsigned long val)
{
int i;
cpu = smp_get_base_cpu(cpu);
for (i = cpu; (i <= cpu + smp_cpu_mtid) && (i < nr_cpu_ids); i++)
- smp_cpu_set_capacity(i, val);
+ topology_set_cpu_scale(i, val);
}
int smp_cpu_get_cpu_address(int cpu)
@@ -727,7 +717,7 @@ static int smp_add_core(struct sclp_core_entry *core, cpumask_t *avail,
else
pcpu->state = CPU_STATE_STANDBY;
smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN);
- smp_cpu_set_capacity(cpu, CPU_CAPACITY_HIGH);
+ topology_set_cpu_scale(cpu, CPU_CAPACITY_HIGH);
set_cpu_present(cpu, true);
if (!early && arch_register_cpu(cpu))
set_cpu_present(cpu, false);
@@ -967,7 +957,7 @@ void __init smp_prepare_boot_cpu(void)
ipl_pcpu->state = CPU_STATE_CONFIGURED;
lc->pcpu = (unsigned long)ipl_pcpu;
smp_cpu_set_polarization(0, POLARIZATION_UNKNOWN);
- smp_cpu_set_capacity(0, CPU_CAPACITY_HIGH);
+ topology_set_cpu_scale(0, CPU_CAPACITY_HIGH);
}
void __init smp_setup_processor_id(void)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 1377c6f3f670..42fc0294f543 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -147,7 +147,7 @@ static void add_cpus_to_mask(struct topology_core *tl_core,
cpumask_set_cpu(cpu, &book->mask);
cpumask_set_cpu(cpu, &socket->mask);
smp_cpu_set_polarization(cpu, tl_core->pp);
- smp_cpu_set_capacity(cpu, CPU_CAPACITY_HIGH);
+ topology_set_cpu_scale(cpu, CPU_CAPACITY_HIGH);
}
}
}
---
base-commit: 66498c75b4f8017f62d720d9b59675bdf3abce91
change-id: 20260825-common_capacity-ae3fb766749b
Best regards,
--
Mete Durlu <meted@linux.ibm.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] s390/topology: Switch to common cpu capacity code
2026-08-25 12:58 [PATCH] s390/topology: Switch to common cpu capacity code Mete Durlu
@ 2026-08-25 13:06 ` sashiko-bot
2026-08-25 13:35 ` Heiko Carstens
2026-08-26 23:05 ` Vasily Gorbik
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-25 13:06 UTC (permalink / raw)
To: Mete Durlu
Cc: Heiko Carstens, Christian Borntraeger, Alexander Gordeev,
linux-s390, Vasily Gorbik
> s390 implementation of cpu capacity management infrastructure code does
> not do anything different than its common code counterpart. Switch to
> common code functions and remove the smp_cpu_*_capacity() functions.
> Make s390 code better align with other architectures which utilize
> cpu_capacity. No functional changes.
>
> Allow cpu_capacity attributes inside sysfs to accurately reflect cpu
> capacity.
> ex:
>
> $ cat /sys/devices/system/cpu/cpu0/polarization
> vertical:high
> $ cat /sys/devices/system/cpu/cpu0/cpu_capacity
> 1024
>
> $ cat /sys/devices/system/cpu/cpu40/polarization
> vertical:low
> $ cat /sys/devices/system/cpu/cpu40/cpu_capacity
> 128
>
> Prior to commit 6bceea7a1e07 ("arch_topology: Relocate cpu_scale to
> topology.[h|c]") cpu_capacity attribute was only available to the common
> arch_topology driver's users. Reflect the correct values to the newly
> made available attributes.
>
> Signed-off-by: Mete Durlu <meted@linux.ibm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825-common_capacity-v1-1-1cdfa3ad5e14@linux.ibm.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] s390/topology: Switch to common cpu capacity code
2026-08-25 12:58 [PATCH] s390/topology: Switch to common cpu capacity code Mete Durlu
2026-08-25 13:06 ` sashiko-bot
@ 2026-08-25 13:35 ` Heiko Carstens
2026-08-26 23:05 ` Vasily Gorbik
2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-08-25 13:35 UTC (permalink / raw)
To: Mete Durlu
Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, linux-s390
On Tue, Aug 25, 2026 at 02:58:20PM +0200, Mete Durlu wrote:
> s390 implementation of cpu capacity management infrastructure code does
> not do anything different than its common code counterpart. Switch to
> common code functions and remove the smp_cpu_*_capacity() functions.
> Make s390 code better align with other architectures which utilize
> cpu_capacity. No functional changes.
>
> Allow cpu_capacity attributes inside sysfs to accurately reflect cpu
> capacity.
> ex:
>
> $ cat /sys/devices/system/cpu/cpu0/polarization
> vertical:high
> $ cat /sys/devices/system/cpu/cpu0/cpu_capacity
> 1024
>
> $ cat /sys/devices/system/cpu/cpu40/polarization
> vertical:low
> $ cat /sys/devices/system/cpu/cpu40/cpu_capacity
> 128
>
> Prior to commit 6bceea7a1e07 ("arch_topology: Relocate cpu_scale to
> topology.[h|c]") cpu_capacity attribute was only available to the common
> arch_topology driver's users. Reflect the correct values to the newly
> made available attributes.
>
> Signed-off-by: Mete Durlu <meted@linux.ibm.com>
> ---
> arch/s390/include/asm/processor.h | 1 -
> arch/s390/include/asm/smp.h | 4 +---
> arch/s390/kernel/smp.c | 16 +++-------------
> arch/s390/kernel/topology.c | 2 +-
> 4 files changed, 5 insertions(+), 18 deletions(-)
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] s390/topology: Switch to common cpu capacity code
2026-08-25 12:58 [PATCH] s390/topology: Switch to common cpu capacity code Mete Durlu
2026-08-25 13:06 ` sashiko-bot
2026-08-25 13:35 ` Heiko Carstens
@ 2026-08-26 23:05 ` Vasily Gorbik
2 siblings, 0 replies; 4+ messages in thread
From: Vasily Gorbik @ 2026-08-26 23:05 UTC (permalink / raw)
To: Mete Durlu
Cc: Heiko Carstens, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, linux-s390
On Tue, Aug 25, 2026 at 02:58:20PM +0200, Mete Durlu wrote:
> s390 implementation of cpu capacity management infrastructure code does
> not do anything different than its common code counterpart. Switch to
> common code functions and remove the smp_cpu_*_capacity() functions.
> Make s390 code better align with other architectures which utilize
> cpu_capacity. No functional changes.
>
> Allow cpu_capacity attributes inside sysfs to accurately reflect cpu
> capacity.
> ex:
>
> $ cat /sys/devices/system/cpu/cpu0/polarization
> vertical:high
> $ cat /sys/devices/system/cpu/cpu0/cpu_capacity
> 1024
>
> $ cat /sys/devices/system/cpu/cpu40/polarization
> vertical:low
> $ cat /sys/devices/system/cpu/cpu40/cpu_capacity
> 128
>
> Prior to commit 6bceea7a1e07 ("arch_topology: Relocate cpu_scale to
> topology.[h|c]") cpu_capacity attribute was only available to the common
> arch_topology driver's users. Reflect the correct values to the newly
> made available attributes.
>
> Signed-off-by: Mete Durlu <meted@linux.ibm.com>
> ---
> arch/s390/include/asm/processor.h | 1 -
> arch/s390/include/asm/smp.h | 4 +---
> arch/s390/kernel/smp.c | 16 +++-------------
> arch/s390/kernel/topology.c | 2 +-
> 4 files changed, 5 insertions(+), 18 deletions(-)
Applied, thank you!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-26 23:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 12:58 [PATCH] s390/topology: Switch to common cpu capacity code Mete Durlu
2026-08-25 13:06 ` sashiko-bot
2026-08-25 13:35 ` Heiko Carstens
2026-08-26 23:05 ` Vasily Gorbik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox