1df529cabSJaewon Kim /* SPDX-License-Identifier: GPL-2.0 */ 2df529cabSJaewon Kim #undef TRACE_SYSTEM 3df529cabSJaewon Kim #define TRACE_SYSTEM mmap 4df529cabSJaewon Kim 5df529cabSJaewon Kim #if !defined(_TRACE_MMAP_H) || defined(TRACE_HEADER_MULTI_READ) 6df529cabSJaewon Kim #define _TRACE_MMAP_H 7df529cabSJaewon Kim 8df529cabSJaewon Kim #include <linux/tracepoint.h> 9df529cabSJaewon Kim 10df529cabSJaewon Kim TRACE_EVENT(vm_unmapped_area, 11df529cabSJaewon Kim 12df529cabSJaewon Kim TP_PROTO(unsigned long addr, struct vm_unmapped_area_info *info), 13df529cabSJaewon Kim 14df529cabSJaewon Kim TP_ARGS(addr, info), 15df529cabSJaewon Kim 16df529cabSJaewon Kim TP_STRUCT__entry( 17df529cabSJaewon Kim __field(unsigned long, addr) 18df529cabSJaewon Kim __field(unsigned long, total_vm) 19df529cabSJaewon Kim __field(unsigned long, flags) 20df529cabSJaewon Kim __field(unsigned long, length) 21df529cabSJaewon Kim __field(unsigned long, low_limit) 22df529cabSJaewon Kim __field(unsigned long, high_limit) 23df529cabSJaewon Kim __field(unsigned long, align_mask) 24df529cabSJaewon Kim __field(unsigned long, align_offset) 25df529cabSJaewon Kim ), 26df529cabSJaewon Kim 27df529cabSJaewon Kim TP_fast_assign( 28df529cabSJaewon Kim __entry->addr = addr; 29df529cabSJaewon Kim __entry->total_vm = current->mm->total_vm; 30df529cabSJaewon Kim __entry->flags = info->flags; 31df529cabSJaewon Kim __entry->length = info->length; 32df529cabSJaewon Kim __entry->low_limit = info->low_limit; 33df529cabSJaewon Kim __entry->high_limit = info->high_limit; 34df529cabSJaewon Kim __entry->align_mask = info->align_mask; 35df529cabSJaewon Kim __entry->align_offset = info->align_offset; 36df529cabSJaewon Kim ), 37df529cabSJaewon Kim 38*d0072ca5SMinwoo Im TP_printk("addr=0x%lx err=%ld total_vm=0x%lx flags=0x%lx len=0x%lx lo=0x%lx hi=0x%lx mask=0x%lx ofs=0x%lx", 39df529cabSJaewon Kim IS_ERR_VALUE(__entry->addr) ? 0 : __entry->addr, 40df529cabSJaewon Kim IS_ERR_VALUE(__entry->addr) ? __entry->addr : 0, 41df529cabSJaewon Kim __entry->total_vm, __entry->flags, __entry->length, 42df529cabSJaewon Kim __entry->low_limit, __entry->high_limit, __entry->align_mask, 43df529cabSJaewon Kim __entry->align_offset) 44df529cabSJaewon Kim ); 45d4af56c5SLiam R. Howlett 46d4af56c5SLiam R. Howlett TRACE_EVENT(vma_mas_szero, 47d4af56c5SLiam R. Howlett TP_PROTO(struct maple_tree *mt, unsigned long start, 48d4af56c5SLiam R. Howlett unsigned long end), 49d4af56c5SLiam R. Howlett 50d4af56c5SLiam R. Howlett TP_ARGS(mt, start, end), 51d4af56c5SLiam R. Howlett 52d4af56c5SLiam R. Howlett TP_STRUCT__entry( 53d4af56c5SLiam R. Howlett __field(struct maple_tree *, mt) 54d4af56c5SLiam R. Howlett __field(unsigned long, start) 55d4af56c5SLiam R. Howlett __field(unsigned long, end) 56d4af56c5SLiam R. Howlett ), 57d4af56c5SLiam R. Howlett 58d4af56c5SLiam R. Howlett TP_fast_assign( 59d4af56c5SLiam R. Howlett __entry->mt = mt; 60d4af56c5SLiam R. Howlett __entry->start = start; 61d4af56c5SLiam R. Howlett __entry->end = end; 62d4af56c5SLiam R. Howlett ), 63d4af56c5SLiam R. Howlett 64d4af56c5SLiam R. Howlett TP_printk("mt_mod %p, (NULL), SNULL, %lu, %lu,", 65d4af56c5SLiam R. Howlett __entry->mt, 66d4af56c5SLiam R. Howlett (unsigned long) __entry->start, 67d4af56c5SLiam R. Howlett (unsigned long) __entry->end 68d4af56c5SLiam R. Howlett ) 69d4af56c5SLiam R. Howlett ); 70d4af56c5SLiam R. Howlett 71d4af56c5SLiam R. Howlett TRACE_EVENT(vma_store, 72d4af56c5SLiam R. Howlett TP_PROTO(struct maple_tree *mt, struct vm_area_struct *vma), 73d4af56c5SLiam R. Howlett 74d4af56c5SLiam R. Howlett TP_ARGS(mt, vma), 75d4af56c5SLiam R. Howlett 76d4af56c5SLiam R. Howlett TP_STRUCT__entry( 77d4af56c5SLiam R. Howlett __field(struct maple_tree *, mt) 78d4af56c5SLiam R. Howlett __field(struct vm_area_struct *, vma) 79d4af56c5SLiam R. Howlett __field(unsigned long, vm_start) 80d4af56c5SLiam R. Howlett __field(unsigned long, vm_end) 81d4af56c5SLiam R. Howlett ), 82d4af56c5SLiam R. Howlett 83d4af56c5SLiam R. Howlett TP_fast_assign( 84d4af56c5SLiam R. Howlett __entry->mt = mt; 85d4af56c5SLiam R. Howlett __entry->vma = vma; 86d4af56c5SLiam R. Howlett __entry->vm_start = vma->vm_start; 87d4af56c5SLiam R. Howlett __entry->vm_end = vma->vm_end - 1; 88d4af56c5SLiam R. Howlett ), 89d4af56c5SLiam R. Howlett 90d4af56c5SLiam R. Howlett TP_printk("mt_mod %p, (%p), STORE, %lu, %lu,", 91d4af56c5SLiam R. Howlett __entry->mt, __entry->vma, 92d4af56c5SLiam R. Howlett (unsigned long) __entry->vm_start, 93d4af56c5SLiam R. Howlett (unsigned long) __entry->vm_end 94d4af56c5SLiam R. Howlett ) 95d4af56c5SLiam R. Howlett ); 96d4af56c5SLiam R. Howlett 97d4af56c5SLiam R. Howlett 98d4af56c5SLiam R. Howlett TRACE_EVENT(exit_mmap, 99d4af56c5SLiam R. Howlett TP_PROTO(struct mm_struct *mm), 100d4af56c5SLiam R. Howlett 101d4af56c5SLiam R. Howlett TP_ARGS(mm), 102d4af56c5SLiam R. Howlett 103d4af56c5SLiam R. Howlett TP_STRUCT__entry( 104d4af56c5SLiam R. Howlett __field(struct mm_struct *, mm) 105d4af56c5SLiam R. Howlett __field(struct maple_tree *, mt) 106d4af56c5SLiam R. Howlett ), 107d4af56c5SLiam R. Howlett 108d4af56c5SLiam R. Howlett TP_fast_assign( 109d4af56c5SLiam R. Howlett __entry->mm = mm; 110d4af56c5SLiam R. Howlett __entry->mt = &mm->mm_mt; 111d4af56c5SLiam R. Howlett ), 112d4af56c5SLiam R. Howlett 113*d0072ca5SMinwoo Im TP_printk("mt_mod %p, DESTROY", 114d4af56c5SLiam R. Howlett __entry->mt 115d4af56c5SLiam R. Howlett ) 116d4af56c5SLiam R. Howlett ); 117d4af56c5SLiam R. Howlett 118df529cabSJaewon Kim #endif 119df529cabSJaewon Kim 120df529cabSJaewon Kim /* This part must be outside protection */ 121df529cabSJaewon Kim #include <trace/define_trace.h> 122