* [PATCH v4] perf/x86/intel: Add support for MISPREDICT bit on Knights Landing cpus
@ 2018-08-02 1:38 Jacek Tomaka
2018-08-02 10:07 ` Thomas Gleixner
2018-09-10 10:03 ` [tip:perf/urgent] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs tip-bot for Jacek Tomaka
0 siblings, 2 replies; 4+ messages in thread
From: Jacek Tomaka @ 2018-08-02 1:38 UTC (permalink / raw)
To: Peter Zijlstra, linux-kernel, Ingo Molnar, Thomas Gleixner; +Cc: Jacek Tomaka
From: Jacek Tomaka <jacek.tomaka@poczta.fm>
Problem: perf did not show branch predicted/mispredicted bit in brstack.
Output of perf -F brstack for profile collected
Before:
0x4fdbcd/0x4fdc03/-/-/-/0
0x45f4c1/0x4fdba0/-/-/-/0
0x45f544/0x45f4bb/-/-/-/0
0x45f555/0x45f53c/-/-/-/0
0x7f66901cc24b/0x45f555/-/-/-/0
0x7f66901cc22e/0x7f66901cc23d/-/-/-/0
0x7f66901cc1ff/0x7f66901cc20f/-/-/-/0
0x7f66901cc1e8/0x7f66901cc1fc/-/-/-/0
After:
0x4fdbcd/0x4fdc03/P/-/-/0
0x45f4c1/0x4fdba0/P/-/-/0
0x45f544/0x45f4bb/P/-/-/0
0x45f555/0x45f53c/P/-/-/0
0x7f66901cc24b/0x45f555/P/-/-/0
0x7f66901cc22e/0x7f66901cc23d/P/-/-/0
0x7f66901cc1ff/0x7f66901cc20f/P/-/-/0
0x7f66901cc1e8/0x7f66901cc1fc/P/-/-/0
Cause:
As mentioned in Software Development Manual vol 3, 17.4.8.1,
IA32_PERF_CAPABILITIES[5:0] indicates the format of the address that is
stored in the LBR stack. Knights Landing reports 1 (LBR_FORMAT_LIP) as
its format. Despite that, registers containing FROM address of the branch,
do have MISPREDICT bit but because of the format indicated in
IA32_PERF_CAPABILITIES[5:0], LBR did not read MISPREDICT bit.
Solution:
Teach LBR about above Knights Landing quirk and make it read MISPREDICT bit.
Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
---
arch/x86/events/intel/lbr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index cf372b9055..81fe5047c6 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -1230,4 +1230,8 @@ void intel_pmu_lbr_init_knl(void)
x86_pmu.lbr_sel_mask = LBR_SEL_MASK;
x86_pmu.lbr_sel_map = snb_lbr_sel_map;
+
+ /* Knights Landing does have MISPREDICT bit */
+ if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_LIP)
+ x86_pmu.intel_cap.lbr_format = LBR_FORMAT_EIP_FLAGS;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4] perf/x86/intel: Add support for MISPREDICT bit on Knights Landing cpus
2018-08-02 1:38 [PATCH v4] perf/x86/intel: Add support for MISPREDICT bit on Knights Landing cpus Jacek Tomaka
@ 2018-08-02 10:07 ` Thomas Gleixner
2018-08-27 11:50 ` Jacek Tomaka
2018-09-10 10:03 ` [tip:perf/urgent] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs tip-bot for Jacek Tomaka
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2018-08-02 10:07 UTC (permalink / raw)
To: Jacek Tomaka; +Cc: Peter Zijlstra, linux-kernel, Ingo Molnar, Jacek Tomaka
On Thu, 2 Aug 2018, Jacek Tomaka wrote:
The actiual purpose of sending V4 which is identical to V3 is?
>
> Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
> ---
It's good practice to add a
V3 -> V4: changed foo
V2 -> V3: fixed bla
...
section to patches which have more than one version.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4] perf/x86/intel: Add support for MISPREDICT bit on Knights Landing cpus
2018-08-02 10:07 ` Thomas Gleixner
@ 2018-08-27 11:50 ` Jacek Tomaka
0 siblings, 0 replies; 4+ messages in thread
From: Jacek Tomaka @ 2018-08-27 11:50 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Jacek Tomaka, Peter Zijlstra, linux-kernel, Ingo Molnar
> On 2 Aug 2018, at 6:07 pm, Thomas Gleixner <tglx@linutronix.de> wrote:
>
> The actiual purpose of sending V4 which is identical to V3 is?
>
>>
>> Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
>> ---
Yes, thanks. I missed it initially, sorry.
> It's good practice to add a
>
> V3 -> V4: changed foo
> V2 -> V3: fixed bla
> ...
>
> section to patches which have more than one version.
Sure. Would you like me to send it for this patch as well?
Regards.
Jacek Tomaka
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/urgent] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs
2018-08-02 1:38 [PATCH v4] perf/x86/intel: Add support for MISPREDICT bit on Knights Landing cpus Jacek Tomaka
2018-08-02 10:07 ` Thomas Gleixner
@ 2018-09-10 10:03 ` tip-bot for Jacek Tomaka
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Jacek Tomaka @ 2018-09-10 10:03 UTC (permalink / raw)
To: linux-tip-commits
Cc: jacek.tomaka, mingo, peterz, linux-kernel, tglx, torvalds, hpa
Commit-ID: 16160c1946b702dcfa95ef63389a56deb2f1c7cb
Gitweb: https://git.kernel.org/tip/16160c1946b702dcfa95ef63389a56deb2f1c7cb
Author: Jacek Tomaka <jacek.tomaka@poczta.fm>
AuthorDate: Thu, 2 Aug 2018 09:38:30 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 10 Sep 2018 10:03:01 +0200
perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs
Problem: perf did not show branch predicted/mispredicted bit in brstack.
Output of perf -F brstack for profile collected
Before:
0x4fdbcd/0x4fdc03/-/-/-/0
0x45f4c1/0x4fdba0/-/-/-/0
0x45f544/0x45f4bb/-/-/-/0
0x45f555/0x45f53c/-/-/-/0
0x7f66901cc24b/0x45f555/-/-/-/0
0x7f66901cc22e/0x7f66901cc23d/-/-/-/0
0x7f66901cc1ff/0x7f66901cc20f/-/-/-/0
0x7f66901cc1e8/0x7f66901cc1fc/-/-/-/0
After:
0x4fdbcd/0x4fdc03/P/-/-/0
0x45f4c1/0x4fdba0/P/-/-/0
0x45f544/0x45f4bb/P/-/-/0
0x45f555/0x45f53c/P/-/-/0
0x7f66901cc24b/0x45f555/P/-/-/0
0x7f66901cc22e/0x7f66901cc23d/P/-/-/0
0x7f66901cc1ff/0x7f66901cc20f/P/-/-/0
0x7f66901cc1e8/0x7f66901cc1fc/P/-/-/0
Cause:
As mentioned in Software Development Manual vol 3, 17.4.8.1,
IA32_PERF_CAPABILITIES[5:0] indicates the format of the address that is
stored in the LBR stack. Knights Landing reports 1 (LBR_FORMAT_LIP) as
its format. Despite that, registers containing FROM address of the branch,
do have MISPREDICT bit but because of the format indicated in
IA32_PERF_CAPABILITIES[5:0], LBR did not read MISPREDICT bit.
Solution:
Teach LBR about above Knights Landing quirk and make it read MISPREDICT bit.
Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180802013830.10600-1-jacekt@dugeo.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/events/intel/lbr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index f3e006bed9a7..c88ed39582a1 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -1272,4 +1272,8 @@ void intel_pmu_lbr_init_knl(void)
x86_pmu.lbr_sel_mask = LBR_SEL_MASK;
x86_pmu.lbr_sel_map = snb_lbr_sel_map;
+
+ /* Knights Landing does have MISPREDICT bit */
+ if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_LIP)
+ x86_pmu.intel_cap.lbr_format = LBR_FORMAT_EIP_FLAGS;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-10 10:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02 1:38 [PATCH v4] perf/x86/intel: Add support for MISPREDICT bit on Knights Landing cpus Jacek Tomaka
2018-08-02 10:07 ` Thomas Gleixner
2018-08-27 11:50 ` Jacek Tomaka
2018-09-10 10:03 ` [tip:perf/urgent] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs tip-bot for Jacek Tomaka
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).