Re: [PATCH 5/7 v6] trace, RAS: Add eMCA trace event interface

From: Steven Rostedt
Date: Tue Jun 03 2014 - 10:35:53 EST


On Tue, 3 Jun 2014 04:36:07 -0400
"Chen, Gong" <gong.chen@xxxxxxxxxxxxxxx> wrote:

> On Mon, Jun 02, 2014 at 12:57:48PM -0400, Steven Rostedt wrote:
> > Also matters how big you expect these events to be. If you get a
> > "christmas tree" set of flags, how big will that event grow with all
> > the descriptions attached?
> >
> > The max event size after all headers is 4056 bytes. If you go over
> > that, the event is ignored.
> >
> Hi, Steven
>
> Normally, the length of one eMCA trace record is between 200 and 256 bytes.
> Once CMCI storm happens, before it is turned into poll mode, there are
> about ~15 CMCI events are recorded, because I don't use rate limit for
> trace so they should be recorded so seriously, some records will be lost.
> But they are repeated and similar records so maybe the *lost* is not a
> big issue.
>
> Return to how to print trace record. To avoid buffer waste, I need to
> print data when TP_printk called, in the meanwhile, the print content
> is an array of [name, value], but we don't know how many items are
> valid. Here is the question: I can't create a dynamic printk format
> like "%s %d, %s %d, ..." in TP_printk. So the only way to me is
> printking them all, even some of them are invalid, which means an 12
> group "%s %d", or somthing like "%.*s" to make output format graceful.
> This is what we want?

You can create a helper function to call (needs to be placed in a .c
file).

Note, there's a pointer to a trace_seq structure "p" that is available.
Hmm, I should add a get_dynamic_array_len(field), to give you the
length. I'll add that now. I also don't like the trace_seq being "p" as
that is too generic. Maybe I'll change that to "__trace_seq" or
something not so generic.


Anyway, have something like this:


TP_printk("%s", emca_parse_events(p, __get_dynamic_array(field),
__get_dynamic_array_len(field)));

I'll still need to add that __get_dynamic_array_len() helper. I'll send
you something tonight.

Then you write the emca_parse_events() as:


const char *emca_parse_events(struct trace_seq *p,
struct cper_sec_mem_rec *data, int len)
{
const char *ret = p->buffer + p->len;
int i;

len = len / sizeof(struct cper_sec_mem_rec);
for (i = 0; i < len; i++) {
switch (data[i].type) {
case FOO:
trace_seq_printf(p, "BAR: %d\n", data[i].data);
break;
[..]
}
}
trace_seq_putc('\0');

return ret;
}

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/