From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="B0MCek+J" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [IPv6:2001:41d0:1004:224b::ac]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3079E100 for ; Tue, 21 Nov 2023 03:45:13 -0800 (PST) Date: Tue, 21 Nov 2023 12:45:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700567111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m9WWccSpGejUdHZ25D17eXFhs6gmcy6GZLru96f1wf8=; b=B0MCek+J6bJ8Pnq5/JcUMGdi+OuicJy9YASljlKAzJRPlS47L63Pt0SqNrNrT320UehzDl 3ycsbsIy+YkmNNneXMiGGneMhvlsPRKPBj4DimQrPQQhApEKJ7cvqi6pIrX1PEHklou2k1 SPqClLRrRoQpdVW1hUeSBwxLI9onnjo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Andrew Jones To: heqiong Cc: alexandru.elisei@arm.com, kvm@vger.kernel.org Subject: Re: [kvm-unit-tests PATCH 1/1] arm64: microbench: Improve measurement accuracy of tests Message-ID: <20231121-c0f2c8b7b9047d0b3fadb1cc@orel> 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> X-Migadu-Flow: FLOW_OUT 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. > > 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 > Merged into https://gitlab.com/kvm-unit-tests/kvm-unit-tests master Thanks, drew