Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|---|
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM memory_failure |
| 4 | #define TRACE_INCLUDE_FILE memory-failure |
| 5 | |
| 6 | #if !defined(_TRACE_MEMORY_FAILURE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 7 | #define _TRACE_MEMORY_FAILURE_H |
| 8 | |
| 9 | #include <linux/tracepoint.h> |
| 10 | #include <linux/mm.h> |
| 11 | |
| 12 | /* |
| 13 | * memory-failure recovery action result event |
| 14 | * |
| 15 | * unsigned long pfn - Page Frame Number of the corrupted page |
| 16 | * int type - Page types of the corrupted page |
| 17 | * int result - Result of recovery action |
| 18 | */ |
| 19 | |
| 20 | #define MF_ACTION_RESULT \ |
| 21 | EM ( MF_IGNORED, "Ignored" ) \ |
| 22 | EM ( MF_FAILED, "Failed" ) \ |
| 23 | EM ( MF_DELAYED, "Delayed" ) \ |
| 24 | EMe ( MF_RECOVERED, "Recovered" ) |
| 25 | |
| 26 | #define MF_PAGE_TYPE \ |
| 27 | EM ( MF_MSG_KERNEL, "reserved kernel page" ) \ |
| 28 | EM ( MF_MSG_KERNEL_HIGH_ORDER, "high-order kernel page" ) \ |
| 29 | EM ( MF_MSG_HUGE, "huge page" ) \ |
| 30 | EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ |
| 31 | EM ( MF_MSG_GET_HWPOISON, "get hwpoison page" ) \ |
| 32 | EM ( MF_MSG_UNMAP_FAILED, "unmapping failed page" ) \ |
| 33 | EM ( MF_MSG_DIRTY_SWAPCACHE, "dirty swapcache page" ) \ |
| 34 | EM ( MF_MSG_CLEAN_SWAPCACHE, "clean swapcache page" ) \ |
| 35 | EM ( MF_MSG_DIRTY_MLOCKED_LRU, "dirty mlocked LRU page" ) \ |
| 36 | EM ( MF_MSG_CLEAN_MLOCKED_LRU, "clean mlocked LRU page" ) \ |
| 37 | EM ( MF_MSG_DIRTY_UNEVICTABLE_LRU, "dirty unevictable LRU page" ) \ |
| 38 | EM ( MF_MSG_CLEAN_UNEVICTABLE_LRU, "clean unevictable LRU page" ) \ |
| 39 | EM ( MF_MSG_DIRTY_LRU, "dirty LRU page" ) \ |
| 40 | EM ( MF_MSG_CLEAN_LRU, "clean LRU page" ) \ |
| 41 | EM ( MF_MSG_TRUNCATED_LRU, "already truncated LRU page" ) \ |
| 42 | EM ( MF_MSG_BUDDY, "free buddy page" ) \ |
| 43 | EM ( MF_MSG_DAX, "dax page" ) \ |
| 44 | EM ( MF_MSG_UNSPLIT_THP, "unsplit thp" ) \ |
| 45 | EM ( MF_MSG_ALREADY_POISONED, "already poisoned" ) \ |
| 46 | EM ( MF_MSG_PFN_MAP, "non struct page pfn" ) \ |
| 47 | EMe ( MF_MSG_UNKNOWN, "unknown page" ) |
| 48 | |
| 49 | /* |
| 50 | * First define the enums in MM_ACTION_RESULT to be exported to userspace |
| 51 | * via TRACE_DEFINE_ENUM(). |
| 52 | */ |
| 53 | #undef EM |
| 54 | #undef EMe |
| 55 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 56 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); |
| 57 | |
| 58 | MF_ACTION_RESULT |
| 59 | MF_PAGE_TYPE |
| 60 | |
| 61 | /* |
| 62 | * Now redefine the EM() and EMe() macros to map the enums to the strings |
| 63 | * that will be printed in the output. |
| 64 | */ |
| 65 | #undef EM |
| 66 | #undef EMe |
| 67 | #define EM(a, b) { a, b }, |
| 68 | #define EMe(a, b) { a, b } |
| 69 | |
| 70 | TRACE_EVENT(memory_failure_event, |
| 71 | TP_PROTO(unsigned long pfn, |
| 72 | int type, |
| 73 | int result), |
| 74 | |
| 75 | TP_ARGS(pfn, type, result), |
| 76 | |
| 77 | TP_STRUCT__entry( |
| 78 | __field(unsigned long, pfn) |
| 79 | __field(int, type) |
| 80 | __field(int, result) |
| 81 | ), |
| 82 | |
| 83 | TP_fast_assign( |
| 84 | __entry->pfn = pfn; |
| 85 | __entry->type = type; |
| 86 | __entry->result = result; |
| 87 | ), |
| 88 | |
| 89 | TP_printk("pfn %#lx: recovery action for %s: %s", |
| 90 | __entry->pfn, |
| 91 | __print_symbolic(__entry->type, MF_PAGE_TYPE), |
| 92 | __print_symbolic(__entry->result, MF_ACTION_RESULT) |
| 93 | ) |
| 94 | ); |
| 95 | #endif /* _TRACE_MEMORY_FAILURE_H */ |
| 96 | |
| 97 | /* This part must be outside protection */ |
| 98 | #include <trace/define_trace.h> |
| 99 |
Warning: This file is not a C or C++ file. It does not have highlighting.
