blob: dde7654f5c68e5d117d3493d9c0f130f2e24e830 [file] [log] [blame]
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +02001/*
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 Schwidefsky230ccb32015-11-05 13:50:04 +010012EXPORT_TRACEPOINT_SYMBOL(s390_diagnose);
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020013
14static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);
15
Martin Schwidefsky230ccb32015-11-05 13:50:04 +010016void trace_s390_diagnose_norecursion(int diag_nr)
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020017{
18 unsigned long flags;
19 unsigned int *depth;
20
Heiko Carstensf6c9b162016-02-10 14:13:24 +010021 /* Avoid lockdep recursion. */
22 if (IS_ENABLED(CONFIG_LOCKDEP))
23 return;
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020024 local_irq_save(flags);
25 depth = this_cpu_ptr(&diagnose_trace_depth);
26 if (*depth == 0) {
27 (*depth)++;
Martin Schwidefsky230ccb32015-11-05 13:50:04 +010028 trace_s390_diagnose(diag_nr);
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020029 (*depth)--;
30 }
31 local_irq_restore(flags);
32}