~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/trace/trace_preemptirq.c

Version: ~ [ linux-6.0-rc1 ] ~ [ linux-5.19.1 ] ~ [ linux-5.18.17 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.60 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.136 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.210 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.255 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.290 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.325 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * preemptoff and irqoff tracepoints
  4  *
  5  * Copyright (C) Joel Fernandes (Google) <joel@joelfernandes.org>
  6  */
  7 
  8 #include <linux/kallsyms.h>
  9 #include <linux/uaccess.h>
 10 #include <linux/module.h>
 11 #include <linux/ftrace.h>
 12 #include <linux/kprobes.h>
 13 #include "trace.h"
 14 
 15 #define CREATE_TRACE_POINTS
 16 #include <trace/events/preemptirq.h>
 17 
 18 #ifdef CONFIG_TRACE_IRQFLAGS
 19 /* Per-cpu variable to prevent redundant calls when IRQs already off */
 20 static DEFINE_PER_CPU(int, tracing_irq_cpu);
 21 
 22 void trace_hardirqs_on(void)
 23 {
 24         if (this_cpu_read(tracing_irq_cpu)) {
 25                 if (!in_nmi())
 26                         trace_irq_enable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
 27                 tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
 28                 this_cpu_write(tracing_irq_cpu, 0);
 29         }
 30 
 31         lockdep_hardirqs_on(CALLER_ADDR0);
 32 }
 33 EXPORT_SYMBOL(trace_hardirqs_on);
 34 NOKPROBE_SYMBOL(trace_hardirqs_on);
 35 
 36 void trace_hardirqs_off(void)
 37 {
 38         if (!this_cpu_read(tracing_irq_cpu)) {
 39                 this_cpu_write(tracing_irq_cpu, 1);
 40                 tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
 41                 if (!in_nmi())
 42                         trace_irq_disable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
 43         }
 44 
 45         lockdep_hardirqs_off(CALLER_ADDR0);
 46 }
 47 EXPORT_SYMBOL(trace_hardirqs_off);
 48 NOKPROBE_SYMBOL(trace_hardirqs_off);
 49 
 50 __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
 51 {
 52         if (this_cpu_read(tracing_irq_cpu)) {
 53                 if (!in_nmi())
 54                         trace_irq_enable_rcuidle(CALLER_ADDR0, caller_addr);
 55                 tracer_hardirqs_on(CALLER_ADDR0, caller_addr);
 56                 this_cpu_write(tracing_irq_cpu, 0);
 57         }
 58 
 59         lockdep_hardirqs_on(CALLER_ADDR0);
 60 }
 61 EXPORT_SYMBOL(trace_hardirqs_on_caller);
 62 NOKPROBE_SYMBOL(trace_hardirqs_on_caller);
 63 
 64 __visible void trace_hardirqs_off_caller(unsigned long caller_addr)
 65 {
 66         if (!this_cpu_read(tracing_irq_cpu)) {
 67                 this_cpu_write(tracing_irq_cpu, 1);
 68                 tracer_hardirqs_off(CALLER_ADDR0, caller_addr);
 69                 if (!in_nmi())
 70                         trace_irq_disable_rcuidle(CALLER_ADDR0, caller_addr);
 71         }
 72 
 73         lockdep_hardirqs_off(CALLER_ADDR0);
 74 }
 75 EXPORT_SYMBOL(trace_hardirqs_off_caller);
 76 NOKPROBE_SYMBOL(trace_hardirqs_off_caller);
 77 #endif /* CONFIG_TRACE_IRQFLAGS */
 78 
 79 #ifdef CONFIG_TRACE_PREEMPT_TOGGLE
 80 
 81 void trace_preempt_on(unsigned long a0, unsigned long a1)
 82 {
 83         if (!in_nmi())
 84                 trace_preempt_enable_rcuidle(a0, a1);
 85         tracer_preempt_on(a0, a1);
 86 }
 87 
 88 void trace_preempt_off(unsigned long a0, unsigned long a1)
 89 {
 90         if (!in_nmi())
 91                 trace_preempt_disable_rcuidle(a0, a1);
 92         tracer_preempt_off(a0, a1);
 93 }
 94 #endif
 95 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp