Re: [PATCH v22] edac, ras/hw_event.h: use events to handle hw issues

From: Steven Rostedt
Date: Wed May 16 2012 - 08:48:12 EST


On Tue, 2012-05-15 at 18:38 +0200, Borislav Petkov wrote:
> On Tue, May 15, 2012 at 01:05:48PM -0300, Mauro Carvalho Chehab wrote:
> > > Here's what an error looks like on my system here:
> > >
> > > mcegen.py-2868 [007] .N.. 178.261607: mc_event: Corrected error:amd64_edac on memory stick "unknown memory" (mc:0 csrow:3 channel:1 page:0x5bac7 offset:0x388 grain:0 syndrome:0x34ed )
> > >
> > > There's still this trailing " " at the end of the error line which
> > > shouldn't be there and also two spaces between "channel" and "page".
> >
> > If you take a look at the trace printk:
> >
> > + TP_printk("%s error:%s on memory stick \"%s\" (mc:%d %s %s %s)",
> > + (__entry->err_type == HW_EVENT_ERR_CORRECTED) ? "Corrected" :
> > + ((__entry->err_type == HW_EVENT_ERR_FATAL) ?
> > +
> > + __get_str(msg),
> > + __get_str(label),
> > + __entry->mc_index,
> > + __get_str(location),
> > + __get_str(detail),
> > + __get_str(driver_detail))
> >
> > There are not extra spaces there. The first extra space is probably because
> > there is an extra space at the label string. This should be easy to fix.
> >
> > The other extra space at the end is because amd64 currently doesn't provide
> > driver_detail information.
>
> Remind me again why do we need two strings: detail and driver_detail?
>
> Because they could very well be lumped together with a single "%s"
> format - "(mc:%d %s)" - and be printed.
>
> And detail will always contain something which is not the empty string,
> so problem solved.

Here's another trick if you want to get rid of the space and keep both
fields:

TP_printk("%s error:%s on memory stick \"%s\" (mc:%d %s %s%s%s)",
(__entry->err_type == HW_EVENT_ERR_CORRECTED) ? "Corrected" :
((__entry->err_type == HW_EVENT_ERR_FATAL) ?
"Fatal" : "Uncorrected"),

__get_str(msg),
__get_str(label),
__entry->mc_index,
__get_str(location),
__get_str(detail),
strlen(__get_str(detail)) &&
strlen(__get_str(driver_detail) ? " ": "",
__get_str(driver_detail))

-- 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/