1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2634355d4SJeremy Fitzhardinge #undef TRACE_SYSTEM 3634355d4SJeremy Fitzhardinge #define TRACE_SYSTEM xen 4634355d4SJeremy Fitzhardinge 5634355d4SJeremy Fitzhardinge #if !defined(_TRACE_XEN_H) || defined(TRACE_HEADER_MULTI_READ) 6634355d4SJeremy Fitzhardinge #define _TRACE_XEN_H 7634355d4SJeremy Fitzhardinge 8634355d4SJeremy Fitzhardinge #include <linux/tracepoint.h> 9*a4a7644cSJuergen Gross #include <asm/xen/hypervisor.h> 10c796f213SJeremy Fitzhardinge #include <asm/xen/trace_types.h> 11634355d4SJeremy Fitzhardinge 12b3c4b982SJeremy Fitzhardinge struct multicall_entry; 13b3c4b982SJeremy Fitzhardinge 14c796f213SJeremy Fitzhardinge /* Multicalls */ 15bd9ddc87SJeremy Fitzhardinge DECLARE_EVENT_CLASS(xen_mc__batch, 16*a4a7644cSJuergen Gross TP_PROTO(enum xen_lazy_mode mode), 17c796f213SJeremy Fitzhardinge TP_ARGS(mode), 18c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 19*a4a7644cSJuergen Gross __field(enum xen_lazy_mode, mode) 20c796f213SJeremy Fitzhardinge ), 21c796f213SJeremy Fitzhardinge TP_fast_assign(__entry->mode = mode), 22c796f213SJeremy Fitzhardinge TP_printk("start batch LAZY_%s", 23*a4a7644cSJuergen Gross (__entry->mode == XEN_LAZY_MMU) ? "MMU" : 24*a4a7644cSJuergen Gross (__entry->mode == XEN_LAZY_CPU) ? "CPU" : "NONE") 25c796f213SJeremy Fitzhardinge ); 26bd9ddc87SJeremy Fitzhardinge #define DEFINE_XEN_MC_BATCH(name) \ 27bd9ddc87SJeremy Fitzhardinge DEFINE_EVENT(xen_mc__batch, name, \ 28*a4a7644cSJuergen Gross TP_PROTO(enum xen_lazy_mode mode), \ 29bd9ddc87SJeremy Fitzhardinge TP_ARGS(mode)) 30c796f213SJeremy Fitzhardinge 31bd9ddc87SJeremy Fitzhardinge DEFINE_XEN_MC_BATCH(xen_mc_batch); 32bd9ddc87SJeremy Fitzhardinge DEFINE_XEN_MC_BATCH(xen_mc_issue); 33c796f213SJeremy Fitzhardinge 34ff910cfdSJeremy Linton TRACE_DEFINE_SIZEOF(ulong); 35ff910cfdSJeremy Linton 36c796f213SJeremy Fitzhardinge TRACE_EVENT(xen_mc_entry, 37c796f213SJeremy Fitzhardinge TP_PROTO(struct multicall_entry *mc, unsigned nargs), 38c796f213SJeremy Fitzhardinge TP_ARGS(mc, nargs), 39c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 40c796f213SJeremy Fitzhardinge __field(unsigned int, op) 41c796f213SJeremy Fitzhardinge __field(unsigned int, nargs) 42c796f213SJeremy Fitzhardinge __array(unsigned long, args, 6) 43c796f213SJeremy Fitzhardinge ), 44c796f213SJeremy Fitzhardinge TP_fast_assign(__entry->op = mc->op; 45c796f213SJeremy Fitzhardinge __entry->nargs = nargs; 46ff910cfdSJeremy Linton memcpy(__entry->args, mc->args, sizeof(ulong) * nargs); 47ff910cfdSJeremy Linton memset(__entry->args + nargs, 0, sizeof(ulong) * (6 - nargs)); 48c796f213SJeremy Fitzhardinge ), 49c796f213SJeremy Fitzhardinge TP_printk("op %u%s args [%lx, %lx, %lx, %lx, %lx, %lx]", 50c796f213SJeremy Fitzhardinge __entry->op, xen_hypercall_name(__entry->op), 51c796f213SJeremy Fitzhardinge __entry->args[0], __entry->args[1], __entry->args[2], 52c796f213SJeremy Fitzhardinge __entry->args[3], __entry->args[4], __entry->args[5]) 53c796f213SJeremy Fitzhardinge ); 54c796f213SJeremy Fitzhardinge 55c796f213SJeremy Fitzhardinge TRACE_EVENT(xen_mc_entry_alloc, 56c796f213SJeremy Fitzhardinge TP_PROTO(size_t args), 57c796f213SJeremy Fitzhardinge TP_ARGS(args), 58c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 59c796f213SJeremy Fitzhardinge __field(size_t, args) 60c796f213SJeremy Fitzhardinge ), 61c796f213SJeremy Fitzhardinge TP_fast_assign(__entry->args = args), 62c796f213SJeremy Fitzhardinge TP_printk("alloc entry %zu arg bytes", __entry->args) 63c796f213SJeremy Fitzhardinge ); 64c796f213SJeremy Fitzhardinge 65c796f213SJeremy Fitzhardinge TRACE_EVENT(xen_mc_callback, 66c796f213SJeremy Fitzhardinge TP_PROTO(xen_mc_callback_fn_t fn, void *data), 67c796f213SJeremy Fitzhardinge TP_ARGS(fn, data), 68c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 69d0695e23SChangbin Du /* 70d0695e23SChangbin Du * Use field_struct to avoid is_signed_type() 71d0695e23SChangbin Du * comparison of a function pointer. 72d0695e23SChangbin Du */ 73d0695e23SChangbin Du __field_struct(xen_mc_callback_fn_t, fn) 74c796f213SJeremy Fitzhardinge __field(void *, data) 75c796f213SJeremy Fitzhardinge ), 76c796f213SJeremy Fitzhardinge TP_fast_assign( 77c796f213SJeremy Fitzhardinge __entry->fn = fn; 78c796f213SJeremy Fitzhardinge __entry->data = data; 79c796f213SJeremy Fitzhardinge ), 80d75f773cSSakari Ailus TP_printk("callback %ps, data %p", 81c796f213SJeremy Fitzhardinge __entry->fn, __entry->data) 82c796f213SJeremy Fitzhardinge ); 83c796f213SJeremy Fitzhardinge 84c796f213SJeremy Fitzhardinge TRACE_EVENT(xen_mc_flush_reason, 85c796f213SJeremy Fitzhardinge TP_PROTO(enum xen_mc_flush_reason reason), 86c796f213SJeremy Fitzhardinge TP_ARGS(reason), 87c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 88c796f213SJeremy Fitzhardinge __field(enum xen_mc_flush_reason, reason) 89c796f213SJeremy Fitzhardinge ), 90c796f213SJeremy Fitzhardinge TP_fast_assign(__entry->reason = reason), 91c796f213SJeremy Fitzhardinge TP_printk("flush reason %s", 92c796f213SJeremy Fitzhardinge (__entry->reason == XEN_MC_FL_NONE) ? "NONE" : 93c796f213SJeremy Fitzhardinge (__entry->reason == XEN_MC_FL_BATCH) ? "BATCH" : 94c796f213SJeremy Fitzhardinge (__entry->reason == XEN_MC_FL_ARGS) ? "ARGS" : 95c796f213SJeremy Fitzhardinge (__entry->reason == XEN_MC_FL_CALLBACK) ? "CALLBACK" : "??") 96c796f213SJeremy Fitzhardinge ); 97c796f213SJeremy Fitzhardinge 98c796f213SJeremy Fitzhardinge TRACE_EVENT(xen_mc_flush, 99c796f213SJeremy Fitzhardinge TP_PROTO(unsigned mcidx, unsigned argidx, unsigned cbidx), 100c796f213SJeremy Fitzhardinge TP_ARGS(mcidx, argidx, cbidx), 101c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 102c796f213SJeremy Fitzhardinge __field(unsigned, mcidx) 103c796f213SJeremy Fitzhardinge __field(unsigned, argidx) 104c796f213SJeremy Fitzhardinge __field(unsigned, cbidx) 105c796f213SJeremy Fitzhardinge ), 106c796f213SJeremy Fitzhardinge TP_fast_assign(__entry->mcidx = mcidx; 107c796f213SJeremy Fitzhardinge __entry->argidx = argidx; 108c796f213SJeremy Fitzhardinge __entry->cbidx = cbidx), 109c796f213SJeremy Fitzhardinge TP_printk("flushing %u hypercalls, %u arg bytes, %u callbacks", 110c796f213SJeremy Fitzhardinge __entry->mcidx, __entry->argidx, __entry->cbidx) 111c796f213SJeremy Fitzhardinge ); 112c796f213SJeremy Fitzhardinge 113c796f213SJeremy Fitzhardinge TRACE_EVENT(xen_mc_extend_args, 114c796f213SJeremy Fitzhardinge TP_PROTO(unsigned long op, size_t args, enum xen_mc_extend_args res), 115c796f213SJeremy Fitzhardinge TP_ARGS(op, args, res), 116c796f213SJeremy Fitzhardinge TP_STRUCT__entry( 117c796f213SJeremy Fitzhardinge __field(unsigned int, op) 118c796f213SJeremy Fitzhardinge __field(size_t, args) 119c796f213SJeremy Fitzhardinge __field(enum xen_mc_extend_args, res) 120c796f213SJeremy Fitzhardinge ), 121c796f213SJeremy Fitzhardinge TP_fast_assign(__entry->op = op; 122c796f213SJeremy Fitzhardinge __entry->args = args; 123c796f213SJeremy Fitzhardinge __entry->res = res), 124c796f213SJeremy Fitzhardinge TP_printk("extending op %u%s by %zu bytes res %s", 125c796f213SJeremy Fitzhardinge __entry->op, xen_hypercall_name(__entry->op), 126c796f213SJeremy Fitzhardinge __entry->args, 127c796f213SJeremy Fitzhardinge __entry->res == XEN_MC_XE_OK ? "OK" : 128c796f213SJeremy Fitzhardinge __entry->res == XEN_MC_XE_BAD_OP ? "BAD_OP" : 129c796f213SJeremy Fitzhardinge __entry->res == XEN_MC_XE_NO_SPACE ? "NO_SPACE" : "???") 130c796f213SJeremy Fitzhardinge ); 13184708807SJeremy Fitzhardinge 132ff910cfdSJeremy Linton TRACE_DEFINE_SIZEOF(pteval_t); 13384708807SJeremy Fitzhardinge /* mmu */ 134c43ed60cSJeremy Fitzhardinge DECLARE_EVENT_CLASS(xen_mmu__set_pte, 13584708807SJeremy Fitzhardinge TP_PROTO(pte_t *ptep, pte_t pteval), 13684708807SJeremy Fitzhardinge TP_ARGS(ptep, pteval), 13784708807SJeremy Fitzhardinge TP_STRUCT__entry( 13884708807SJeremy Fitzhardinge __field(pte_t *, ptep) 13984708807SJeremy Fitzhardinge __field(pteval_t, pteval) 14084708807SJeremy Fitzhardinge ), 14184708807SJeremy Fitzhardinge TP_fast_assign(__entry->ptep = ptep; 14284708807SJeremy Fitzhardinge __entry->pteval = pteval.pte), 14384708807SJeremy Fitzhardinge TP_printk("ptep %p pteval %0*llx (raw %0*llx)", 14484708807SJeremy Fitzhardinge __entry->ptep, 14584708807SJeremy Fitzhardinge (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)), 14684708807SJeremy Fitzhardinge (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval) 14784708807SJeremy Fitzhardinge ); 14884708807SJeremy Fitzhardinge 149c43ed60cSJeremy Fitzhardinge #define DEFINE_XEN_MMU_SET_PTE(name) \ 150c43ed60cSJeremy Fitzhardinge DEFINE_EVENT(xen_mmu__set_pte, name, \ 151c43ed60cSJeremy Fitzhardinge TP_PROTO(pte_t *ptep, pte_t pteval), \ 152c43ed60cSJeremy Fitzhardinge TP_ARGS(ptep, pteval)) 153c43ed60cSJeremy Fitzhardinge 154c43ed60cSJeremy Fitzhardinge DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte); 15584708807SJeremy Fitzhardinge 156ff910cfdSJeremy Linton TRACE_DEFINE_SIZEOF(pmdval_t); 157ff910cfdSJeremy Linton 15884708807SJeremy Fitzhardinge TRACE_EVENT(xen_mmu_set_pmd, 15984708807SJeremy Fitzhardinge TP_PROTO(pmd_t *pmdp, pmd_t pmdval), 16084708807SJeremy Fitzhardinge TP_ARGS(pmdp, pmdval), 16184708807SJeremy Fitzhardinge TP_STRUCT__entry( 16284708807SJeremy Fitzhardinge __field(pmd_t *, pmdp) 16384708807SJeremy Fitzhardinge __field(pmdval_t, pmdval) 16484708807SJeremy Fitzhardinge ), 16584708807SJeremy Fitzhardinge TP_fast_assign(__entry->pmdp = pmdp; 16684708807SJeremy Fitzhardinge __entry->pmdval = pmdval.pmd), 16784708807SJeremy Fitzhardinge TP_printk("pmdp %p pmdval %0*llx (raw %0*llx)", 16884708807SJeremy Fitzhardinge __entry->pmdp, 16984708807SJeremy Fitzhardinge (int)sizeof(pmdval_t) * 2, (unsigned long long)pmd_val(native_make_pmd(__entry->pmdval)), 17084708807SJeremy Fitzhardinge (int)sizeof(pmdval_t) * 2, (unsigned long long)__entry->pmdval) 17184708807SJeremy Fitzhardinge ); 17284708807SJeremy Fitzhardinge 173e83543b4SSteven Rostedt (VMware) #ifdef CONFIG_X86_PAE 174e83543b4SSteven Rostedt (VMware) DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic); 175e83543b4SSteven Rostedt (VMware) 176e83543b4SSteven Rostedt (VMware) TRACE_EVENT(xen_mmu_pte_clear, 177e83543b4SSteven Rostedt (VMware) TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep), 178e83543b4SSteven Rostedt (VMware) TP_ARGS(mm, addr, ptep), 179e83543b4SSteven Rostedt (VMware) TP_STRUCT__entry( 180e83543b4SSteven Rostedt (VMware) __field(struct mm_struct *, mm) 181e83543b4SSteven Rostedt (VMware) __field(unsigned long, addr) 182e83543b4SSteven Rostedt (VMware) __field(pte_t *, ptep) 183e83543b4SSteven Rostedt (VMware) ), 184e83543b4SSteven Rostedt (VMware) TP_fast_assign(__entry->mm = mm; 185e83543b4SSteven Rostedt (VMware) __entry->addr = addr; 186e83543b4SSteven Rostedt (VMware) __entry->ptep = ptep), 187e83543b4SSteven Rostedt (VMware) TP_printk("mm %p addr %lx ptep %p", 188e83543b4SSteven Rostedt (VMware) __entry->mm, __entry->addr, __entry->ptep) 189e83543b4SSteven Rostedt (VMware) ); 190e83543b4SSteven Rostedt (VMware) 19184708807SJeremy Fitzhardinge TRACE_EVENT(xen_mmu_pmd_clear, 19284708807SJeremy Fitzhardinge TP_PROTO(pmd_t *pmdp), 19384708807SJeremy Fitzhardinge TP_ARGS(pmdp), 19484708807SJeremy Fitzhardinge TP_STRUCT__entry( 19584708807SJeremy Fitzhardinge __field(pmd_t *, pmdp) 19684708807SJeremy Fitzhardinge ), 19784708807SJeremy Fitzhardinge TP_fast_assign(__entry->pmdp = pmdp), 19884708807SJeremy Fitzhardinge TP_printk("pmdp %p", __entry->pmdp) 19984708807SJeremy Fitzhardinge ); 200e83543b4SSteven Rostedt (VMware) #endif 20184708807SJeremy Fitzhardinge 20298233368SKirill A. Shutemov #if CONFIG_PGTABLE_LEVELS >= 4 20384708807SJeremy Fitzhardinge 204ff910cfdSJeremy Linton TRACE_DEFINE_SIZEOF(pudval_t); 205ff910cfdSJeremy Linton 20684708807SJeremy Fitzhardinge TRACE_EVENT(xen_mmu_set_pud, 20784708807SJeremy Fitzhardinge TP_PROTO(pud_t *pudp, pud_t pudval), 20884708807SJeremy Fitzhardinge TP_ARGS(pudp, pudval), 20984708807SJeremy Fitzhardinge TP_STRUCT__entry( 21084708807SJeremy Fitzhardinge __field(pud_t *, pudp) 21184708807SJeremy Fitzhardinge __field(pudval_t, pudval) 21284708807SJeremy Fitzhardinge ), 21384708807SJeremy Fitzhardinge TP_fast_assign(__entry->pudp = pudp; 21484708807SJeremy Fitzhardinge __entry->pudval = native_pud_val(pudval)), 21584708807SJeremy Fitzhardinge TP_printk("pudp %p pudval %0*llx (raw %0*llx)", 21684708807SJeremy Fitzhardinge __entry->pudp, 21784708807SJeremy Fitzhardinge (int)sizeof(pudval_t) * 2, (unsigned long long)pud_val(native_make_pud(__entry->pudval)), 21884708807SJeremy Fitzhardinge (int)sizeof(pudval_t) * 2, (unsigned long long)__entry->pudval) 21984708807SJeremy Fitzhardinge ); 22084708807SJeremy Fitzhardinge 221ff910cfdSJeremy Linton TRACE_DEFINE_SIZEOF(p4dval_t); 222ff910cfdSJeremy Linton 223f2a6a705SKirill A. Shutemov TRACE_EVENT(xen_mmu_set_p4d, 224f2a6a705SKirill A. Shutemov TP_PROTO(p4d_t *p4dp, p4d_t *user_p4dp, p4d_t p4dval), 225f2a6a705SKirill A. Shutemov TP_ARGS(p4dp, user_p4dp, p4dval), 22684708807SJeremy Fitzhardinge TP_STRUCT__entry( 227f2a6a705SKirill A. Shutemov __field(p4d_t *, p4dp) 228f2a6a705SKirill A. Shutemov __field(p4d_t *, user_p4dp) 229f2a6a705SKirill A. Shutemov __field(p4dval_t, p4dval) 23084708807SJeremy Fitzhardinge ), 231f2a6a705SKirill A. Shutemov TP_fast_assign(__entry->p4dp = p4dp; 232f2a6a705SKirill A. Shutemov __entry->user_p4dp = user_p4dp; 233f2a6a705SKirill A. Shutemov __entry->p4dval = p4d_val(p4dval)), 234f2a6a705SKirill A. Shutemov TP_printk("p4dp %p user_p4dp %p p4dval %0*llx (raw %0*llx)", 235f2a6a705SKirill A. Shutemov __entry->p4dp, __entry->user_p4dp, 236f2a6a705SKirill A. Shutemov (int)sizeof(p4dval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->p4dval)), 237f2a6a705SKirill A. Shutemov (int)sizeof(p4dval_t) * 2, (unsigned long long)__entry->p4dval) 23884708807SJeremy Fitzhardinge ); 23984708807SJeremy Fitzhardinge #else 24084708807SJeremy Fitzhardinge 24184708807SJeremy Fitzhardinge TRACE_EVENT(xen_mmu_set_pud, 24284708807SJeremy Fitzhardinge TP_PROTO(pud_t *pudp, pud_t pudval), 24384708807SJeremy Fitzhardinge TP_ARGS(pudp, pudval), 24484708807SJeremy Fitzhardinge TP_STRUCT__entry( 24584708807SJeremy Fitzhardinge __field(pud_t *, pudp) 24684708807SJeremy Fitzhardinge __field(pudval_t, pudval) 24784708807SJeremy Fitzhardinge ), 24884708807SJeremy Fitzhardinge TP_fast_assign(__entry->pudp = pudp; 24984708807SJeremy Fitzhardinge __entry->pudval = native_pud_val(pudval)), 25084708807SJeremy Fitzhardinge TP_printk("pudp %p pudval %0*llx (raw %0*llx)", 25184708807SJeremy Fitzhardinge __entry->pudp, 25284708807SJeremy Fitzhardinge (int)sizeof(pudval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->pudval)), 25384708807SJeremy Fitzhardinge (int)sizeof(pudval_t) * 2, (unsigned long long)__entry->pudval) 25484708807SJeremy Fitzhardinge ); 25584708807SJeremy Fitzhardinge 25684708807SJeremy Fitzhardinge #endif 25784708807SJeremy Fitzhardinge 258c43ed60cSJeremy Fitzhardinge DECLARE_EVENT_CLASS(xen_mmu_ptep_modify_prot, 25984708807SJeremy Fitzhardinge TP_PROTO(struct mm_struct *mm, unsigned long addr, 26084708807SJeremy Fitzhardinge pte_t *ptep, pte_t pteval), 26184708807SJeremy Fitzhardinge TP_ARGS(mm, addr, ptep, pteval), 26284708807SJeremy Fitzhardinge TP_STRUCT__entry( 26384708807SJeremy Fitzhardinge __field(struct mm_struct *, mm) 26484708807SJeremy Fitzhardinge __field(unsigned long, addr) 26584708807SJeremy Fitzhardinge __field(pte_t *, ptep) 26684708807SJeremy Fitzhardinge __field(pteval_t, pteval) 26784708807SJeremy Fitzhardinge ), 26884708807SJeremy Fitzhardinge TP_fast_assign(__entry->mm = mm; 26984708807SJeremy Fitzhardinge __entry->addr = addr; 27084708807SJeremy Fitzhardinge __entry->ptep = ptep; 27184708807SJeremy Fitzhardinge __entry->pteval = pteval.pte), 27284708807SJeremy Fitzhardinge TP_printk("mm %p addr %lx ptep %p pteval %0*llx (raw %0*llx)", 27384708807SJeremy Fitzhardinge __entry->mm, __entry->addr, __entry->ptep, 27484708807SJeremy Fitzhardinge (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)), 27584708807SJeremy Fitzhardinge (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval) 27684708807SJeremy Fitzhardinge ); 277c43ed60cSJeremy Fitzhardinge #define DEFINE_XEN_MMU_PTEP_MODIFY_PROT(name) \ 278c43ed60cSJeremy Fitzhardinge DEFINE_EVENT(xen_mmu_ptep_modify_prot, name, \ 279c43ed60cSJeremy Fitzhardinge TP_PROTO(struct mm_struct *mm, unsigned long addr, \ 280c43ed60cSJeremy Fitzhardinge pte_t *ptep, pte_t pteval), \ 281c43ed60cSJeremy Fitzhardinge TP_ARGS(mm, addr, ptep, pteval)) 28284708807SJeremy Fitzhardinge 283c43ed60cSJeremy Fitzhardinge DEFINE_XEN_MMU_PTEP_MODIFY_PROT(xen_mmu_ptep_modify_prot_start); 284c43ed60cSJeremy Fitzhardinge DEFINE_XEN_MMU_PTEP_MODIFY_PROT(xen_mmu_ptep_modify_prot_commit); 28584708807SJeremy Fitzhardinge 286c2ba050dSJeremy Fitzhardinge TRACE_EVENT(xen_mmu_alloc_ptpage, 287c2ba050dSJeremy Fitzhardinge TP_PROTO(struct mm_struct *mm, unsigned long pfn, unsigned level, bool pinned), 288c2ba050dSJeremy Fitzhardinge TP_ARGS(mm, pfn, level, pinned), 289c2ba050dSJeremy Fitzhardinge TP_STRUCT__entry( 290c2ba050dSJeremy Fitzhardinge __field(struct mm_struct *, mm) 291c2ba050dSJeremy Fitzhardinge __field(unsigned long, pfn) 292c2ba050dSJeremy Fitzhardinge __field(unsigned, level) 293c2ba050dSJeremy Fitzhardinge __field(bool, pinned) 294c2ba050dSJeremy Fitzhardinge ), 295c2ba050dSJeremy Fitzhardinge TP_fast_assign(__entry->mm = mm; 296c2ba050dSJeremy Fitzhardinge __entry->pfn = pfn; 297c2ba050dSJeremy Fitzhardinge __entry->level = level; 298c2ba050dSJeremy Fitzhardinge __entry->pinned = pinned), 299c2ba050dSJeremy Fitzhardinge TP_printk("mm %p pfn %lx level %d %spinned", 300c2ba050dSJeremy Fitzhardinge __entry->mm, __entry->pfn, __entry->level, 301c2ba050dSJeremy Fitzhardinge __entry->pinned ? "" : "un") 302c2ba050dSJeremy Fitzhardinge ); 303c2ba050dSJeremy Fitzhardinge 304c2ba050dSJeremy Fitzhardinge TRACE_EVENT(xen_mmu_release_ptpage, 305c2ba050dSJeremy Fitzhardinge TP_PROTO(unsigned long pfn, unsigned level, bool pinned), 306c2ba050dSJeremy Fitzhardinge TP_ARGS(pfn, level, pinned), 307c2ba050dSJeremy Fitzhardinge TP_STRUCT__entry( 308c2ba050dSJeremy Fitzhardinge __field(unsigned long, pfn) 309c2ba050dSJeremy Fitzhardinge __field(unsigned, level) 310c2ba050dSJeremy Fitzhardinge __field(bool, pinned) 311c2ba050dSJeremy Fitzhardinge ), 312c2ba050dSJeremy Fitzhardinge TP_fast_assign(__entry->pfn = pfn; 313c2ba050dSJeremy Fitzhardinge __entry->level = level; 314c2ba050dSJeremy Fitzhardinge __entry->pinned = pinned), 315c2ba050dSJeremy Fitzhardinge TP_printk("pfn %lx level %d %spinned", 316c2ba050dSJeremy Fitzhardinge __entry->pfn, __entry->level, 317c2ba050dSJeremy Fitzhardinge __entry->pinned ? "" : "un") 318c2ba050dSJeremy Fitzhardinge ); 31984708807SJeremy Fitzhardinge 320c43ed60cSJeremy Fitzhardinge DECLARE_EVENT_CLASS(xen_mmu_pgd, 3215f94fb5bSJeremy Fitzhardinge TP_PROTO(struct mm_struct *mm, pgd_t *pgd), 3225f94fb5bSJeremy Fitzhardinge TP_ARGS(mm, pgd), 3235f94fb5bSJeremy Fitzhardinge TP_STRUCT__entry( 3245f94fb5bSJeremy Fitzhardinge __field(struct mm_struct *, mm) 3255f94fb5bSJeremy Fitzhardinge __field(pgd_t *, pgd) 3265f94fb5bSJeremy Fitzhardinge ), 3275f94fb5bSJeremy Fitzhardinge TP_fast_assign(__entry->mm = mm; 3285f94fb5bSJeremy Fitzhardinge __entry->pgd = pgd), 3295f94fb5bSJeremy Fitzhardinge TP_printk("mm %p pgd %p", __entry->mm, __entry->pgd) 3305f94fb5bSJeremy Fitzhardinge ); 331c43ed60cSJeremy Fitzhardinge #define DEFINE_XEN_MMU_PGD_EVENT(name) \ 332c43ed60cSJeremy Fitzhardinge DEFINE_EVENT(xen_mmu_pgd, name, \ 333c43ed60cSJeremy Fitzhardinge TP_PROTO(struct mm_struct *mm, pgd_t *pgd), \ 334c43ed60cSJeremy Fitzhardinge TP_ARGS(mm, pgd)) 3355f94fb5bSJeremy Fitzhardinge 336c43ed60cSJeremy Fitzhardinge DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin); 337c43ed60cSJeremy Fitzhardinge DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin); 3385f94fb5bSJeremy Fitzhardinge 3391299ef1dSAndy Lutomirski TRACE_EVENT(xen_mmu_flush_tlb_one_user, 340c8eed171SJeremy Fitzhardinge TP_PROTO(unsigned long addr), 341c8eed171SJeremy Fitzhardinge TP_ARGS(addr), 342c8eed171SJeremy Fitzhardinge TP_STRUCT__entry( 343c8eed171SJeremy Fitzhardinge __field(unsigned long, addr) 344c8eed171SJeremy Fitzhardinge ), 345c8eed171SJeremy Fitzhardinge TP_fast_assign(__entry->addr = addr), 346c8eed171SJeremy Fitzhardinge TP_printk("addr %lx", __entry->addr) 347c8eed171SJeremy Fitzhardinge ); 348c8eed171SJeremy Fitzhardinge 3494ce94eabSNadav Amit TRACE_EVENT(xen_mmu_flush_tlb_multi, 350c8eed171SJeremy Fitzhardinge TP_PROTO(const struct cpumask *cpus, struct mm_struct *mm, 351e7b52ffdSAlex Shi unsigned long addr, unsigned long end), 352e7b52ffdSAlex Shi TP_ARGS(cpus, mm, addr, end), 353c8eed171SJeremy Fitzhardinge TP_STRUCT__entry( 354c8eed171SJeremy Fitzhardinge __field(unsigned, ncpus) 355c8eed171SJeremy Fitzhardinge __field(struct mm_struct *, mm) 356c8eed171SJeremy Fitzhardinge __field(unsigned long, addr) 357e7b52ffdSAlex Shi __field(unsigned long, end) 358c8eed171SJeremy Fitzhardinge ), 359c8eed171SJeremy Fitzhardinge TP_fast_assign(__entry->ncpus = cpumask_weight(cpus); 360c8eed171SJeremy Fitzhardinge __entry->mm = mm; 361e7b52ffdSAlex Shi __entry->addr = addr, 362e7b52ffdSAlex Shi __entry->end = end), 363e7b52ffdSAlex Shi TP_printk("ncpus %d mm %p addr %lx, end %lx", 364e7b52ffdSAlex Shi __entry->ncpus, __entry->mm, __entry->addr, __entry->end) 365c8eed171SJeremy Fitzhardinge ); 366c8eed171SJeremy Fitzhardinge 367c8eed171SJeremy Fitzhardinge TRACE_EVENT(xen_mmu_write_cr3, 368c8eed171SJeremy Fitzhardinge TP_PROTO(bool kernel, unsigned long cr3), 369c8eed171SJeremy Fitzhardinge TP_ARGS(kernel, cr3), 370c8eed171SJeremy Fitzhardinge TP_STRUCT__entry( 371c8eed171SJeremy Fitzhardinge __field(bool, kernel) 372c8eed171SJeremy Fitzhardinge __field(unsigned long, cr3) 373c8eed171SJeremy Fitzhardinge ), 374c8eed171SJeremy Fitzhardinge TP_fast_assign(__entry->kernel = kernel; 375c8eed171SJeremy Fitzhardinge __entry->cr3 = cr3), 376c8eed171SJeremy Fitzhardinge TP_printk("%s cr3 %lx", 377c8eed171SJeremy Fitzhardinge __entry->kernel ? "kernel" : "user", __entry->cr3) 378c8eed171SJeremy Fitzhardinge ); 379c8eed171SJeremy Fitzhardinge 380c8eed171SJeremy Fitzhardinge 381ab78f7adSJeremy Fitzhardinge /* CPU */ 382ab78f7adSJeremy Fitzhardinge TRACE_EVENT(xen_cpu_write_ldt_entry, 383ab78f7adSJeremy Fitzhardinge TP_PROTO(struct desc_struct *dt, int entrynum, u64 desc), 384ab78f7adSJeremy Fitzhardinge TP_ARGS(dt, entrynum, desc), 385ab78f7adSJeremy Fitzhardinge TP_STRUCT__entry( 386ab78f7adSJeremy Fitzhardinge __field(struct desc_struct *, dt) 387ab78f7adSJeremy Fitzhardinge __field(int, entrynum) 388ab78f7adSJeremy Fitzhardinge __field(u64, desc) 389ab78f7adSJeremy Fitzhardinge ), 390ab78f7adSJeremy Fitzhardinge TP_fast_assign(__entry->dt = dt; 391ab78f7adSJeremy Fitzhardinge __entry->entrynum = entrynum; 392ab78f7adSJeremy Fitzhardinge __entry->desc = desc; 393ab78f7adSJeremy Fitzhardinge ), 394ab78f7adSJeremy Fitzhardinge TP_printk("dt %p entrynum %d entry %016llx", 395ab78f7adSJeremy Fitzhardinge __entry->dt, __entry->entrynum, 396ab78f7adSJeremy Fitzhardinge (unsigned long long)__entry->desc) 397ab78f7adSJeremy Fitzhardinge ); 398ab78f7adSJeremy Fitzhardinge 399ab78f7adSJeremy Fitzhardinge TRACE_EVENT(xen_cpu_write_idt_entry, 400ab78f7adSJeremy Fitzhardinge TP_PROTO(gate_desc *dt, int entrynum, const gate_desc *ent), 401ab78f7adSJeremy Fitzhardinge TP_ARGS(dt, entrynum, ent), 402ab78f7adSJeremy Fitzhardinge TP_STRUCT__entry( 403ab78f7adSJeremy Fitzhardinge __field(gate_desc *, dt) 404ab78f7adSJeremy Fitzhardinge __field(int, entrynum) 405ab78f7adSJeremy Fitzhardinge ), 406ab78f7adSJeremy Fitzhardinge TP_fast_assign(__entry->dt = dt; 407ab78f7adSJeremy Fitzhardinge __entry->entrynum = entrynum; 408ab78f7adSJeremy Fitzhardinge ), 409ab78f7adSJeremy Fitzhardinge TP_printk("dt %p entrynum %d", 410ab78f7adSJeremy Fitzhardinge __entry->dt, __entry->entrynum) 411ab78f7adSJeremy Fitzhardinge ); 412ab78f7adSJeremy Fitzhardinge 413ab78f7adSJeremy Fitzhardinge TRACE_EVENT(xen_cpu_load_idt, 414ab78f7adSJeremy Fitzhardinge TP_PROTO(const struct desc_ptr *desc), 415ab78f7adSJeremy Fitzhardinge TP_ARGS(desc), 416ab78f7adSJeremy Fitzhardinge TP_STRUCT__entry( 417ab78f7adSJeremy Fitzhardinge __field(unsigned long, addr) 418ab78f7adSJeremy Fitzhardinge ), 419ab78f7adSJeremy Fitzhardinge TP_fast_assign(__entry->addr = desc->address), 420ab78f7adSJeremy Fitzhardinge TP_printk("addr %lx", __entry->addr) 421ab78f7adSJeremy Fitzhardinge ); 422ab78f7adSJeremy Fitzhardinge 423ab78f7adSJeremy Fitzhardinge TRACE_EVENT(xen_cpu_write_gdt_entry, 424ab78f7adSJeremy Fitzhardinge TP_PROTO(struct desc_struct *dt, int entrynum, const void *desc, int type), 425ab78f7adSJeremy Fitzhardinge TP_ARGS(dt, entrynum, desc, type), 426ab78f7adSJeremy Fitzhardinge TP_STRUCT__entry( 427ab78f7adSJeremy Fitzhardinge __field(u64, desc) 428ab78f7adSJeremy Fitzhardinge __field(struct desc_struct *, dt) 429ab78f7adSJeremy Fitzhardinge __field(int, entrynum) 430ab78f7adSJeremy Fitzhardinge __field(int, type) 431ab78f7adSJeremy Fitzhardinge ), 432ab78f7adSJeremy Fitzhardinge TP_fast_assign(__entry->dt = dt; 433ab78f7adSJeremy Fitzhardinge __entry->entrynum = entrynum; 434ab78f7adSJeremy Fitzhardinge __entry->desc = *(u64 *)desc; 435ab78f7adSJeremy Fitzhardinge __entry->type = type; 436ab78f7adSJeremy Fitzhardinge ), 437ab78f7adSJeremy Fitzhardinge TP_printk("dt %p entrynum %d type %d desc %016llx", 438ab78f7adSJeremy Fitzhardinge __entry->dt, __entry->entrynum, __entry->type, 439ab78f7adSJeremy Fitzhardinge (unsigned long long)__entry->desc) 440ab78f7adSJeremy Fitzhardinge ); 441ab78f7adSJeremy Fitzhardinge 442ab78f7adSJeremy Fitzhardinge TRACE_EVENT(xen_cpu_set_ldt, 443ab78f7adSJeremy Fitzhardinge TP_PROTO(const void *addr, unsigned entries), 444ab78f7adSJeremy Fitzhardinge TP_ARGS(addr, entries), 445ab78f7adSJeremy Fitzhardinge TP_STRUCT__entry( 446ab78f7adSJeremy Fitzhardinge __field(const void *, addr) 447ab78f7adSJeremy Fitzhardinge __field(unsigned, entries) 448ab78f7adSJeremy Fitzhardinge ), 449ab78f7adSJeremy Fitzhardinge TP_fast_assign(__entry->addr = addr; 450ab78f7adSJeremy Fitzhardinge __entry->entries = entries), 451ab78f7adSJeremy Fitzhardinge TP_printk("addr %p entries %u", 452ab78f7adSJeremy Fitzhardinge __entry->addr, __entry->entries) 453ab78f7adSJeremy Fitzhardinge ); 454ab78f7adSJeremy Fitzhardinge 455ab78f7adSJeremy Fitzhardinge 456634355d4SJeremy Fitzhardinge #endif /* _TRACE_XEN_H */ 457634355d4SJeremy Fitzhardinge 458634355d4SJeremy Fitzhardinge /* This part must be outside protection */ 459634355d4SJeremy Fitzhardinge #include <trace/define_trace.h> 460