blob: 11a669f3cc93c17d5f69f281296e04c2a39cc2bb [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +02002/*
3 * Tracepoint definitions for s390
4 *
5 * Copyright IBM Corp. 2015
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#include <linux/percpu.h>
10#define CREATE_TRACE_POINTS
11#include <asm/trace/diag.h>
12
Martin Schwidefsky230ccb32015-11-05 13:50:04 +010013EXPORT_TRACEPOINT_SYMBOL(s390_diagnose);
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020014
15static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);
16
Philipp Rudo8ebf6da2020-04-06 14:47:48 +020017void notrace trace_s390_diagnose_norecursion(int diag_nr)
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020018{
19 unsigned long flags;
20 unsigned int *depth;
21
Heiko Carstensf6c9b162016-02-10 14:13:24 +010022 /* Avoid lockdep recursion. */
23 if (IS_ENABLED(CONFIG_LOCKDEP))
24 return;
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020025 local_irq_save(flags);
26 depth = this_cpu_ptr(&diagnose_trace_depth);
27 if (*depth == 0) {
28 (*depth)++;
Martin Schwidefsky230ccb32015-11-05 13:50:04 +010029 trace_s390_diagnose(diag_nr);
Martin Schwidefskyb5a6b712015-08-21 16:05:32 +020030 (*depth)--;
31 }
32 local_irq_restore(flags);
33}