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


Groups > linux.kernel > #1441406 > unrolled thread

[PATCH RT 3/5] trace: correct off by one while recording the trace-event

Started bySteven Rostedt <rostedt@goodmis.org>
First post2016-07-12 16:30 +0200
Last post2016-07-12 16:50 +0200
Articles 4 — 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 RT 3/5] trace: correct off by one while recording the trace-event Steven Rostedt <rostedt@goodmis.org> - 2016-07-12 16:30 +0200
    Re: [PATCH RT 3/5] trace: correct off by one while recording the  trace-event Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-07-12 16:50 +0200
      Re: [PATCH RT 3/5] trace: correct off by one while recording the  trace-event Steven Rostedt <rostedt@goodmis.org> - 2016-07-12 16:50 +0200
      Re: [PATCH RT 3/5] trace: correct off by one while recording the  trace-event Steven Rostedt <rostedt@goodmis.org> - 2016-07-12 16:50 +0200

#1441406 — [PATCH RT 3/5] trace: correct off by one while recording the trace-event

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-07-12 16:30 +0200
Subject[PATCH RT 3/5] trace: correct off by one while recording the trace-event
Message-ID<rU6Rc-66R-19@gated-at.bofh.it>
4.4.12-rt20-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Trace events like raw_syscalls show always a preempt code of one. The
reason is that on PREEMPT kernels rcu_read_lock_sched_notrace()
increases the preemption counter and the function recording the counter
is caller within the RCU section.

Cc: stable-rt@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
[ Changed this to upstream version. See commit e947841c0dce ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_events.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 4a48f97a2256..5bd79b347398 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -246,6 +246,14 @@ void *trace_event_buffer_reserve(struct trace_event_buffer *fbuffer,
 
 	local_save_flags(fbuffer->flags);
 	fbuffer->pc = preempt_count();
+	/*
+	 * If CONFIG_PREEMPT is enabled, then the tracepoint itself disables
+	 * preemption (adding one to the preempt_count). Since we are
+	 * interested in the preempt_count at the time the tracepoint was
+	 * hit, we need to subtract one to offset the increment.
+	 */
+	if (IS_ENABLED(CONFIG_PREEMPT))
+		fbuffer->pc--;
 	fbuffer->trace_file = trace_file;
 
 	fbuffer->event =
-- 
2.8.1

[toc] | [next] | [standalone]


#1441463 — Re: [PATCH RT 3/5] trace: correct off by one while recording the trace-event

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-07-12 16:50 +0200
SubjectRe: [PATCH RT 3/5] trace: correct off by one while recording the trace-event
Message-ID<rU7ax-6ed-9@gated-at.bofh.it>
In reply to#1441406
* Steven Rostedt | 2016-07-12 10:21:56 [-0400]:

>From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
…
>Cc: stable-rt@vger.kernel.org
>Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>[ Changed this to upstream version. See commit e947841c0dce ]
>Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

I am not the Author of this commit (and it is not yet in TIP). I haven't
had the chance (yet) to test this and check if it breaks / works so I
did not yet respond to your patch.

Assuming this behaves equally I don't mind a diffent patch in stable vs
the devel tree (and I hope to test this & get into the devel tree
within this week).

Sebastian

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


#1441465 — Re: [PATCH RT 3/5] trace: correct off by one while recording the trace-event

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-07-12 16:50 +0200
SubjectRe: [PATCH RT 3/5] trace: correct off by one while recording the trace-event
Message-ID<rU7ay-6ed-31@gated-at.bofh.it>
In reply to#1441463
On Tue, 12 Jul 2016 10:45:55 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 12 Jul 2016 16:40:50 +0200
> Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> > I am not the Author of this commit (and it is not yet in TIP). I haven't

Oh, I forgot to add, I don't go through the tip tree.

-- Steve

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


#1441466 — Re: [PATCH RT 3/5] trace: correct off by one while recording the trace-event

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-07-12 16:50 +0200
SubjectRe: [PATCH RT 3/5] trace: correct off by one while recording the trace-event
Message-ID<rU7ay-6ed-25@gated-at.bofh.it>
In reply to#1441463
On Tue, 12 Jul 2016 16:40:50 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> * Steven Rostedt | 2016-07-12 10:21:56 [-0400]:
> 
> >From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>  
> …
> >Cc: stable-rt@vger.kernel.org
> >Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> >[ Changed this to upstream version. See commit e947841c0dce ]
> >Signed-off-by: Steven Rostedt <rostedt@goodmis.org>  
> 
> I am not the Author of this commit (and it is not yet in TIP). I haven't
> had the chance (yet) to test this and check if it breaks / works so I
> did not yet respond to your patch.

That's why I added the "Changed this to upstream version".

> 
> Assuming this behaves equally I don't mind a diffent patch in stable vs
> the devel tree (and I hope to test this & get into the devel tree
> within this week).

This is what's going into mainline. See commit e947841c0dce in
linux-next.

-- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web