trace.c 707 B

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