[PATCH 4/4] s390/idle: Remove idle time and count sysfs files

From: Heiko Carstens

Date: Wed May 13 2026 - 10:16:10 EST


Remove the s390 specific idle_time_us and idle_count per cpu sysfs
files. They do not provide any additional value. The risk that there
are existing applications which rely on these architecture specific
files should be very low.

However if it turns out such applications exist, this can be easily
reverted.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/include/asm/idle.h | 6 ------
arch/s390/kernel/idle.c | 20 --------------------
arch/s390/kernel/smp.c | 33 +--------------------------------
3 files changed, 1 insertion(+), 58 deletions(-)

diff --git a/arch/s390/include/asm/idle.h b/arch/s390/include/asm/idle.h
index f3502d5621c0..07819f11987c 100644
--- a/arch/s390/include/asm/idle.h
+++ b/arch/s390/include/asm/idle.h
@@ -10,15 +10,12 @@

#include <linux/percpu-defs.h>
#include <linux/types.h>
-#include <linux/device.h>
#include <asm/tod_types.h>

struct s390_idle_data {
#ifdef CONFIG_NO_HZ_COMMON
bool in_idle;
#endif
- unsigned long idle_count;
- unsigned long idle_time;
unsigned long timer_idle_enter;
unsigned long mt_cycles_enter[8];
union tod_clock clock_idle_enter;
@@ -27,7 +24,4 @@ struct s390_idle_data {

DECLARE_PER_CPU(struct s390_idle_data, s390_idle);

-extern struct device_attribute dev_attr_idle_count;
-extern struct device_attribute dev_attr_idle_time_us;
-
#endif /* _S390_IDLE_H */
diff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c
index b5fae512fc9c..7f7851c001e0 100644
--- a/arch/s390/kernel/idle.c
+++ b/arch/s390/kernel/idle.c
@@ -28,8 +28,6 @@ static __always_inline void __account_idle_time_irq(void)
unsigned long idle_time;

idle_time = idle->clock_idle_exit.tod - idle->clock_idle_enter.tod;
- __atomic64_add(idle_time, &idle->idle_time);
- __atomic64_add_const(1, &idle->idle_count);
account_idle_time(cputime_to_nsecs(idle_time));
}

@@ -144,24 +142,6 @@ void noinstr arch_cpu_idle(void)
__load_psw_mask(psw_mask);
}

-static ssize_t show_idle_count(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
-
- return sysfs_emit(buf, "%lu\n", READ_ONCE(idle->idle_count));
-}
-DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
-
-static ssize_t show_idle_time(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
-
- return sysfs_emit(buf, "%lu\n", READ_ONCE(idle->idle_time) >> 12);
-}
-DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
-
void arch_cpu_idle_enter(void)
{
}
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 50bb499cf3e5..0ba7f89b8161 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -54,7 +54,6 @@
#include <asm/debug.h>
#include <asm/os_info.h>
#include <asm/sigp.h>
-#include <asm/idle.h>
#include <asm/nmi.h>
#include <asm/stacktrace.h>
#include <asm/topology.h>
@@ -1085,31 +1084,6 @@ static struct attribute_group cpu_common_attr_group = {
.attrs = cpu_common_attrs,
};

-static struct attribute *cpu_online_attrs[] = {
- &dev_attr_idle_count.attr,
- &dev_attr_idle_time_us.attr,
- NULL,
-};
-
-static struct attribute_group cpu_online_attr_group = {
- .attrs = cpu_online_attrs,
-};
-
-static int smp_cpu_online(unsigned int cpu)
-{
- struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
-
- return sysfs_create_group(&c->dev.kobj, &cpu_online_attr_group);
-}
-
-static int smp_cpu_pre_down(unsigned int cpu)
-{
- struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
-
- sysfs_remove_group(&c->dev.kobj, &cpu_online_attr_group);
- return 0;
-}
-
bool arch_cpu_is_hotpluggable(int cpu)
{
return !!cpu;
@@ -1175,18 +1149,13 @@ static DEVICE_ATTR_WO(rescan);
static int __init s390_smp_init(void)
{
struct device *dev_root;
- int rc;
+ int rc = 0;

dev_root = bus_get_dev_root(&cpu_subsys);
if (dev_root) {
rc = device_create_file(dev_root, &dev_attr_rescan);
put_device(dev_root);
- if (rc)
- return rc;
}
- rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "s390/smp:online",
- smp_cpu_online, smp_cpu_pre_down);
- rc = rc <= 0 ? rc : 0;
return rc;
}
subsys_initcall(s390_smp_init);
--
2.51.0