xen/trace: add ptpage alloc/release tracepoints
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Fri, 17 Dec 2010 22:21:17 +0000 (14:21 -0800)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Mon, 18 Jul 2011 22:43:27 +0000 (15:43 -0700)
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
arch/x86/xen/mmu.c
include/trace/events/xen.h

index 43fa7771ccb9e475491f5b29c2424653393ac758..f2160997287ef5ac52e6bb95ae51cde1f39038a6 100644 (file)
@@ -1478,8 +1478,11 @@ static void __init xen_release_pmd_init(unsigned long pfn)
 static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned level)
 {
        struct page *page = pfn_to_page(pfn);
+       int pinned = PagePinned(virt_to_page(mm->pgd));
+       trace_xen_mmu_alloc_ptpage(mm, pfn, level, pinned);
 
-       if (PagePinned(virt_to_page(mm->pgd))) {
+       if (pinned) {
                SetPagePinned(page);
 
                if (!PageHighMem(page)) {
@@ -1508,8 +1511,11 @@ static void xen_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
 static void xen_release_ptpage(unsigned long pfn, unsigned level)
 {
        struct page *page = pfn_to_page(pfn);
+       bool pinned = PagePinned(page);
 
-       if (PagePinned(page)) {
+       trace_xen_mmu_release_ptpage(pfn, level, pinned);
+
+       if (pinned) {
                if (!PageHighMem(page)) {
                        if (level == PT_PTE && USE_SPLIT_PTLOCKS)
                                pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
index 08089e82f77eed47cd8be04c77f63e73a367d769..f46fdb4afb8930bd928a0b7edcb4e71e116158c0 100644 (file)
@@ -347,6 +347,39 @@ TRACE_EVENT(xen_mmu_ptep_modify_prot_commit,
                      (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
        );
 
+TRACE_EVENT(xen_mmu_alloc_ptpage,
+           TP_PROTO(struct mm_struct *mm, unsigned long pfn, unsigned level, bool pinned),
+           TP_ARGS(mm, pfn, level, pinned),
+           TP_STRUCT__entry(
+                   __field(struct mm_struct *, mm)
+                   __field(unsigned long, pfn)
+                   __field(unsigned, level)
+                   __field(bool, pinned)
+                   ),
+           TP_fast_assign(__entry->mm = mm;
+                          __entry->pfn = pfn;
+                          __entry->level = level;
+                          __entry->pinned = pinned),
+           TP_printk("mm %p  pfn %lx  level %d  %spinned",
+                     __entry->mm, __entry->pfn, __entry->level,
+                     __entry->pinned ? "" : "un")
+       );
+
+TRACE_EVENT(xen_mmu_release_ptpage,
+           TP_PROTO(unsigned long pfn, unsigned level, bool pinned),
+           TP_ARGS(pfn, level, pinned),
+           TP_STRUCT__entry(
+                   __field(unsigned long, pfn)
+                   __field(unsigned, level)
+                   __field(bool, pinned)
+                   ),
+           TP_fast_assign(__entry->pfn = pfn;
+                          __entry->level = level;
+                          __entry->pinned = pinned),
+           TP_printk("pfn %lx  level %d  %spinned",
+                     __entry->pfn, __entry->level,
+                     __entry->pinned ? "" : "un")
+       );
 
 #endif /*  _TRACE_XEN_H */