diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-02-23 06:10:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-11 10:55:52 -0400 |
commit | 53f2d02898755d1b24bde1975e202815d29fdb81 (patch) | |
tree | bf38d5ef64f046c552e94fc4ab360a5f833e1265 /include/ras | |
parent | 0bf09e829dd4b07227ed5a8bc4ac85752a044458 (diff) |
RAS: Add a tracepoint for reporting memory controller events
Add a new tracepoint-based hardware events report method for
reporting Memory Controller events.
Part of the description bellow is shamelessly copied from Tony
Luck's notes about the Hardware Error BoF during LPC 2010 [1].
Tony, thanks for your notes and discussions to generate the
h/w error reporting requirements.
[1] http://lwn.net/Articles/416669/
We have several subsystems & methods for reporting hardware errors:
1) EDAC ("Error Detection and Correction"). In its original form
this consisted of a platform specific driver that read topology
information and error counts from chipset registers and reported
the results via a sysfs interface.
2) mcelog - x86 specific decoding of machine check bank registers
reporting in binary form via /dev/mcelog. Recent additions make use
of the APEI extensions that were documented in version 4.0a of the
ACPI specification to acquire more information about errors without
having to rely reading chipset registers directly. A user level
programs decodes into somewhat human readable format.
3) drivers/edac/mce_amd.c - this driver hooks into the mcelog path and
decodes errors reported via machine check bank registers in AMD
processors to the console log using printk();
Each of these mechanisms has a band of followers ... and none
of them appear to meet all the needs of all users.
As part of a RAS subsystem, let's encapsulate the memory error hardware
events into a trace facility.
The tracepoint printk will be displayed like:
mc_event: [quant] (Corrected|Uncorrected|Fatal) error:[error msg] on [label] ([location] [edac_mc detail] [driver_detail]
Where:
[quant] is the quantity of errors
[error msg] is the driver-specific error message
(e. g. "memory read", "bus error", ...);
[location] is the location in terms of memory controller and
branch/channel/slot, channel/slot or csrow/channel;
[label] is the memory stick label;
[edac_mc detail] describes the address location of the error
and the syndrome;
[driver detail] is driver-specifig error message details,
when needed/provided (e. g. "area:DMA", ...)
For example:
mc_event: 1 Corrected error:memory read on memory stick DIMM_1A (mc:0 location:0:0:0 page:0x586b6e offset:0xa66 grain:32 syndrome:0x0 area:DMA)
Of course, any userspace tools meant to handle errors should not parse
the above data. They should, instead, use the binary fields provided by
the tracepoint, mapping them directly into their Management Information
Base.
NOTE: The original patch was providing an additional mechanism for
MCA-based trace events that also contained MCA error register data.
However, as no agreement was reached so far for the MCA-based trace
events, for now, let's add events only for memory errors.
A latter patch is planned to change the tracepoint, for those types
of event.
Cc: Aristeu Rozanski <arozansk@redhat.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/ras')
-rw-r--r-- | include/ras/ras_event.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h new file mode 100644 index 000000000000..260470e72483 --- /dev/null +++ b/include/ras/ras_event.h | |||
@@ -0,0 +1,102 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM ras | ||
3 | #define TRACE_INCLUDE_FILE ras_event | ||
4 | |||
5 | #if !defined(_TRACE_HW_EVENT_MC_H) || defined(TRACE_HEADER_MULTI_READ) | ||
6 | #define _TRACE_HW_EVENT_MC_H | ||
7 | |||
8 | #include <linux/tracepoint.h> | ||
9 | #include <linux/edac.h> | ||
10 | #include <linux/ktime.h> | ||
11 | |||
12 | /* | ||
13 | * Hardware Events Report | ||
14 | * | ||
15 | * Those events are generated when hardware detected a corrected or | ||
16 | * uncorrected event, and are meant to replace the current API to report | ||
17 | * errors defined on both EDAC and MCE subsystems. | ||
18 | * | ||
19 | * FIXME: Add events for handling memory errors originated from the | ||
20 | * MCE subsystem. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * Hardware-independent Memory Controller specific events | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * Default error mechanisms for Memory Controller errors (CE and UE) | ||
29 | */ | ||
30 | TRACE_EVENT(mc_event, | ||
31 | |||
32 | TP_PROTO(const unsigned int err_type, | ||
33 | const char *error_msg, | ||
34 | const char *label, | ||
35 | const int error_count, | ||
36 | const u8 mc_index, | ||
37 | const s8 top_layer, | ||
38 | const s8 mid_layer, | ||
39 | const s8 low_layer, | ||
40 | unsigned long address, | ||
41 | const u8 grain_bits, | ||
42 | unsigned long syndrome, | ||
43 | const char *driver_detail), | ||
44 | |||
45 | TP_ARGS(err_type, error_msg, label, error_count, mc_index, | ||
46 | top_layer, mid_layer, low_layer, address, grain_bits, | ||
47 | syndrome, driver_detail), | ||
48 | |||
49 | TP_STRUCT__entry( | ||
50 | __field( unsigned int, error_type ) | ||
51 | __string( msg, error_msg ) | ||
52 | __string( label, label ) | ||
53 | __field( u16, error_count ) | ||
54 | __field( u8, mc_index ) | ||
55 | __field( s8, top_layer ) | ||
56 | __field( s8, middle_layer ) | ||
57 | __field( s8, lower_layer ) | ||
58 | __field( long, address ) | ||
59 | __field( u8, grain_bits ) | ||
60 | __field( long, syndrome ) | ||
61 | __string( driver_detail, driver_detail ) | ||
62 | ), | ||
63 | |||
64 | TP_fast_assign( | ||
65 | __entry->error_type = err_type; | ||
66 | __assign_str(msg, error_msg); | ||
67 | __assign_str(label, label); | ||
68 | __entry->error_count = error_count; | ||
69 | __entry->mc_index = mc_index; | ||
70 | __entry->top_layer = top_layer; | ||
71 | __entry->middle_layer = mid_layer; | ||
72 | __entry->lower_layer = low_layer; | ||
73 | __entry->address = address; | ||
74 | __entry->grain_bits = grain_bits; | ||
75 | __entry->syndrome = syndrome; | ||
76 | __assign_str(driver_detail, driver_detail); | ||
77 | ), | ||
78 | |||
79 | TP_printk("%d %s error%s:%s%s on %s (mc:%d location:%d:%d:%d address:0x%08lx grain:%d syndrome:0x%08lx%s%s)", | ||
80 | __entry->error_count, | ||
81 | (__entry->error_type == HW_EVENT_ERR_CORRECTED) ? "Corrected" : | ||
82 | ((__entry->error_type == HW_EVENT_ERR_FATAL) ? | ||
83 | "Fatal" : "Uncorrected"), | ||
84 | __entry->error_count > 1 ? "s" : "", | ||
85 | ((char *)__get_str(msg))[0] ? " " : "", | ||
86 | __get_str(msg), | ||
87 | __get_str(label), | ||
88 | __entry->mc_index, | ||
89 | __entry->top_layer, | ||
90 | __entry->middle_layer, | ||
91 | __entry->lower_layer, | ||
92 | __entry->address, | ||
93 | 1 << __entry->grain_bits, | ||
94 | __entry->syndrome, | ||
95 | ((char *)__get_str(driver_detail))[0] ? " " : "", | ||
96 | __get_str(driver_detail)) | ||
97 | ); | ||
98 | |||
99 | #endif /* _TRACE_HW_EVENT_MC_H */ | ||
100 | |||
101 | /* This part must be outside protection */ | ||
102 | #include <trace/define_trace.h> | ||