From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C5A1DD8 for ; Mon, 20 Nov 2023 09:25:58 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B532E1042; Mon, 20 Nov 2023 09:26:44 -0800 (PST) Received: from arm.com (e121798.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D5EDD3F7A6; Mon, 20 Nov 2023 09:25:57 -0800 (PST) Date: Mon, 20 Nov 2023 17:25:55 +0000 From: Alexandru Elisei To: heqiong Cc: andrew.jones@linux.dev, kvm@vger.kernel.org Subject: Re: [kvm-unit-tests PATCH 1/1] arm64: microbench: Improve measurement accuracy of tests Message-ID: References: <20231107-9b361591b5d43284d4394f8a@orel> <20231116045355.2045483-1-heqiong1557@phytium.com.cn> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231116045355.2045483-1-heqiong1557@phytium.com.cn> Hi, On Thu, Nov 16, 2023 at 12:53:55PM +0800, heqiong wrote: > 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. Sorry, lost track of which version is the latest - that's why patch version numbers are really useful! Everything look alright to me: Reviewed-by: Alexandru Elisei Thanks, Alex > > Signed-off-by: heqiong > --- > arm/micro-bench.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/arm/micro-bench.c b/arm/micro-bench.c > index fbe59d03..22408955 100644 > --- a/arm/micro-bench.c > +++ b/arm/micro-bench.c > @@ -24,7 +24,6 @@ > #include > #include > > -#define NS_5_SECONDS (5 * 1000 * 1000 * 1000UL) > #define QEMU_MMIO_ADDR 0x0a000008 > > static u32 cntfrq; > @@ -346,17 +345,21 @@ static void loop_test(struct exit_test *test) > } > } > > - while (ntimes < test->times && total_ns.ns < NS_5_SECONDS) { > - isb(); > - start = read_sysreg(cntvct_el0); > + dsb(ish); > + isb(); > + start = read_sysreg(cntvct_el0); > + isb(); > + while (ntimes < test->times) { > 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(cntvct_el0); > + > + total_ticks = end - start; > + ticks_to_ns_time(total_ticks, &total_ns); > > if (test->post) { > test->post(ntimes, &total_ticks); > -- > 2.39.3 >