lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20211116170754.76409-1-kim.phillips@amd.com>
Date:   Tue, 16 Nov 2021 11:07:54 -0600
From:   Kim Phillips <kim.phillips@....com>
To:     Borislav Petkov <bp@...en8.de>, Borislav Petkov <bp@...e.de>,
        "Peter Zijlstra" <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>, Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>, <kim.phillips@....com>
CC:     <linux-kernel@...r.kernel.org>
Subject: [PATCH] perf/x86/amd: Use faster rdpmc instruction when waiting for overflow

The relatively new amd_pmu_wait_on_overflow uses rdmsr.
Update it to use the faster rdpmc instruction.

Signed-off-by: Kim Phillips <kim.phillips@....com>
---
 arch/x86/events/amd/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 9687a8aef01c..c36cb0c6f9e1 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -587,6 +587,8 @@ static void amd_pmu_cpu_dead(int cpu)
 
 static void amd_pmu_wait_on_overflow(int idx)
 {
+	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
+	struct hw_perf_event *hwc = &cpuc->events[idx]->hw;
 	unsigned int i;
 	u64 counter;
 
@@ -596,7 +598,7 @@ static void amd_pmu_wait_on_overflow(int idx)
 	 * forever...
 	 */
 	for (i = 0; i < OVERFLOW_WAIT_COUNT; i++) {
-		rdmsrl(x86_pmu_event_addr(idx), counter);
+		rdpmcl(hwc->event_base_rdpmc, counter);
 		if (counter & (1ULL << (x86_pmu.cntval_bits - 1)))
 			break;
 
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ