From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v5 ltp] Add Intel PT full trace mode basic test case
Date: Wed, 17 Oct 2018 16:02:44 +0200 [thread overview]
Message-ID: <20181017140244.GC31018@rei> (raw)
In-Reply-To: <20181017055929.28193-1-ammy.yi@intel.com>
Hi!
Pushed with following changes, thanks.
diff --git a/testcases/kernel/tracing/pt_test/pt_test.c b/testcases/kernel/tracing/pt_test/pt_test.c
index d46d7726e..517427992 100644
--- a/testcases/kernel/tracing/pt_test/pt_test.c
+++ b/testcases/kernel/tracing/pt_test/pt_test.c
@@ -7,7 +7,10 @@
/*
* This test will check if Intel PT(Intel Processer Trace) full trace mode is
- * working. It is only applied on X86 platforms.
+ * working.
+ *
+ * Intel CPU of 5th-generation Core (Broadwell) or newer is required for the test.
+ *
* kconfig requirement: CONFIG_PERF_EVENTS
*/
I found out that the perf manual says we need at least broadwell to run
the test, so I documented it here (and I had to borow recent enough
machine to check the test, since the newest I have is Ivy Bridge).
@@ -93,11 +96,11 @@ static void intel_pt_full_trace_check(void)
/* stop tracing */
SAFE_IOCTL(fde, PERF_EVENT_IOC_DISABLE);
- // check if there is some trace generated
+ /* check if there is some trace generated */
pmp = (struct perf_event_mmap_page *)bufm[0];
aux_head = *(volatile uint64_t *)&pmp->aux_head;
if (aux_head == 0) {
- tst_res(TFAIL, "There is no trace, so failed!");
+ tst_res(TFAIL, "There is no trace!");
return;
}
@@ -109,10 +112,13 @@ static void setup(void)
struct perf_event_attr attr = {};
buhsz = 2 * PAGESIZE;
- if (tst_dir_is_empty(INTEL_PT_PATH, 1))
- tst_brk(TCONF, "PT not enabled, please check kconfig!");
+ if (access(INTEL_PT_PATH, F_OK)) {
+ tst_brk(TCONF,
+ "Requires Intel Core 5th+ generation (Broadwell and newer)"
+ " and CONFIG_PERF_EVENTS enabled.");
+ }
The tst_dir_is_empty() does not work here because the directory does not
exists, at least on my machines, if the CPU does not support PT.
We usually use acess() with F_OK in these cases.
- //set attr for Intel PT trace
+ /* set attr for Intel PT trace */
attr.type = intel_pt_pmu_value(INTEL_PT_PMU_TYPE);
attr.read_format = PERF_FORMAT_ID | PERF_FORMAT_TOTAL_TIME_RUNNING |
PERF_FORMAT_TOTAL_TIME_ENABLED;
@@ -124,7 +130,7 @@ static void setup(void)
attr.exclude_user = 0;
attr.mmap = 1;
- //only get trace for own pid
+ /* only get trace for own pid */
fde = tst_syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
if (fde < 0) {
tst_res(TINFO, "Open Intel PT event failed!");
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2018-10-17 14:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-17 5:59 [LTP] [PATCH v5 ltp] Add Intel PT full trace mode basic test case Ammy Yi
2018-10-17 14:02 ` Cyril Hrubis [this message]
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=20181017140244.GC31018@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.