]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc/mm: Trace tlbie(l) instructions
authorBalbir Singh <bsingharora@gmail.com>
Tue, 11 Apr 2017 05:23:25 +0000 (15:23 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 23 Jun 2017 11:14:49 +0000 (21:14 +1000)
Add a trace point for tlbie(l) (Translation Lookaside Buffer Invalidate
Entry (Local)) instructions.

The tlbie instruction has changed over the years, so not all versions
accept the same operands. Use the ISA v3 field operands because they are
the most verbose, we may change them in future.

Example output:

  qemu-system-ppc-5371  [016]  1412.369519: tlbie:
   tlbie with lpid 0, local 1, rb=67bd8900174c11c1, rs=0, ric=0 prs=0 r=0

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
[mpe: Add some missing trace_tlbie()s, reword change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/trace.h
arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/powerpc/mm/hash_native_64.c
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/pgtable-radix.c
arch/powerpc/mm/pgtable_64.c
arch/powerpc/mm/tlb-radix.c

index c05cef6ee06c82c4a68c77ec95c48c55ac2e7010..18f168aebae39a1f1d6a66676088a630fee5fe18 100644 (file)
@@ -168,6 +168,39 @@ TRACE_EVENT(hash_fault,
                      __entry->addr, __entry->access, __entry->trap)
 );
 
+
+TRACE_EVENT(tlbie,
+
+       TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
+               unsigned long rs, unsigned long ric, unsigned long prs,
+               unsigned long r),
+       TP_ARGS(lpid, local, rb, rs, ric, prs, r),
+       TP_STRUCT__entry(
+               __field(unsigned long, lpid)
+               __field(unsigned long, local)
+               __field(unsigned long, rb)
+               __field(unsigned long, rs)
+               __field(unsigned long, ric)
+               __field(unsigned long, prs)
+               __field(unsigned long, r)
+               ),
+
+       TP_fast_assign(
+               __entry->lpid = lpid;
+               __entry->local = local;
+               __entry->rb = rb;
+               __entry->rs = rs;
+               __entry->ric = ric;
+               __entry->prs = prs;
+               __entry->r = r;
+               ),
+
+       TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
+               "prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
+               __entry->rb, __entry->rs, __entry->ric, __entry->prs,
+               __entry->r)
+);
+
 #endif /* _TRACE_POWERPC_H */
 
 #undef TRACE_INCLUDE_PATH
index ce6f2121fffe46857bf4b250c06ad3916ac24aeb..584c74c8119f0db6f4cb76023dfa07ee26a941bd 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/log2.h>
 
 #include <asm/tlbflush.h>
+#include <asm/trace.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
 #include <asm/book3s/64/mmu-hash.h>
@@ -443,17 +444,23 @@ static void do_tlbies(struct kvm *kvm, unsigned long *rbvalues,
                        cpu_relax();
                if (need_sync)
                        asm volatile("ptesync" : : : "memory");
-               for (i = 0; i < npages; ++i)
+               for (i = 0; i < npages; ++i) {
                        asm volatile(PPC_TLBIE_5(%0,%1,0,0,0) : :
                                     "r" (rbvalues[i]), "r" (kvm->arch.lpid));
+                       trace_tlbie(kvm->arch.lpid, 0, rbvalues[i],
+                               kvm->arch.lpid, 0, 0, 0);
+               }
                asm volatile("eieio; tlbsync; ptesync" : : : "memory");
                kvm->arch.tlbie_lock = 0;
        } else {
                if (need_sync)
                        asm volatile("ptesync" : : : "memory");
-               for (i = 0; i < npages; ++i)
+               for (i = 0; i < npages; ++i) {
                        asm volatile(PPC_TLBIEL(%0,%1,0,0,0) : :
                                     "r" (rbvalues[i]), "r" (0));
+                       trace_tlbie(kvm->arch.lpid, 1, rbvalues[i],
+                               0, 0, 0, 0);
+               }
                asm volatile("ptesync" : : : "memory");
        }
 }
index 65bb8f33b399bf13bcedd115f4ce86ed1c0dad5b..bdaac28193f7d4374e73b69e1361e96e0ef770f9 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
+#include <asm/trace.h>
 #include <asm/tlb.h>
 #include <asm/cputable.h>
 #include <asm/udbg.h>
@@ -98,6 +99,7 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize)
                             : "memory");
                break;
        }
+       trace_tlbie(0, 0, va, 0, 0, 0, 0);
 }
 
 static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)
@@ -147,6 +149,7 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)
                             : "memory");
                break;
        }
+       trace_tlbie(0, 1, va, 0, 0, 0, 0);
 
 }
 
index f2095ce9d4b029fb139c34a5fcf4eb81e9d88936..7a20669c19e7258d979d60a19f3acec378c9dbad 100644 (file)
@@ -810,6 +810,8 @@ static void update_hid_for_hash(void)
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(0), "i"(0), "i"(2), "r"(0) : "memory");
        asm volatile("eieio; tlbsync; ptesync; isync; slbia": : :"memory");
+       trace_tlbie(0, 0, rb, 0, 2, 0, 0);
+
        /*
         * now switch the HID
         */
index 6c062f92b9e4b4843f4215cac6112aa3abb486ec..419199d689280318a46a193b396ad948ff5a5cbc 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/firmware.h>
 #include <asm/powernv.h>
 #include <asm/sections.h>
+#include <asm/trace.h>
 
 #include <trace/events/thp.h>
 
@@ -198,6 +199,7 @@ static void __init radix_init_pgtable(void)
        asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
                     "r" (TLBIEL_INVAL_SET_LPID), "r" (0));
        asm volatile("eieio; tlbsync; ptesync" : : : "memory");
+       trace_tlbie(0, 0, TLBIEL_INVAL_SET_LPID, 0, 2, 1, 1);
 }
 
 static void __init radix_init_partition_table(void)
@@ -324,6 +326,9 @@ static void update_hid_for_radix(void)
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(1), "i"(1), "i"(2), "r"(0) : "memory");
        asm volatile("eieio; tlbsync; ptesync; isync; slbia": : :"memory");
+       trace_tlbie(0, 0, rb, 0, 2, 0, 1);
+       trace_tlbie(0, 0, rb, 0, 2, 1, 1);
+
        /*
         * now switch the HID
         */
index 8d2d6742a465158f3764dc74a46ba3bad355bb7f..1feb36e58a45c3bf6503b364c469f387f165ce3a 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/smp.h>
 #include <asm/machdep.h>
 #include <asm/tlb.h>
+#include <asm/trace.h>
 #include <asm/processor.h>
 #include <asm/cputable.h>
 #include <asm/sections.h>
@@ -477,12 +478,15 @@ void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
         * use of this partition ID was, not the new use.
         */
        asm volatile("ptesync" : : : "memory");
-       if (old & PATB_HR)
+       if (old & PATB_HR) {
                asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
                             "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
-       else
+               trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 1);
+       } else {
                asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :
                             "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+               trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 0);
+       }
        asm volatile("eieio; tlbsync; ptesync" : : : "memory");
 }
 EXPORT_SYMBOL_GPL(mmu_partition_table_set_entry);
index 02e71402fdd3fb06d1e6f6c3efc76fe02138fb9f..744e0164ecf58551f036ef30e19a79638adcaa76 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
+#include <asm/trace.h>
 
 
 #define RIC_FLUSH_TLB 0
@@ -35,6 +36,7 @@ static inline void __tlbiel_pid(unsigned long pid, int set,
 
        asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
+       trace_tlbie(0, 1, rb, rs, ric, prs, r);
 }
 
 /*
@@ -87,6 +89,7 @@ static inline void _tlbie_pid(unsigned long pid, unsigned long ric)
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(0, 0, rb, rs, ric, prs, r);
 }
 
 static inline void _tlbiel_va(unsigned long va, unsigned long pid,
@@ -104,6 +107,7 @@ static inline void _tlbiel_va(unsigned long va, unsigned long pid,
        asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("ptesync": : :"memory");
+       trace_tlbie(0, 1, rb, rs, ric, prs, r);
 }
 
 static inline void _tlbie_va(unsigned long va, unsigned long pid,
@@ -121,6 +125,7 @@ static inline void _tlbie_va(unsigned long va, unsigned long pid,
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(0, 0, rb, rs, ric, prs, r);
 }
 
 /*
@@ -377,6 +382,7 @@ void radix__flush_tlb_lpid_va(unsigned long lpid, unsigned long gpa,
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(lpid, 0, rb, rs, ric, prs, r);
 }
 EXPORT_SYMBOL(radix__flush_tlb_lpid_va);
 
@@ -394,6 +400,7 @@ void radix__flush_tlb_lpid(unsigned long lpid)
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(lpid, 0, rb, rs, ric, prs, r);
 }
 EXPORT_SYMBOL(radix__flush_tlb_lpid);
 
@@ -420,12 +427,14 @@ void radix__flush_tlb_all(void)
         */
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(1), "i"(ric), "r"(rs) : "memory");
+       trace_tlbie(0, 0, rb, rs, ric, prs, r);
        /*
         * now flush host entires by passing PRS = 0 and LPID == 0
         */
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(0) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(0, 0, rb, 0, ric, prs, r);
 }
 
 void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,