mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Howard Cochran <hcochran@kernelspring.com>
To: linux-kernel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Howard Cochran <cochran@lexmark.com>,
	Howard Cochran <hcochran@kernelspring.com>
Subject: [PATCH 3/5] tracing: Make traceon, traceoff trigger affect the correct instance
Date: Fri, 15 Apr 2016 02:53:48 -0400	[thread overview]
Message-ID: <1460703230-13307-4-git-send-email-hcochran@kernelspring.com> (raw)
In-Reply-To: <1460703230-13307-1-git-send-email-hcochran@kernelspring.com>

Currently, the traceon & traceoff triggers always enable or disable
tracing in the top level buffer, even if it was triggered within an
instance. Fixed by using the trace_array associated with the
trace_event_file which fired the trigger.

Signed-off-by: Howard Cochran <hcochran@kernelspring.com>
---
 kernel/trace/trace.c                |  6 +++---
 kernel/trace/trace.h                |  3 +++
 kernel/trace/trace_events_trigger.c | 16 ++++++++--------
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5541517..c78fe42 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -498,7 +498,7 @@ static inline void ftrace_trace_stack(struct trace_array *tr,
 
 #endif
 
-static void tracer_tracing_on(struct trace_array *tr)
+void tracer_tracing_on(struct trace_array *tr)
 {
 	if (tr->trace_buffer.buffer)
 		ring_buffer_record_on(tr->trace_buffer.buffer);
@@ -764,7 +764,7 @@ void tracing_snapshot_alloc(void)
 EXPORT_SYMBOL_GPL(tracing_snapshot_alloc);
 #endif /* CONFIG_TRACER_SNAPSHOT */
 
-static void tracer_tracing_off(struct trace_array *tr)
+void tracer_tracing_off(struct trace_array *tr)
 {
 	if (tr->trace_buffer.buffer)
 		ring_buffer_record_off(tr->trace_buffer.buffer);
@@ -807,7 +807,7 @@ void disable_trace_on_warning(void)
  *
  * Shows real state of the ring buffer if it is enabled or not.
  */
-static int tracer_tracing_is_on(struct trace_array *tr)
+int tracer_tracing_is_on(struct trace_array *tr)
 {
 	if (tr->trace_buffer.buffer)
 		return ring_buffer_record_is_on(tr->trace_buffer.buffer);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 00a5419..d3bc0e8 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -717,6 +717,9 @@ enum print_line_t print_trace_line(struct trace_iterator *iter);
 extern char trace_find_mark(unsigned long long duration);
 
 void __trace_dump_stack(int skip, struct trace_array *tr);
+int tracer_tracing_is_on(struct trace_array *tr);
+void tracer_tracing_on(struct trace_array *tr);
+void tracer_tracing_off(struct trace_array *tr);
 
 /* Standard output formatting function used for function return traces */
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index adfcd53..a73b823 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -768,17 +768,17 @@ static void
 traceon_trigger(struct event_trigger_data *data, void *rec,
 		struct trace_event_file *file)
 {
-	if (tracing_is_on())
+	if (tracer_tracing_is_on(file->tr))
 		return;
 
-	tracing_on();
+	tracer_tracing_on(file->tr);
 }
 
 static void
 traceon_count_trigger(struct event_trigger_data *data, void *rec,
 		      struct trace_event_file *file)
 {
-	if (tracing_is_on())
+	if (tracer_tracing_is_on(file->tr))
 		return;
 
 	if (!data->count)
@@ -787,24 +787,24 @@ traceon_count_trigger(struct event_trigger_data *data, void *rec,
 	if (data->count != -1)
 		(data->count)--;
 
-	tracing_on();
+	tracer_tracing_on(file->tr);
 }
 
 static void
 traceoff_trigger(struct event_trigger_data *data, void *rec,
 		 struct trace_event_file *file)
 {
-	if (!tracing_is_on())
+	if (!tracer_tracing_is_on(file->tr))
 		return;
 
-	tracing_off();
+	tracer_tracing_off(file->tr);
 }
 
 static void
 traceoff_count_trigger(struct event_trigger_data *data, void *rec,
 		       struct trace_event_file *file)
 {
-	if (!tracing_is_on())
+	if (!tracer_tracing_is_on(file->tr))
 		return;
 
 	if (!data->count)
@@ -813,7 +813,7 @@ traceoff_count_trigger(struct event_trigger_data *data, void *rec,
 	if (data->count != -1)
 		(data->count)--;
 
-	tracing_off();
+	tracer_tracing_off(file->tr);
 }
 
 static int
-- 
1.9.1

  parent reply	other threads:[~2016-04-15  6:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  6:53 [PATCHSET] tracing: Make event triggers affect " Howard Cochran
2016-04-15  6:53 ` [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances Howard Cochran
2016-04-15  7:10   ` kbuild test robot
2016-04-15  6:53 ` [PATCH 2/5] tracing: Make stacktrace trigger affect the correct instance Howard Cochran
2016-04-15  6:53 ` Howard Cochran [this message]
2016-04-15  6:53 ` [PATCH 4/5] tracing: Make snapshot " Howard Cochran
2016-04-15  6:53 ` [PATCH 5/5] tracing: Make internal_trace_puts() write to " Howard Cochran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460703230-13307-4-git-send-email-hcochran@kernelspring.com \
    --to=hcochran@kernelspring.com \
    --cc=cochran@lexmark.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®