From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
To: mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org,
Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Subject: [PATCH] powerpc/perf: Add PROBENOP macro for debug
Date: Sun, 19 Feb 2017 01:28:34 +0530 [thread overview]
Message-ID: <1487447914-7094-1-git-send-email-maddy@linux.vnet.ibm.com> (raw)
>From PowerISA v2.07, architecture provides a special NOP
instruction called "Probe-Nop" defined as "and 0,0,0".
This form of "and" is reserved for use exclusively by the
Performance Monitor.
Usage example:
Add PROBENOP() macro to __tlbie() in hash_native_64.c to
verify the number of TLBIE. Power8 provides "PM_TLBIE_FIN"
PMU event (r30058) to count "tlbie finished".
Power8 PMU event "PM_PROBE_NOP_DISP" (r40014) counts the
"ProbeNops dispatched".
With modified kernel booted, output from perf:
# ./perf stat -e r30058,r40014 ls
....
Performance counter stats for 'ls':
7 r30058
7 r40014
0.003296959 seconds time elapsed
Macro comes handy when want to count specific instructions
which may or may not have a PMU event.
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/ppc-opcode.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index c4ced1d01d57..61c62a1a402c 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -462,4 +462,14 @@
((IH & 0x7) << 21))
#define PPC_INVALIDATE_ERAT PPC_SLBIA(7)
+/*
+ * From PowerISA v2.07, architecture provides a special NOP instruction
+ * called "Probe-Nop" defined as "and 0,0,0". This form of "and" is
+ * reserved for use exclusively by the Performance Monitor.
+ */
+#define _PROBENOP(x) stringify_in_c(.long PPC_INST_AND | \
+ ___PPC_RS(x) | \
+ ___PPC_RA(x) | \
+ ___PPC_RB(x))
+#define PROBENOP(x) asm volatile(_PROBENOP(x))
#endif /* _ASM_POWERPC_PPC_OPCODE_H */
--
2.7.4
next reply other threads:[~2017-02-18 19:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-18 19:58 Madhavan Srinivasan [this message]
2017-03-02 5:38 ` [PATCH] powerpc/perf: Add PROBENOP macro for debug Balbir Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487447914-7094-1-git-send-email-maddy@linux.vnet.ibm.com \
--to=maddy@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).