1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Declarations for error reporting tracepoints.
5 * Copyright (C) 2021, Google LLC.
8 #define TRACE_SYSTEM error_report
10 #if !defined(_TRACE_ERROR_REPORT_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_ERROR_REPORT_H
13 #include <linux/tracepoint.h>
15 #ifndef __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY
16 #define __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY
19 ERROR_DETECTOR_KFENCE
,
24 #endif /* __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY */
26 #define error_detector_list \
27 EM(ERROR_DETECTOR_KFENCE, "kfence") \
28 EM(ERROR_DETECTOR_KASAN, "kasan") \
29 EMe(ERROR_DETECTOR_WARN, "warning")
30 /* Always end the list with an EMe. */
35 #define EM(a, b) TRACE_DEFINE_ENUM(a);
36 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
43 #define EM(a, b) { a, b },
44 #define EMe(a, b) { a, b }
46 #define show_error_detector_list(val) \
47 __print_symbolic(val, error_detector_list)
49 DECLARE_EVENT_CLASS(error_report_template
,
50 TP_PROTO(enum error_detector error_detector
, unsigned long id
),
51 TP_ARGS(error_detector
, id
),
52 TP_STRUCT__entry(__field(enum error_detector
, error_detector
)
53 __field(unsigned long, id
)),
54 TP_fast_assign(__entry
->error_detector
= error_detector
;
57 show_error_detector_list(__entry
->error_detector
),
61 * error_report_end - called after printing the error report
62 * @error_detector: short string describing the error detection tool
63 * @id: pseudo-unique descriptor identifying the report
64 * (e.g. the memory access address)
66 * This event occurs right after a debugging tool finishes printing the error
69 DEFINE_EVENT(error_report_template
, error_report_end
,
70 TP_PROTO(enum error_detector error_detector
, unsigned long id
),
71 TP_ARGS(error_detector
, id
));
73 #endif /* _TRACE_ERROR_REPORT_H */
75 /* This part must be outside protection */
76 #include <trace/define_trace.h>