Martin Schwidefsky | b5a6b71 | 2015-08-21 16:05:32 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Tracepoint definitions for s390 |
| 3 | * |
| 4 | * Copyright IBM Corp. 2015 |
| 5 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 6 | */ |
| 7 | |
| 8 | #include <linux/percpu.h> |
| 9 | #define CREATE_TRACE_POINTS |
| 10 | #include <asm/trace/diag.h> |
| 11 | |
Martin Schwidefsky | 230ccb3 | 2015-11-05 13:50:04 +0100 | [diff] [blame] | 12 | EXPORT_TRACEPOINT_SYMBOL(s390_diagnose); |
Martin Schwidefsky | b5a6b71 | 2015-08-21 16:05:32 +0200 | [diff] [blame] | 13 | |
| 14 | static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth); |
| 15 | |
Martin Schwidefsky | 230ccb3 | 2015-11-05 13:50:04 +0100 | [diff] [blame] | 16 | void trace_s390_diagnose_norecursion(int diag_nr) |
Martin Schwidefsky | b5a6b71 | 2015-08-21 16:05:32 +0200 | [diff] [blame] | 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)++; |
Martin Schwidefsky | 230ccb3 | 2015-11-05 13:50:04 +0100 | [diff] [blame] | 25 | trace_s390_diagnose(diag_nr); |
Martin Schwidefsky | b5a6b71 | 2015-08-21 16:05:32 +0200 | [diff] [blame] | 26 | (*depth)--; |
| 27 | } |
| 28 | local_irq_restore(flags); |
| 29 | } |