mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Pekka Paalanen <pq@iki.fi>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	akpm@osdl.org, Peter Zijlstra <peterz@infradead.org>,
	Soeren Sandmann Pedersen <sandmann@redhat.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 1/3] ftrace: add logic to record overruns
Date: Mon, 28 Apr 2008 09:13:48 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0804280909250.813@gandalf.stny.rr.com> (raw)
In-Reply-To: <20080426234713.4a49373d@daedalus.pq.iki.fi>


On Sat, 26 Apr 2008, Pekka Paalanen wrote:

> On Mon, 21 Apr 2008 17:09:36 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> ....
> > @@ -2510,6 +2511,11 @@ tracing_read_pipe(struct file *filp, cha
> >  	for_each_cpu_mask(cpu, mask) {
> >  		data = iter->tr->data[cpu];
> >  		__raw_spin_lock(&data->lock);
> > +
> > +		if (data->overrun > iter->last_overrun[cpu])
> > +			iter->overrun[cpu] +=
> > +				data->overrun - iter->last_overrun[cpu];
> > +		iter->last_overrun[cpu] = data->overrun;
>
> Option 1: move this code earlier.
> (Could also remove the `if' and make it unconditional.)

I'll move it. The condition was there because I could have sworn that
there's some way (perhaps just via an error) that lastrun could be greater
than the overrun. But perhaps it doesn't matter.

> > +++ linux-sched-devel.git/kernel/trace/trace.h	2008-04-21 14:38:09.000000000 -0400
> > @@ -102,6 +102,7 @@ struct trace_array_cpu {
> >  	void			*trace_head; /* producer */
> >  	void			*trace_tail; /* consumer */
> >  	unsigned long		trace_idx;
> > +	unsigned long		overrun;
>
> Option 2: Change this into atomic_t.

I could do that too.

> >   * results to users and which routines might sleep, etc:
> >   */
> >  struct trace_iterator {
> > -	struct trace_seq	seq;
> >  	struct trace_array	*tr;
> >  	struct tracer		*trace;
> > +	long			last_overrun[NR_CPUS];
> > +	long			overrun[NR_CPUS];
>
> The problem with these fields is that they are updated only after the read
> hook has been called in tracing_read_pipe(), which means all "N events
> lost!" entries will be one read call behind. This can be any number of
> events.
>
> If trace_array_cpu::overrun was atomic_t, I could process that in
> the read callback. But, trace_iterator::overrun would be good, because
> I could just reset it to zero every time I encounter a non-zero value.
>
> I can think of two options, the ones noted above: moving the update
> earlier, or using atomic_t. Or maybe do both, so that we don't have to
> lock the trace_array_cpu structs early and also avoid duplicating the
> overrun/last_overrun logic in a tracer.
>
> What shall we do?

I think you're right that we should move it before calling the read hook.
I didn't want to make the one value atomic because that would just add
another atomic operation in a fast path. I may wait on making that atomic.

-- Steve


  reply	other threads:[~2008-04-28 13:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-21 21:09 [PATCH 0/3] ftrace: overrun accounting and trace_pipe headers Steven Rostedt
2008-04-21 21:09 ` [PATCH 1/3] ftrace: add logic to record overruns Steven Rostedt
2008-04-26 20:47   ` Pekka Paalanen
2008-04-28 13:13     ` Steven Rostedt [this message]
2008-04-21 21:09 ` [PATCH 2/3] ftrace: add trace pipe header pluggin Steven Rostedt
2008-04-26 17:33   ` Pekka Paalanen
2008-04-28 13:05     ` Steven Rostedt
2008-04-21 21:09 ` [PATCH 3/3] TEST PATCH - ftrace example patch for use of trace pipe headers Steven Rostedt
2008-04-22 13:33 ` [PATCH 0/3] ftrace: overrun accounting and trace_pipe headers Ingo Molnar
2008-04-22 17:36 ` Pekka Paalanen
2008-04-23  0:58   ` Steven Rostedt

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=Pine.LNX.4.58.0804280909250.813@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=pq@iki.fi \
    --cc=sandmann@redhat.com \
    --cc=srostedt@redhat.com \
    /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®