kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests 1/1] arm64: microbench: Move the read of the count register and the ISB operation out of the while loop
@ 2023-11-07  6:40 heqiong
  2023-11-07  8:40 ` Andrew Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: heqiong @ 2023-11-07  6:40 UTC (permalink / raw)
  To: kvm; +Cc: alexandru.elisei, heqiong

Reducing the impact of the cntvct_el0 register and isb() operation
on microbenchmark test results to improve testing accuracy and reduce
latency in test results.
---
 arm/micro-bench.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arm/micro-bench.c b/arm/micro-bench.c
index fbe59d03..6b940d56 100644
--- a/arm/micro-bench.c
+++ b/arm/micro-bench.c
@@ -346,17 +346,21 @@ static void loop_test(struct exit_test *test)
 		}
 	}
 
+	dsb(ish);
+	isb();
+	start = read_sysreg(cntpct_el0);
+	isb();
 	while (ntimes < test->times && total_ns.ns < NS_5_SECONDS) {
-		isb();
-		start = read_sysreg(cntvct_el0);
 		test->exec();
-		isb();
-		end = read_sysreg(cntvct_el0);
 
 		ntimes++;
-		total_ticks += (end - start);
-		ticks_to_ns_time(total_ticks, &total_ns);
 	}
+	dsb(ish);
+	isb();
+	end = read_sysreg(cntpct_el0);
+
+	total_ticks = end - start;
+	ticks_to_ns_time(total_ticks, &total_ns);
 
 	if (test->post) {
 		test->post(ntimes, &total_ticks);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-21 11:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07  6:40 [kvm-unit-tests 1/1] arm64: microbench: Move the read of the count register and the ISB operation out of the while loop heqiong
2023-11-07  8:40 ` Andrew Jones
2023-11-16  4:53   ` [kvm-unit-tests PATCH 1/1] arm64: microbench: Improve measurement accuracy of tests heqiong
2023-11-20  8:35     ` Andrew Jones
2023-11-20 17:25     ` Alexandru Elisei
2023-11-21 11:45     ` Andrew Jones
2023-11-07  9:07 ` [kvm-unit-tests 1/1] arm64: microbench: Move the read of the count register and the ISB operation out of the while loop Alexandru Elisei
2023-11-07  9:51 ` [kvm-unit-tests PATCH " heqiong
2023-11-07 12:49   ` Alexandru Elisei
2023-11-07 13:53   ` Zenghui Yu

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).