File tree Expand file tree Collapse file tree 6 files changed +98
-14
lines changed Expand file tree Collapse file tree 6 files changed +98
-14
lines changed Original file line number Diff line number Diff line change @@ -33,16 +33,8 @@ enum diag_stat_enum {
3333 NR_DIAG_STAT
3434};
3535
36- struct diag_stat {
37- unsigned int counter [NR_DIAG_STAT ];
38- };
39-
40- DECLARE_PER_CPU (struct diag_stat , diag_stat );
41-
42- static inline void diag_stat_inc (enum diag_stat_enum nr )
43- {
44- this_cpu_inc (diag_stat .counter [nr ]);
45- }
36+ void diag_stat_inc (enum diag_stat_enum nr );
37+ void diag_stat_inc_norecursion (enum diag_stat_enum nr );
4638
4739/*
4840 * Diagnose 10: Release page range
Original file line number Diff line number Diff line change 1+ /*
2+ * Tracepoint header for s390 diagnose calls
3+ *
4+ * Copyright IBM Corp. 2015
5+ * Author(s): Martin Schwidefsky <[email protected] > 6+ */
7+
8+ #undef TRACE_SYSTEM
9+ #define TRACE_SYSTEM s390
10+
11+ #if !defined(_TRACE_S390_DIAG_H ) || defined(TRACE_HEADER_MULTI_READ )
12+ #define _TRACE_S390_DIAG_H
13+
14+ #include <linux/tracepoint.h>
15+
16+ #undef TRACE_INCLUDE_PATH
17+ #undef TRACE_INCLUDE_FILE
18+
19+ #define TRACE_INCLUDE_PATH asm/trace
20+ #define TRACE_INCLUDE_FILE diag
21+
22+ TRACE_EVENT (diagnose ,
23+ TP_PROTO (unsigned short nr ),
24+ TP_ARGS (nr ),
25+ TP_STRUCT__entry (
26+ __field (unsigned short , nr )
27+ ),
28+ TP_fast_assign (
29+ __entry -> nr = nr ;
30+ ),
31+ TP_printk ("nr=0x%x" , __entry -> nr )
32+ );
33+
34+ #ifdef CONFIG_TRACEPOINTS
35+ void trace_diagnose_norecursion (int diag_nr );
36+ #else
37+ static inline void trace_diagnose_norecursion (int diag_nr ) { }
38+ #endif
39+
40+ #endif /* _TRACE_S390_DIAG_H */
41+
42+ /* This part must be outside protection */
43+ #include <trace/define_trace.h>
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ obj-$(CONFIG_UPROBES) += uprobes.o
6666obj-$(CONFIG_PERF_EVENTS) += perf_event.o perf_cpum_cf.o perf_cpum_sf.o
6767obj-$(CONFIG_PERF_EVENTS) += perf_cpum_cf_events.o
6868
69+ obj-$(CONFIG_TRACEPOINTS) += trace.o
70+
6971# vdso
7072obj-y += vdso64/
7173obj-$(CONFIG_COMPAT) += vdso32/
Original file line number Diff line number Diff line change 1010#include <linux/seq_file.h>
1111#include <linux/debugfs.h>
1212#include <asm/diag.h>
13+ #include <asm/trace/diag.h>
1314
14- DEFINE_PER_CPU (struct diag_stat , diag_stat );
15- EXPORT_PER_CPU_SYMBOL (diag_stat );
15+ struct diag_stat {
16+ unsigned int counter [NR_DIAG_STAT ];
17+ };
18+
19+ static DEFINE_PER_CPU (struct diag_stat , diag_stat ) ;
1620
1721struct diag_desc {
1822 int code ;
@@ -114,6 +118,20 @@ static int __init show_diag_stat_init(void)
114118
115119device_initcall (show_diag_stat_init );
116120
121+ void diag_stat_inc (enum diag_stat_enum nr )
122+ {
123+ this_cpu_inc (diag_stat .counter [nr ]);
124+ trace_diagnose (diag_map [nr ].code );
125+ }
126+ EXPORT_SYMBOL (diag_stat_inc );
127+
128+ void diag_stat_inc_norecursion (enum diag_stat_enum nr )
129+ {
130+ this_cpu_inc (diag_stat .counter [nr ]);
131+ trace_diagnose_norecursion (diag_map [nr ].code );
132+ }
133+ EXPORT_SYMBOL (diag_stat_inc_norecursion );
134+
117135/*
118136 * Diagnose 14: Input spool file manipulation
119137 */
Original file line number Diff line number Diff line change @@ -377,11 +377,11 @@ int smp_vcpu_scheduled(int cpu)
377377void smp_yield_cpu (int cpu )
378378{
379379 if (MACHINE_HAS_DIAG9C ) {
380- diag_stat_inc (DIAG_STAT_X09C );
380+ diag_stat_inc_norecursion (DIAG_STAT_X09C );
381381 asm volatile ("diag %0,0,0x9c"
382382 : : "d" (pcpu_devices [cpu ].address ));
383383 } else if (MACHINE_HAS_DIAG44 ) {
384- diag_stat_inc (DIAG_STAT_X044 );
384+ diag_stat_inc_norecursion (DIAG_STAT_X044 );
385385 asm volatile ("diag 0,0,0x44" );
386386 }
387387}
Original file line number Diff line number Diff line change 1+ /*
2+ * Tracepoint definitions for s390
3+ *
4+ * Copyright IBM Corp. 2015
5+ * Author(s): Martin Schwidefsky <[email protected] > 6+ */
7+
8+ #include <linux/percpu.h>
9+ #define CREATE_TRACE_POINTS
10+ #include <asm/trace/diag.h>
11+
12+ EXPORT_TRACEPOINT_SYMBOL (diagnose );
13+
14+ static DEFINE_PER_CPU (unsigned int , diagnose_trace_depth ) ;
15+
16+ void trace_diagnose_norecursion (int diag_nr )
17+ {
18+ unsigned long flags ;
19+ unsigned int * depth ;
20+
21+ local_irq_save (flags );
22+ depth = this_cpu_ptr (& diagnose_trace_depth );
23+ if (* depth == 0 ) {
24+ (* depth )++ ;
25+ trace_diagnose (diag_nr );
26+ (* depth )-- ;
27+ }
28+ local_irq_restore (flags );
29+ }
You can’t perform that action at this time.
0 commit comments