* [LTP] [PATCH] pt_test: skip pt_disable_branch on Broadwell CPUs
@ 2019-10-28 13:33 Jan Stancek
2019-11-01 7:12 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2019-10-28 13:33 UTC (permalink / raw)
To: ltp
commit d35869ba348d ("perf/x86/intel/pt: Allow the disabling of branch tracing")
disallows not setting BRANCH_EN due to erratum BDM106 on Broadwell CPUs.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/tracing/pt_test/pt_test.c | 31 ++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/testcases/kernel/tracing/pt_test/pt_test.c b/testcases/kernel/tracing/pt_test/pt_test.c
index 1095e800f721..f9903fdcd396 100644
--- a/testcases/kernel/tracing/pt_test/pt_test.c
+++ b/testcases/kernel/tracing/pt_test/pt_test.c
@@ -124,6 +124,32 @@ static void intel_pt_trace_check(void)
tst_res(TPASS, "perf trace test passed");
}
+static int is_affected_by_erratum_BDM106(void)
+{
+ int family = -1, model = -1;
+
+ if (FILE_LINES_SCANF("/proc/cpuinfo", "cpu family%*s%d", &family)
+ || family != 6)
+ return 0;
+
+ if (!FILE_LINES_SCANF("/proc/cpuinfo", "model%*s%d", &model)) {
+ tst_res(TINFO, "Intel FAM6 model %d", model);
+
+ switch (model) {
+ case 0x3D: /* INTEL_FAM6_BROADWELL */
+ /* fallthrough */
+ case 0x47: /* INTEL_FAM6_BROADWELL_G */
+ /* fallthrough */
+ case 0x4F: /* INTEL_FAM6_BROADWELL_X */
+ /* fallthrough */
+ case 0x56: /* INTEL_FAM6_BROADWELL_D */
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static void setup(void)
{
struct perf_event_attr attr = {};
@@ -145,6 +171,11 @@ static void setup(void)
attr.size = sizeof(struct perf_event_attr);
attr.mmap = 1;
if (str_branch_flag) {
+ if (is_affected_by_erratum_BDM106()) {
+ tst_brk(TCONF, "erratum BDM106 disallows not "
+ "setting BRANCH_EN on this CPU");
+ }
+
tst_res(TINFO, "Intel PT will disable branch trace");
attr.config |= 1;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [LTP] [PATCH] pt_test: skip pt_disable_branch on Broadwell CPUs
2019-10-28 13:33 [LTP] [PATCH] pt_test: skip pt_disable_branch on Broadwell CPUs Jan Stancek
@ 2019-11-01 7:12 ` Petr Vorel
2019-11-04 15:55 ` Jan Stancek
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2019-11-01 7:12 UTC (permalink / raw)
To: ltp
Hi Jan,
> commit d35869ba348d ("perf/x86/intel/pt: Allow the disabling of branch tracing")
> disallows not setting BRANCH_EN due to erratum BDM106 on Broadwell CPUs.
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
...
> @@ -145,6 +171,11 @@ static void setup(void)
> attr.size = sizeof(struct perf_event_attr);
> attr.mmap = 1;
> if (str_branch_flag) {
> + if (is_affected_by_erratum_BDM106()) {
> + tst_brk(TCONF, "erratum BDM106 disallows not "
> + "setting BRANCH_EN on this CPU");
I'd join string (to be on single line), even it's longer than 80.
(better for grep)
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread* [LTP] [PATCH] pt_test: skip pt_disable_branch on Broadwell CPUs
2019-11-01 7:12 ` Petr Vorel
@ 2019-11-04 15:55 ` Jan Stancek
0 siblings, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2019-11-04 15:55 UTC (permalink / raw)
To: ltp
----- Original Message -----
> Hi Jan,
>
> > commit d35869ba348d ("perf/x86/intel/pt: Allow the disabling of branch
> > tracing")
> > disallows not setting BRANCH_EN due to erratum BDM106 on Broadwell CPUs.
>
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
Pushed.
>
> ...
> > @@ -145,6 +171,11 @@ static void setup(void)
> > attr.size = sizeof(struct perf_event_attr);
> > attr.mmap = 1;
> > if (str_branch_flag) {
> > + if (is_affected_by_erratum_BDM106()) {
> > + tst_brk(TCONF, "erratum BDM106 disallows not "
> > + "setting BRANCH_EN on this CPU");
> I'd join string (to be on single line), even it's longer than 80.
> (better for grep)
>
> Kind regards,
> Petr
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-04 15:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-28 13:33 [LTP] [PATCH] pt_test: skip pt_disable_branch on Broadwell CPUs Jan Stancek
2019-11-01 7:12 ` Petr Vorel
2019-11-04 15:55 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox