1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 2b5a6b71bSMartin Schwidefsky /* 3b5a6b71bSMartin Schwidefsky * Tracepoint definitions for s390 4b5a6b71bSMartin Schwidefsky * 5b5a6b71bSMartin Schwidefsky * Copyright IBM Corp. 2015 6b5a6b71bSMartin Schwidefsky * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 7b5a6b71bSMartin Schwidefsky */ 8b5a6b71bSMartin Schwidefsky 9b5a6b71bSMartin Schwidefsky #include <linux/percpu.h> 10b5a6b71bSMartin Schwidefsky #define CREATE_TRACE_POINTS 11b5a6b71bSMartin Schwidefsky #include <asm/trace/diag.h> 12b5a6b71bSMartin Schwidefsky 13230ccb37SMartin Schwidefsky EXPORT_TRACEPOINT_SYMBOL(s390_diagnose); 14b5a6b71bSMartin Schwidefsky 15b5a6b71bSMartin Schwidefsky static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth); 16b5a6b71bSMartin Schwidefsky trace_s390_diagnose_norecursion(int diag_nr)17*8ebf6da9SPhilipp Rudovoid notrace trace_s390_diagnose_norecursion(int diag_nr) 18b5a6b71bSMartin Schwidefsky { 19b5a6b71bSMartin Schwidefsky unsigned long flags; 20b5a6b71bSMartin Schwidefsky unsigned int *depth; 21b5a6b71bSMartin Schwidefsky 22f6c9b160SHeiko Carstens /* Avoid lockdep recursion. */ 23f6c9b160SHeiko Carstens if (IS_ENABLED(CONFIG_LOCKDEP)) 24f6c9b160SHeiko Carstens return; 25b5a6b71bSMartin Schwidefsky local_irq_save(flags); 26b5a6b71bSMartin Schwidefsky depth = this_cpu_ptr(&diagnose_trace_depth); 27b5a6b71bSMartin Schwidefsky if (*depth == 0) { 28b5a6b71bSMartin Schwidefsky (*depth)++; 29230ccb37SMartin Schwidefsky trace_s390_diagnose(diag_nr); 30b5a6b71bSMartin Schwidefsky (*depth)--; 31b5a6b71bSMartin Schwidefsky } 32b5a6b71bSMartin Schwidefsky local_irq_restore(flags); 33b5a6b71bSMartin Schwidefsky } 34