Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727836 > unrolled thread

[PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events

Started byJoel Fernandes <joelaf@google.com>
First post2017-09-07 02:20 +0200
Last post2017-09-11 00:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events Joel Fernandes <joelaf@google.com> - 2017-09-07 02:20 +0200
    Re: [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and  irq trace events Steven Rostedt <rostedt@goodmis.org> - 2017-09-10 11:20 +0200
      Re: [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and  irq trace events Joel Fernandes <joelaf@google.com> - 2017-09-11 00:30 +0200

#1727836 — [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events

FromJoel Fernandes <joelaf@google.com>
Date2017-09-07 02:20 +0200
Subject[PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events
Message-ID<umSI1-EN-11@gated-at.bofh.it>
In preparation of adding irqsoff and preemptsoff enable and disable trace
events, move required functions and code to make it easier to add these events
in a later patch. This patch is just code movement and adding a few wrappers,
no functional change.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-team@android.com
Signed-off-by: Joel Fernandes <joelaf@google.com>
---
 kernel/trace/trace_irqsoff.c | 123 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 93 insertions(+), 30 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 7758bc0617cb..38d65a0535e0 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -16,6 +16,7 @@
 
 #include "trace.h"
 
+#if defined(CONFIG_IRQSOFF_TRACER) || defined(CONFIG_PREEMPT_TRACER)
 static struct trace_array		*irqsoff_trace __read_mostly;
 static int				tracer_enabled __read_mostly;
 
@@ -432,19 +433,17 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
 }
 
 /* start and stop critical timings used to for stoppage (in idle) */
-void start_critical_timings(void)
+static inline void start_critical_timings_tracer(void)
 {
 	if (preempt_trace() || irq_trace())
 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
-EXPORT_SYMBOL_GPL(start_critical_timings);
 
-void stop_critical_timings(void)
+static inline void stop_critical_timings_tracer(void)
 {
 	if (preempt_trace() || irq_trace())
 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
-EXPORT_SYMBOL_GPL(stop_critical_timings);
 
 #ifdef CONFIG_IRQSOFF_TRACER
 #ifdef CONFIG_PROVE_LOCKING
@@ -462,64 +461,44 @@ void time_hardirqs_off(unsigned long a0, unsigned long a1)
 
 #else /* !CONFIG_PROVE_LOCKING */
 
-/*
- * Stubs:
- */
-
-void trace_softirqs_on(unsigned long ip)
-{
-}
-
-void trace_softirqs_off(unsigned long ip)
-{
-}
-
-inline void print_irqtrace_events(struct task_struct *curr)
-{
-}
-
 /*
  * We are only interested in hardirq on/off events:
  */
-void trace_hardirqs_on(void)
+static inline void tracer_hardirqs_on(void)
 {
 	if (!preempt_trace() && irq_trace())
 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
-EXPORT_SYMBOL(trace_hardirqs_on);
 
-void trace_hardirqs_off(void)
+static inline void tracer_hardirqs_off(void)
 {
 	if (!preempt_trace() && irq_trace())
 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
-EXPORT_SYMBOL(trace_hardirqs_off);
 
-__visible void trace_hardirqs_on_caller(unsigned long caller_addr)
+static inline void tracer_hardirqs_on_caller(unsigned long caller_addr)
 {
 	if (!preempt_trace() && irq_trace())
 		stop_critical_timing(CALLER_ADDR0, caller_addr);
 }
-EXPORT_SYMBOL(trace_hardirqs_on_caller);
 
-__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
+static inline void tracer_hardirqs_off_caller(unsigned long caller_addr)
 {
 	if (!preempt_trace() && irq_trace())
 		start_critical_timing(CALLER_ADDR0, caller_addr);
 }
-EXPORT_SYMBOL(trace_hardirqs_off_caller);
 
 #endif /* CONFIG_PROVE_LOCKING */
 #endif /*  CONFIG_IRQSOFF_TRACER */
 
 #ifdef CONFIG_PREEMPT_TRACER
-void trace_preempt_on(unsigned long a0, unsigned long a1)
+static inline void tracer_preempt_on(unsigned long a0, unsigned long a1)
 {
 	if (preempt_trace() && !irq_trace())
 		stop_critical_timing(a0, a1);
 }
 
-void trace_preempt_off(unsigned long a0, unsigned long a1)
+static inline void tracer_preempt_off(unsigned long a0, unsigned long a1)
 {
 	if (preempt_trace() && !irq_trace())
 		start_critical_timing(a0, a1);
@@ -781,3 +760,87 @@ __init static int init_irqsoff_tracer(void)
 	return 0;
 }
 core_initcall(init_irqsoff_tracer);
+#else /* IRQSOFF_TRACER || PREEMPTOFF_TRACER */
+
+#define start_critical_timings_tracer() do { } while (0)
+#define stop_critical_timings_tracer() do { } while (0)
+
+#endif
+
+#ifndef CONFIG_IRQSOFF_TRACER
+#define tracer_hardirqs_on() do { } while (0)
+#define tracer_hardirqs_off() do { } while (0)
+#define tracer_hardirqs_on_caller(x) do { } while (0)
+#define tracer_hardirqs_off_caller(x) do { } while (0)
+#endif
+
+#ifndef CONFIG_PREEMPT_TRACER
+#define tracer_preempt_on(x, y) do { } while (0)
+#define tracer_preempt_off(x, y) do { } while (0)
+#endif
+
+void start_critical_timings(void)
+{
+	start_critical_timings_tracer();
+}
+EXPORT_SYMBOL_GPL(start_critical_timings);
+
+void stop_critical_timings(void)
+{
+	stop_critical_timings_tracer();
+}
+EXPORT_SYMBOL_GPL(stop_critical_timings);
+
+#if defined(CONFIG_TRACE_IRQFLAGS) && !defined(CONFIG_PROVE_LOCKING)
+void trace_hardirqs_on(void)
+{
+	tracer_hardirqs_on();
+}
+EXPORT_SYMBOL(trace_hardirqs_on);
+
+void trace_hardirqs_off(void)
+{
+	tracer_hardirqs_off();
+}
+EXPORT_SYMBOL(trace_hardirqs_off);
+
+__visible void trace_hardirqs_on_caller(unsigned long caller_addr)
+{
+	tracer_hardirqs_on_caller(caller_addr);
+}
+EXPORT_SYMBOL(trace_hardirqs_on_caller);
+
+__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
+{
+	tracer_hardirqs_off_caller(caller_addr);
+}
+EXPORT_SYMBOL(trace_hardirqs_off_caller);
+
+/*
+ * Stubs:
+ */
+
+void trace_softirqs_on(unsigned long ip)
+{
+}
+
+void trace_softirqs_off(unsigned long ip)
+{
+}
+
+inline void print_irqtrace_events(struct task_struct *curr)
+{
+}
+#endif
+
+#ifdef CONFIG_PREEMPT_TRACER
+void trace_preempt_on(unsigned long a0, unsigned long a1)
+{
+	tracer_preempt_on(a0, a1);
+}
+
+void trace_preempt_off(unsigned long a0, unsigned long a1)
+{
+	tracer_preempt_off(a0, a1);
+}
+#endif
-- 
2.14.1.581.gf28d330327-goog

[toc] | [next] | [standalone]


#1729943 — Re: [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-09-10 11:20 +0200
SubjectRe: [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events
Message-ID<uo6zg-1DD-5@gated-at.bofh.it>
In reply to#1727836
On Wed,  6 Sep 2017 17:17:50 -0700
Joel Fernandes <joelaf@google.com> wrote:


> +#else /* IRQSOFF_TRACER || PREEMPTOFF_TRACER */
> +
> +#define start_critical_timings_tracer() do { } while (0)
> +#define stop_critical_timings_tracer() do { } while (0)
> +
> +#endif
> +
> +#ifndef CONFIG_IRQSOFF_TRACER
> +#define tracer_hardirqs_on() do { } while (0)
> +#define tracer_hardirqs_off() do { } while (0)
> +#define tracer_hardirqs_on_caller(x) do { } while (0)
> +#define tracer_hardirqs_off_caller(x) do { } while (0)
> +#endif
> +
> +#ifndef CONFIG_PREEMPT_TRACER
> +#define tracer_preempt_on(x, y) do { } while (0)
> +#define tracer_preempt_off(x, y) do { } while (0)
> +#endif

Is there a reason the above is #define and not static inline? The
preferred method is static inline as that allows the compiler to check
types. #define is used if one of the parameters has a struct or
something that is not defined.

-- Steve

[toc] | [prev] | [next] | [standalone]


#1730078 — Re: [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events

FromJoel Fernandes <joelaf@google.com>
Date2017-09-11 00:30 +0200
SubjectRe: [PATCH RFC v4 1/3] tracing/irqsoff: Prepare to add preempt and irq trace events
Message-ID<uoiTM-1VD-7@gated-at.bofh.it>
In reply to#1729943
Hi Steven,

On Sun, Sep 10, 2017 at 2:06 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed,  6 Sep 2017 17:17:50 -0700
> Joel Fernandes <joelaf@google.com> wrote:
>
>
>> +#else /* IRQSOFF_TRACER || PREEMPTOFF_TRACER */
>> +
>> +#define start_critical_timings_tracer() do { } while (0)
>> +#define stop_critical_timings_tracer() do { } while (0)
>> +
>> +#endif
>> +
>> +#ifndef CONFIG_IRQSOFF_TRACER
>> +#define tracer_hardirqs_on() do { } while (0)
>> +#define tracer_hardirqs_off() do { } while (0)
>> +#define tracer_hardirqs_on_caller(x) do { } while (0)
>> +#define tracer_hardirqs_off_caller(x) do { } while (0)
>> +#endif
>> +
>> +#ifndef CONFIG_PREEMPT_TRACER
>> +#define tracer_preempt_on(x, y) do { } while (0)
>> +#define tracer_preempt_off(x, y) do { } while (0)
>> +#endif
>
> Is there a reason the above is #define and not static inline? The
> preferred method is static inline as that allows the compiler to check
> types. #define is used if one of the parameters has a struct or
> something that is not defined.

Sure, I'll make use of static inline in the next version. thanks!

-Joel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web