From: Steven Rostedt <rostedt@goodmis.org>
To: Pekka Paalanen <pq@iki.fi>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Mathieu Desnoyers <compudj@krystal.dyndns.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 6/6] ftrace: take advantage of variable length entries
Date: Tue, 30 Sep 2008 13:45:07 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.1.10.0809301341300.6224@gandalf.stny.rr.com> (raw)
In-Reply-To: <20080930203342.5b5ca814@daedalus.pq.iki.fi>
On Tue, 30 Sep 2008, Pekka Paalanen wrote:
> Hi Steven,
>
> This is great news. I have some questions below.
Thanks!
> On Mon, 29 Sep 2008 23:02:42 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > Now that the underlining ring buffer for ftrace now hold variable length
> > entries, we can take advantage of this by only storing the size of the
> > actual event into the buffer. This happens to increase the number of
> > entries in the buffer dramatically.
>
> I've read this paragraph over and over, and I can't really understand
> "only storing the size of the ... event". Maybe you are trying to say
> that now we are not consuming more ring space than the actual size of
> the event?
>
> Oh! I misunderstood also the last sentence, it's not generating extra
> entries but there is room for more entries than before.
Yeah, it means that we can now store more entries with the same space.
> >
> > @@ -71,10 +89,34 @@ struct stack_entry {
> > * ftrace_printk entry:
> > */
> > struct print_entry {
> > + struct trace_entry ent;
> > unsigned long ip;
> > char buf[];
> > };
> >
> > +#define TRACE_OLD_SIZE 88
>
> I'm just wondering, does this hold for both 32- and 64-bit kernels?
> Long type is quite common in the structs. I realize this is going
> away, so maybe it doesn't even matter.
I believe 88 was what I came up with on x86_64. It was just a size to
pick out of the blue and has no real meaning. I'm not sure anyone uses it
but before I hacked it away, I wanted to make sure.
> > -/*
> > - * The trace field - the most basic unit of tracing. This is what
> > - * is printed in the end as a single line in the trace output, such as:
> > - *
> > - * bash-15816 [01] 235.197585: idle_cpu <- irq_enter
> > - */
> > -struct trace_field {
> > - char cpu;
> > - char flags;
> > - char preempt_count;
> > - int pid;
> > - union {
> > - struct ftrace_entry fn;
> > - struct ctx_switch_entry ctx;
> > - struct special_entry special;
> > - struct stack_entry stack;
> > - struct print_entry print;
> > - struct mmiotrace_rw mmiorw;
> > - struct mmiotrace_map mmiomap;
> > - struct boot_trace initcall;
> > - };
> > -};
>
> Finally we get rid of the union :-)
Yeah, this is my favorite part of the patch.
> > ret = trace_seq_printf(s,
> > "R %d %lu.%06lu %d 0x%llx 0x%lx 0x%lx %d\n",
> > @@ -220,14 +222,14 @@ static int mmio_print_rw(struct trace_it
> > static int mmio_print_map(struct trace_iterator *iter)
> > {
> > struct trace_entry *entry = iter->ent;
> > - struct mmiotrace_map *m = &entry->field.mmiomap;
> > + struct mmiotrace_map *m = (struct mmiotrace_map *)entry;
>
> This is different style than above, missing the struct
> trace_mmiotrace_map intermediate step. Looks like a bug,
> since struct mmiotrace_map is not the first field in
> struct trace_mmiotrace_map.
Crap! yes this is a bug. Thanks for pointing this out.
> > @@ -252,7 +254,8 @@ static int mmio_print_map(struct trace_i
> > static int mmio_print_mark(struct trace_iterator *iter)
> > {
> > struct trace_entry *entry = iter->ent;
> > - const char *msg = entry->field.print.buf;
> > + struct print_entry *print = (struct print_entry *)entry;
> > + const char *msg = print->buf;
> > struct trace_seq *s = &iter->seq;
> > unsigned long long t = ns2usecs(iter->ts);
> > unsigned long usec_rem = do_div(t, 1000000ULL);
> > @@ -264,7 +267,7 @@ static int mmio_print_mark(struct trace_
> > if (!ret)
> > return 0;
> >
> > - if (entry->field.flags & TRACE_FLAG_CONT)
> > + if (entry->flags & TRACE_FLAG_CONT)
> > trace_seq_print_cont(s, iter);
>
> If we have variable length entries, doesn't that mean that
> print_entry::buf will always hold the full nil-terminated message,
> and that we could simply remove all the trace_seq_print_cont()
> calls?
>
> In fact, TRACE_FLAG_CONT will never be set. I didn't dig up the
> other patches to verify, but trace_vprintk() isn't setting it
> anymore.
This patch is bringing us to the stage to get rid of the CONT flag.
I kept this in just to not break more than I need to ;-)
> > @@ -336,7 +339,7 @@ static void __trace_mmiotrace_map(struct
> > struct mmiotrace_map *map)
> > {
> > struct ring_buffer_event *event;
> > - struct trace_entry *entry;
> > + struct trace_mmiotrace_map *entry;
> > unsigned long irq_flags;
> >
> > event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
> > @@ -344,9 +347,9 @@ static void __trace_mmiotrace_map(struct
> > if (!event)
> > return;
> > entry = ring_buffer_event_data(event);
> > - tracing_generic_entry_update(entry, 0);
> > - entry->type = TRACE_MMIO_MAP;
> > - entry->field.mmiomap = *map;
> > + tracing_generic_entry_update(&entry->ent, 0);
> > + entry->ent.type = TRACE_MMIO_MAP;
> > + entry->map = *map;
> > ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
> >
> > trace_wake_up();
>
> On the mmiotrace part, I don't see anything wrong here apart
> from that one bug.
Thanks, I'll add a patch to my coming queue to handle this.
-- Steve
next prev parent reply other threads:[~2008-09-30 17:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 3:02 [PATCH 0/6] ftrace: port to the new ring_buffer Steven Rostedt
2008-09-30 3:02 ` [PATCH 1/6] ftrace: give time for wakeup test to run Steven Rostedt
2008-09-30 3:02 ` [PATCH 2/6] Unified trace buffer Steven Rostedt
2008-09-30 9:45 ` Ingo Molnar
2008-09-30 11:53 ` Ingo Molnar
2008-09-30 12:06 ` Steven Rostedt
2008-09-30 3:02 ` [PATCH 3/6] ring_buffer: add paranoid check for buffer page Steven Rostedt
2008-09-30 3:02 ` [PATCH 4/6] ring_buffer: reset buffer page when freeing Steven Rostedt
2008-09-30 3:02 ` [PATCH 5/6] ftrace: make work with new ring buffer Steven Rostedt
2008-09-30 3:02 ` [PATCH 6/6] ftrace: take advantage of variable length entries Steven Rostedt
2008-09-30 17:33 ` Pekka Paalanen
2008-09-30 17:45 ` Steven Rostedt [this message]
2008-10-01 4:42 ` Steven Rostedt
2008-10-01 7:54 ` Ingo Molnar
2008-10-01 14:52 ` Steven Rostedt
2008-10-01 14:52 ` [PATCH] ftrace: type cast verifier Steven Rostedt
2008-10-01 17:42 ` Ingo Molnar
2008-10-01 17:47 ` Ingo Molnar
2008-09-30 7:45 ` [PATCH 0/6] ftrace: port to the new ring_buffer Ingo Molnar
2008-09-30 8:23 ` Ingo Molnar
2008-09-30 8:30 ` Ingo Molnar
2008-09-30 9:13 ` Ingo Molnar
2008-09-30 12:04 ` Steven Rostedt
2008-09-30 12:04 ` 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=alpine.DEB.1.10.0809301341300.6224@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=compudj@krystal.dyndns.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pq@iki.fi \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).