at v5.13-rc7 74 lines 2.1 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Declarations for error reporting tracepoints. 4 * 5 * Copyright (C) 2021, Google LLC. 6 */ 7#undef TRACE_SYSTEM 8#define TRACE_SYSTEM error_report 9 10#if !defined(_TRACE_ERROR_REPORT_H) || defined(TRACE_HEADER_MULTI_READ) 11#define _TRACE_ERROR_REPORT_H 12 13#include <linux/tracepoint.h> 14 15#ifndef __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY 16#define __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY 17 18enum error_detector { 19 ERROR_DETECTOR_KFENCE, 20 ERROR_DETECTOR_KASAN 21}; 22 23#endif /* __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY */ 24 25#define error_detector_list \ 26 EM(ERROR_DETECTOR_KFENCE, "kfence") \ 27 EMe(ERROR_DETECTOR_KASAN, "kasan") 28/* Always end the list with an EMe. */ 29 30#undef EM 31#undef EMe 32 33#define EM(a, b) TRACE_DEFINE_ENUM(a); 34#define EMe(a, b) TRACE_DEFINE_ENUM(a); 35 36error_detector_list 37 38#undef EM 39#undef EMe 40 41#define EM(a, b) { a, b }, 42#define EMe(a, b) { a, b } 43 44#define show_error_detector_list(val) \ 45 __print_symbolic(val, error_detector_list) 46 47DECLARE_EVENT_CLASS(error_report_template, 48 TP_PROTO(enum error_detector error_detector, unsigned long id), 49 TP_ARGS(error_detector, id), 50 TP_STRUCT__entry(__field(enum error_detector, error_detector) 51 __field(unsigned long, id)), 52 TP_fast_assign(__entry->error_detector = error_detector; 53 __entry->id = id;), 54 TP_printk("[%s] %lx", 55 show_error_detector_list(__entry->error_detector), 56 __entry->id)); 57 58/** 59 * error_report_end - called after printing the error report 60 * @error_detector: short string describing the error detection tool 61 * @id: pseudo-unique descriptor identifying the report 62 * (e.g. the memory access address) 63 * 64 * This event occurs right after a debugging tool finishes printing the error 65 * report. 66 */ 67DEFINE_EVENT(error_report_template, error_report_end, 68 TP_PROTO(enum error_detector error_detector, unsigned long id), 69 TP_ARGS(error_detector, id)); 70 71#endif /* _TRACE_ERROR_REPORT_H */ 72 73/* This part must be outside protection */ 74#include <trace/define_trace.h>