From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 021CCC4338F for ; Thu, 29 Jul 2021 09:53:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1C2A61052 for ; Thu, 29 Jul 2021 09:53:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235058AbhG2Jxu (ORCPT ); Thu, 29 Jul 2021 05:53:50 -0400 Received: from foss.arm.com ([217.140.110.172]:43752 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbhG2Jxt (ORCPT ); Thu, 29 Jul 2021 05:53:49 -0400 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 92BF56D; Thu, 29 Jul 2021 02:53:46 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC38A3F73D; Thu, 29 Jul 2021 02:53:45 -0700 (PDT) Date: Thu, 29 Jul 2021 10:52:24 +0100 From: Dave Martin To: Mark Brown Cc: Catalin Marinas , Will Deacon , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 1/4] kselftest/arm64: Provide a helper binary and "library" for SVE RDVL Message-ID: <20210729095222.GH1724@arm.com> References: <20210728163318.51492-1-broonie@kernel.org> <20210728163318.51492-2-broonie@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210728163318.51492-2-broonie@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Wed, Jul 28, 2021 at 05:33:15PM +0100, Mark Brown wrote: > SVE provides an instruction RDVL which reports the currently configured > vector length. In order to validate that our vector length configuration > interfaces are working correctly without having to build the C code for > our test programs with SVE enabled provide a trivial assembly library > with a C callable function that executes RDVL. Since these interfaces > also control behaviour on exec*() provide a trivial wrapper program which > reports the currently configured vector length on stdout, tests can use > this to verify that behaviour on exec*() is as expected. > > In preparation for providing similar helper functionality for SME, the > Scalable Matrix Extension, which allows separately configured vector > lengths to be read back both the assembler function and wrapper binary > have SVE included in their name. > > Signed-off-by: Mark Brown Reviewed-by: Dave Martin (With or without a couple of trivial nits below.) > --- > tools/testing/selftests/arm64/fp/.gitignore | 1 + > tools/testing/selftests/arm64/fp/Makefile | 6 +++++- > tools/testing/selftests/arm64/fp/rdvl-sve.c | 14 ++++++++++++++ > tools/testing/selftests/arm64/fp/rdvl.S | 9 +++++++++ > tools/testing/selftests/arm64/fp/rdvl.h | 8 ++++++++ > 5 files changed, 37 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/arm64/fp/rdvl-sve.c > create mode 100644 tools/testing/selftests/arm64/fp/rdvl.S > create mode 100644 tools/testing/selftests/arm64/fp/rdvl.h > > diff --git a/tools/testing/selftests/arm64/fp/.gitignore b/tools/testing/selftests/arm64/fp/.gitignore > index d66f76d2a650..6b53a7b60fee 100644 > --- a/tools/testing/selftests/arm64/fp/.gitignore > +++ b/tools/testing/selftests/arm64/fp/.gitignore > @@ -1,4 +1,5 @@ > fpsimd-test > +rdvl-sve > sve-probe-vls > sve-ptrace > sve-test > diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile > index a57009d3a0dc..ed62e7003b96 100644 > --- a/tools/testing/selftests/arm64/fp/Makefile > +++ b/tools/testing/selftests/arm64/fp/Makefile > @@ -2,12 +2,16 @@ > > CFLAGS += -I../../../../../usr/include/ > TEST_GEN_PROGS := sve-ptrace sve-probe-vls > -TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress sve-test sve-stress vlset > +TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress \ > + rdvl-sve \ > + sve-test sve-stress \ > + vlset > > all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED) > > fpsimd-test: fpsimd-test.o > $(CC) -nostdlib $^ -o $@ > +rdvl-sve: rdvl-sve.o rdvl.o > sve-ptrace: sve-ptrace.o sve-ptrace-asm.o > sve-probe-vls: sve-probe-vls.o > sve-test: sve-test.o > diff --git a/tools/testing/selftests/arm64/fp/rdvl-sve.c b/tools/testing/selftests/arm64/fp/rdvl-sve.c > new file mode 100644 > index 000000000000..7f8a13a18f5d > --- /dev/null > +++ b/tools/testing/selftests/arm64/fp/rdvl-sve.c > @@ -0,0 +1,14 @@ > +// SPDX-License-Identifier: GPL-2.0-only > + > +#include > + > +#include "rdvl.h" > + > +int main(void) > +{ > + int vl = rdvl_sve(); > + > + printf("%d\n", vl); > + > + return 0; For consistency with the changes in vec-syscfg, we could use EXIT_SUCCESS here. Although it's hard to see what could go wrong I/O-wise that doesn't involve vec-syscfg itself having gone wrong, it's probably good practice to do the final error check: if (ferror(stdout) || fclose(stdout)) return EXIT_FAILURE; return EXIT_SUCCESS; (In reality, people rarely seem to bother with this, so I'm not going to lose sleep if we don't do it...) > +} > diff --git a/tools/testing/selftests/arm64/fp/rdvl.S b/tools/testing/selftests/arm64/fp/rdvl.S > new file mode 100644 > index 000000000000..6e76dd720b87 > --- /dev/null > +++ b/tools/testing/selftests/arm64/fp/rdvl.S > @@ -0,0 +1,9 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +// Copyright (C) 2021 ARM Limited. > + > +.arch_extension sve > + > +.globl rdvl_sve Should we stick a .type rdvl_sve, @function here? This may avoid surprises with future toolchain behaviours. Probably doesn't matter, but I have bad memories of Thumb-2... Lacking this annotation is widespread though, as well as being de facto standard before awkward architectures came along. If the selftests have access to the ENTRY() macro we could use that, but I'm guessing that isn't exported for userspace. > +rdvl_sve: > + rdvl x0, #1 > + ret > diff --git a/tools/testing/selftests/arm64/fp/rdvl.h b/tools/testing/selftests/arm64/fp/rdvl.h > new file mode 100644 > index 000000000000..7c9d953fc9e7 > --- /dev/null > +++ b/tools/testing/selftests/arm64/fp/rdvl.h > @@ -0,0 +1,8 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > + > +#ifndef RDVL_H > +#define RDVL_H > + > +int rdvl_sve(void); > + > +#endif > -- > 2.20.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD2A5C4338F for ; Thu, 29 Jul 2021 09:55:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F64B61054 for ; Thu, 29 Jul 2021 09:55:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7F64B61054 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mwGNyHB/fQMpGuOmXkD+6QDLEymfTZVsZcjZFsbc+WA=; b=REeJ/LWJhDK3p/ 3RGGO6mBFeq/2bWapw0x+vdGKwsRmVPLHjph3kdWYb1oSvKexhoMOQHuAtC5Oj0pzW9UFUcV3uq1O D+0f7Vo3xzKUefdhGFf3TzZxxkBgUvaA3GHoLuWK5esO6Yo7mflEJFcIK5e+gVquoF503o2gxnQns iYHFpV6IrF8ksVw0H5ZmFsb6ffdwYUOutbaHKTxCjvHn6GVw6HGD+fpH73pT4X9ToeVrM/EtYaKRI uDr0N+8bCgIJ2xOMg6E8xOWojSLK6Ae+DBGBcIZP8RTYs1g8us1HnxAYzGDTpFV2qXuC/fUFmnQQ3 xPMVW1Pv/j6YJz+sM2vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m92jk-003iar-K8; Thu, 29 Jul 2021 09:53:56 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m92jg-003iaA-2y for linux-arm-kernel@lists.infradead.org; Thu, 29 Jul 2021 09:53:53 +0000 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 92BF56D; Thu, 29 Jul 2021 02:53:46 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC38A3F73D; Thu, 29 Jul 2021 02:53:45 -0700 (PDT) Date: Thu, 29 Jul 2021 10:52:24 +0100 From: Dave Martin To: Mark Brown Cc: Catalin Marinas , Will Deacon , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 1/4] kselftest/arm64: Provide a helper binary and "library" for SVE RDVL Message-ID: <20210729095222.GH1724@arm.com> References: <20210728163318.51492-1-broonie@kernel.org> <20210728163318.51492-2-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210728163318.51492-2-broonie@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210729_025352_268625_98571684 X-CRM114-Status: GOOD ( 29.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 28, 2021 at 05:33:15PM +0100, Mark Brown wrote: > SVE provides an instruction RDVL which reports the currently configured > vector length. In order to validate that our vector length configuration > interfaces are working correctly without having to build the C code for > our test programs with SVE enabled provide a trivial assembly library > with a C callable function that executes RDVL. Since these interfaces > also control behaviour on exec*() provide a trivial wrapper program which > reports the currently configured vector length on stdout, tests can use > this to verify that behaviour on exec*() is as expected. > > In preparation for providing similar helper functionality for SME, the > Scalable Matrix Extension, which allows separately configured vector > lengths to be read back both the assembler function and wrapper binary > have SVE included in their name. > > Signed-off-by: Mark Brown Reviewed-by: Dave Martin (With or without a couple of trivial nits below.) > --- > tools/testing/selftests/arm64/fp/.gitignore | 1 + > tools/testing/selftests/arm64/fp/Makefile | 6 +++++- > tools/testing/selftests/arm64/fp/rdvl-sve.c | 14 ++++++++++++++ > tools/testing/selftests/arm64/fp/rdvl.S | 9 +++++++++ > tools/testing/selftests/arm64/fp/rdvl.h | 8 ++++++++ > 5 files changed, 37 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/arm64/fp/rdvl-sve.c > create mode 100644 tools/testing/selftests/arm64/fp/rdvl.S > create mode 100644 tools/testing/selftests/arm64/fp/rdvl.h > > diff --git a/tools/testing/selftests/arm64/fp/.gitignore b/tools/testing/selftests/arm64/fp/.gitignore > index d66f76d2a650..6b53a7b60fee 100644 > --- a/tools/testing/selftests/arm64/fp/.gitignore > +++ b/tools/testing/selftests/arm64/fp/.gitignore > @@ -1,4 +1,5 @@ > fpsimd-test > +rdvl-sve > sve-probe-vls > sve-ptrace > sve-test > diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile > index a57009d3a0dc..ed62e7003b96 100644 > --- a/tools/testing/selftests/arm64/fp/Makefile > +++ b/tools/testing/selftests/arm64/fp/Makefile > @@ -2,12 +2,16 @@ > > CFLAGS += -I../../../../../usr/include/ > TEST_GEN_PROGS := sve-ptrace sve-probe-vls > -TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress sve-test sve-stress vlset > +TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress \ > + rdvl-sve \ > + sve-test sve-stress \ > + vlset > > all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED) > > fpsimd-test: fpsimd-test.o > $(CC) -nostdlib $^ -o $@ > +rdvl-sve: rdvl-sve.o rdvl.o > sve-ptrace: sve-ptrace.o sve-ptrace-asm.o > sve-probe-vls: sve-probe-vls.o > sve-test: sve-test.o > diff --git a/tools/testing/selftests/arm64/fp/rdvl-sve.c b/tools/testing/selftests/arm64/fp/rdvl-sve.c > new file mode 100644 > index 000000000000..7f8a13a18f5d > --- /dev/null > +++ b/tools/testing/selftests/arm64/fp/rdvl-sve.c > @@ -0,0 +1,14 @@ > +// SPDX-License-Identifier: GPL-2.0-only > + > +#include > + > +#include "rdvl.h" > + > +int main(void) > +{ > + int vl = rdvl_sve(); > + > + printf("%d\n", vl); > + > + return 0; For consistency with the changes in vec-syscfg, we could use EXIT_SUCCESS here. Although it's hard to see what could go wrong I/O-wise that doesn't involve vec-syscfg itself having gone wrong, it's probably good practice to do the final error check: if (ferror(stdout) || fclose(stdout)) return EXIT_FAILURE; return EXIT_SUCCESS; (In reality, people rarely seem to bother with this, so I'm not going to lose sleep if we don't do it...) > +} > diff --git a/tools/testing/selftests/arm64/fp/rdvl.S b/tools/testing/selftests/arm64/fp/rdvl.S > new file mode 100644 > index 000000000000..6e76dd720b87 > --- /dev/null > +++ b/tools/testing/selftests/arm64/fp/rdvl.S > @@ -0,0 +1,9 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +// Copyright (C) 2021 ARM Limited. > + > +.arch_extension sve > + > +.globl rdvl_sve Should we stick a .type rdvl_sve, @function here? This may avoid surprises with future toolchain behaviours. Probably doesn't matter, but I have bad memories of Thumb-2... Lacking this annotation is widespread though, as well as being de facto standard before awkward architectures came along. If the selftests have access to the ENTRY() macro we could use that, but I'm guessing that isn't exported for userspace. > +rdvl_sve: > + rdvl x0, #1 > + ret > diff --git a/tools/testing/selftests/arm64/fp/rdvl.h b/tools/testing/selftests/arm64/fp/rdvl.h > new file mode 100644 > index 000000000000..7c9d953fc9e7 > --- /dev/null > +++ b/tools/testing/selftests/arm64/fp/rdvl.h > @@ -0,0 +1,8 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > + > +#ifndef RDVL_H > +#define RDVL_H > + > +int rdvl_sve(void); > + > +#endif > -- > 2.20.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel