]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
s390/hiperdispatch: Add trace events
authorMete Durlu <meted@linux.ibm.com>
Mon, 12 Aug 2024 11:39:36 +0000 (13:39 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 29 Aug 2024 20:56:35 +0000 (22:56 +0200)
Add trace events to debug hiperdispatch behavior and track domain
rebuilding. Two events provide information about the decision making of
hiperdispatch and the adjustments made.

Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Co-developed-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Mete Durlu <meted@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/trace/hiperdispatch.h [new file with mode: 0644]
arch/s390/kernel/hiperdispatch.c

diff --git a/arch/s390/include/asm/trace/hiperdispatch.h b/arch/s390/include/asm/trace/hiperdispatch.h
new file mode 100644 (file)
index 0000000..46462ee
--- /dev/null
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Tracepoint header for hiperdispatch
+ *
+ * Copyright IBM Corp. 2024
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM s390
+
+#if !defined(_TRACE_S390_HIPERDISPATCH_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_S390_HIPERDISPATCH_H
+
+#include <linux/tracepoint.h>
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH asm/trace
+#define TRACE_INCLUDE_FILE hiperdispatch
+
+TRACE_EVENT(s390_hd_work_fn,
+           TP_PROTO(int steal_time_percentage,
+                    int entitled_core_count,
+                    int highcap_core_count),
+           TP_ARGS(steal_time_percentage,
+                   entitled_core_count,
+                   highcap_core_count),
+           TP_STRUCT__entry(__field(int, steal_time_percentage)
+                            __field(int, entitled_core_count)
+                            __field(int, highcap_core_count)),
+           TP_fast_assign(__entry->steal_time_percentage = steal_time_percentage;
+                          __entry->entitled_core_count = entitled_core_count;
+                          __entry->highcap_core_count = highcap_core_count;),
+           TP_printk("steal: %d entitled_core_count: %d highcap_core_count: %d",
+                     __entry->steal_time_percentage,
+                     __entry->entitled_core_count,
+                     __entry->highcap_core_count)
+);
+
+TRACE_EVENT(s390_hd_rebuild_domains,
+           TP_PROTO(int current_highcap_core_count,
+                    int new_highcap_core_count),
+           TP_ARGS(current_highcap_core_count,
+                   new_highcap_core_count),
+           TP_STRUCT__entry(__field(int, current_highcap_core_count)
+                            __field(int, new_highcap_core_count)),
+           TP_fast_assign(__entry->current_highcap_core_count = current_highcap_core_count;
+                          __entry->new_highcap_core_count = new_highcap_core_count),
+           TP_printk("change highcap_core_count: %u -> %u",
+                     __entry->current_highcap_core_count,
+                     __entry->new_highcap_core_count)
+);
+
+#endif /* _TRACE_S390_HIPERDISPATCH_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
index ed5b2d7d11c4f345d04f6f45ec0600debe46d60f..3ba7a3492924bd5d03a3037369a0a9846dbd0ca1 100644 (file)
@@ -53,6 +53,9 @@
 #include <asm/smp.h>
 #include <asm/topology.h>
 
+#define CREATE_TRACE_POINTS
+#include <asm/trace/hiperdispatch.h>
+
 #define HD_DELAY_FACTOR                        (4)
 #define HD_DELAY_INTERVAL              (HZ / 4)
 #define HD_STEAL_THRESHOLD             30
@@ -200,9 +203,11 @@ static void hd_capacity_work_fn(struct work_struct *work)
        else
                new_cores = hd_entitled_cores;
        if (hd_high_capacity_cores != new_cores) {
+               trace_s390_hd_rebuild_domains(hd_high_capacity_cores, new_cores);
                hd_high_capacity_cores = new_cores;
                topology_schedule_update();
        }
+       trace_s390_hd_work_fn(steal_percentage, hd_entitled_cores, hd_high_capacity_cores);
        mutex_unlock(&smp_cpu_state_mutex);
        schedule_delayed_work(&hd_capacity_work, HD_DELAY_INTERVAL);
 }