File tree Expand file tree Collapse file tree 4 files changed +45
-5
lines changed Expand file tree Collapse file tree 4 files changed +45
-5
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
5151obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
5252obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
5353
54+ obj-$(CONFIG_TRACE_IRQFLAGS) += trace_irq.o
55+
5456obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o
5557obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
5658obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ _save_context:
108108.option pop
109109
110110#ifdef CONFIG_TRACE_IRQFLAGS
111- call trace_hardirqs_off
111+ call __trace_hardirqs_off
112112#endif
113113
114114#ifdef CONFIG_CONTEXT_TRACKING
@@ -143,7 +143,7 @@ skip_context_tracking:
143143 li t0, EXC_BREAKPOINT
144144 beq s4 , t0, 1f
145145#ifdef CONFIG_TRACE_IRQFLAGS
146- call trace_hardirqs_on
146+ call __trace_hardirqs_on
147147#endif
148148 csrs CSR_STATUS, SR_IE
149149
@@ -234,7 +234,7 @@ ret_from_exception:
234234 REG_L s0, PT_STATUS(sp )
235235 csrc CSR_STATUS, SR_IE
236236#ifdef CONFIG_TRACE_IRQFLAGS
237- call trace_hardirqs_off
237+ call __trace_hardirqs_off
238238#endif
239239#ifdef CONFIG_RISCV_M_MODE
240240 /* the MPP value is too large to be used as an immediate arg for addi */
@@ -270,10 +270,10 @@ restore_all:
270270 REG_L s1, PT_STATUS(sp )
271271 andi t0, s1, SR_PIE
272272 beqz t0, 1f
273- call trace_hardirqs_on
273+ call __trace_hardirqs_on
274274 j 2f
2752751 :
276- call trace_hardirqs_off
276+ call __trace_hardirqs_off
2772772 :
278278#endif
279279 REG_L a0 , PT_STATUS(sp )
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+ /*
3+ * Copyright (C) 2022 Changbin Du <[email protected] > 4+ */
5+
6+ #include <linux/irqflags.h>
7+ #include <linux/kprobes.h>
8+ #include "trace_irq.h"
9+
10+ /*
11+ * trace_hardirqs_on/off require the caller to setup frame pointer properly.
12+ * Otherwise, CALLER_ADDR1 might trigger an pagging exception in kernel.
13+ * Here we add one extra level so they can be safely called by low
14+ * level entry code which $fp is used for other purpose.
15+ */
16+
17+ void __trace_hardirqs_on (void )
18+ {
19+ trace_hardirqs_on ();
20+ }
21+ NOKPROBE_SYMBOL (__trace_hardirqs_on );
22+
23+ void __trace_hardirqs_off (void )
24+ {
25+ trace_hardirqs_off ();
26+ }
27+ NOKPROBE_SYMBOL (__trace_hardirqs_off );
Original file line number Diff line number Diff line change 1+ /* SPDX-License-Identifier: GPL-2.0 */
2+ /*
3+ * Copyright (C) 2022 Changbin Du <[email protected] > 4+ */
5+ #ifndef __TRACE_IRQ_H
6+ #define __TRACE_IRQ_H
7+
8+ void __trace_hardirqs_on (void );
9+ void __trace_hardirqs_off (void );
10+
11+ #endif /* __TRACE_IRQ_H */
You can’t perform that action at this time.
0 commit comments