Skip to content

Commit 307b675

Browse files
tobias-huschleVasily Gorbik
authored andcommitted
s390/wti: Add debugfs file to display missed grace periods per cpu
Introduce a new debug file which allows to determine how many warning track grace periods were missed on each CPU. The new file can be found as /sys/kernel/debug/s390/wti It is formatted as: CPU0 CPU1 [...] CPUx xyz xyz [...] xyz Acked-by: Heiko Carstens <[email protected]> Reviewed-by: Mete Durlu <[email protected]> Signed-off-by: Tobias Huschle <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 42419bc commit 307b675

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

arch/s390/kernel/wti.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright IBM Corp. 2023
66
*/
77

8+
#include <linux/cpu.h>
9+
#include <linux/debugfs.h>
810
#include <linux/kallsyms.h>
911
#include <linux/smpboot.h>
1012
#include <linux/irq.h>
@@ -117,6 +119,26 @@ static void wti_dbf_grace_period(struct wti_state *st)
117119
wdi->missed++;
118120
}
119121

122+
static int wti_show(struct seq_file *seq, void *v)
123+
{
124+
struct wti_state *st;
125+
int cpu;
126+
127+
cpus_read_lock();
128+
seq_puts(seq, " ");
129+
for_each_online_cpu(cpu)
130+
seq_printf(seq, "CPU%-8d", cpu);
131+
seq_putc(seq, '\n');
132+
for_each_online_cpu(cpu) {
133+
st = per_cpu_ptr(&wti_state, cpu);
134+
seq_printf(seq, " %10lu", st->dbg.missed);
135+
}
136+
seq_putc(seq, '\n');
137+
cpus_read_unlock();
138+
return 0;
139+
}
140+
DEFINE_SHOW_ATTRIBUTE(wti);
141+
120142
static void wti_thread_fn(unsigned int cpu)
121143
{
122144
struct wti_state *st = per_cpu_ptr(&wti_state, cpu);
@@ -143,6 +165,7 @@ static struct smp_hotplug_thread wti_threads = {
143165
static int __init wti_init(void)
144166
{
145167
struct sched_param wti_sched_param = { .sched_priority = MAX_RT_PRIO - 1 };
168+
struct dentry *wti_dir;
146169
struct wti_state *st;
147170
int cpu, rc;
148171

@@ -168,6 +191,8 @@ static int __init wti_init(void)
168191
rc = -EOPNOTSUPP;
169192
goto out_subclass;
170193
}
194+
wti_dir = debugfs_create_dir("wti", arch_debugfs_dir);
195+
debugfs_create_file("stat", 0400, wti_dir, NULL, &wti_fops);
171196
wti_dbg = debug_register("wti", 1, 1, WTI_DBF_LEN);
172197
if (!wti_dbg) {
173198
rc = -ENOMEM;

0 commit comments

Comments
 (0)