From patchwork Thu Aug 10 11:39:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13349325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 24A41C04A94 for ; Thu, 10 Aug 2023 11:40:03 +0000 (UTC) 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:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VFVwfVKxbShU0WG8HLlpvKIVaWPqBjXVNc0If1WFOGE=; b=uhfX1B5nlOkBeW VLMm3/Db1d3LPPFYk2PYBTUyBBGKKgzSjrXAhPf42GIl8OTOTvcBs2WcHNRrWUxiXdvDoI3025aBc UAlq/5Vm4tCkwbyekdnb5erb1aYHGwfU9qMBXUAFnS3NLVXC3KDeQTg2tQiL2IqrMbS+OOaNhrjx6 F9e1xrIbFbyOtT8Pfs53FnhqdmdNxzY19GmEaGVwYI2fBYr78ZkgMyN5VqOXgC5uidpVOgw+Uqahr KvlQf4mDwUKGxwJs/J409SR5VunkZKRTLZFTU4y9WyLaUhk705kn9RiuVhnDqN0cexQ2uAv0FBIIZ V/cS6Jz+jtlhX5kLvAOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qU40w-007TuU-2u; Thu, 10 Aug 2023 11:39:38 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qU40o-007Trc-1u for linux-arm-kernel@lists.infradead.org; Thu, 10 Aug 2023 11:39:32 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1040165A37; Thu, 10 Aug 2023 11:39:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC500C43391; Thu, 10 Aug 2023 11:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691667569; bh=TWailZRjY0e+eZNG0KbVuBj7vwCo8+irTvS4gJ/TsSo=; h=From:Date:Subject:To:Cc:From; b=Ycec3jI++B2DemmO0X24rmDGt5uP/+g1lYJa9Hyfi6d7UELoLZXB2Z5ejbmN3GcDv EwUHHtrZ1gwmF3reOs3j0i8eihpBloUT0ls1xGLxo7AoC+9i3v2zRTYJBaiE2Aqrna SEIhk49XQm6fWl5yW1NHtYQ3SVJwn/+nG8Tz06hHyNJFv+bY7yudAOsGJ8lN/PsBJj hNUZVVGhKtExtD13jG4RganXxBb2d5fq568W7HS7B6fjT350Ndae6rFjw7jUDoIQIl EBhgGSTQpuxChF7NBVcTrXtGe/7l15wJAuslGWJAD+OPADnJiRzgz+if6YOL6FwM9v 7ePKJCEaliyqw== From: Mark Brown Date: Thu, 10 Aug 2023 12:39:19 +0100 Subject: [PATCH] kselftest/arm64: Size sycall-abi buffers for the actual maximum VL MIME-Version: 1.0 Message-Id: <20230810-arm64-syscall-abi-perf-v1-1-6a0d7656359c@kernel.org> X-B4-Tracking: v=1; b=H4sIAGbM1GQC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2MDCwNL3cSiXDMT3eLK4uTEnBzdxKRM3YLUojRdw1RTC3OzFEMzwyQjJaD mgqLUtMwKsMHRsbW1AHmPd99oAAAA To: Catalin Marinas , Will Deacon , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-034f2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4518; i=broonie@kernel.org; h=from:subject:message-id; bh=TWailZRjY0e+eZNG0KbVuBj7vwCo8+irTvS4gJ/TsSo=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBk1Mxui0TdliWUY4lyyzPw0Wk8Ox8X4CucUB4Yx3uP ksqc6rmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZNTMbgAKCRAk1otyXVSH0P6AB/ 9Pmv5jV7G7opPlIhRunsboaHBuLcjYK2tKjRx7V2lXPOa6FG/2vE309Uw9blivEmaaSMRnGeT3lQMP MvMBa4SWHtxc9gti0FdbitmV28cTVcn093jkUGITx6LjrMDp35HKZj3Nxxvg1ggIPfPijzm/U7m8ze bf6eHIzYh2SxWR6J3qz2N/utG3AxuR1j4sxl/FdynAbgXi5kF/dwelXg4PpDP7YHV7Fuwemng2lJSs MZ4fir0mayRVS2dfwTD+7MdeV9ISUgqi0WBNOoMdFJjIvppsTioRgi7x8NApwT1hwEoQFVwsfL0l5u R8W763tA9dyG9X9tzVbuYCr68YeHHj X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230810_043930_712030_52DE2389 X-CRM114-Status: GOOD ( 12.28 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Our ABI opts to provide future proofing by defining a much larger SVE_VQ_MAX than the architecture actually supports. Since we use this define to control the size of our vector data buffers this results in a lot of overhead when we initialise which can be a very noticable problem in emulation, we fill buffers that are orders of magnitude larger than we will ever actually use even with virtual platforms that provide the full range of architecturally supported vector lengths. Define and use the actual architecture maximum to mitigate this. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/syscall-abi.c | 38 +++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) --- base-commit: 52a93d39b17dc7eb98b6aa3edb93943248e03b2f change-id: 20230809-arm64-syscall-abi-perf-1e5876d161b2 Best regards, diff --git a/tools/testing/selftests/arm64/abi/syscall-abi.c b/tools/testing/selftests/arm64/abi/syscall-abi.c index 18cc123e2347..d704511a0955 100644 --- a/tools/testing/selftests/arm64/abi/syscall-abi.c +++ b/tools/testing/selftests/arm64/abi/syscall-abi.c @@ -20,12 +20,20 @@ #include "syscall-abi.h" +/* + * The kernel defines a much larger SVE_VQ_MAX than is expressable in + * the architecture, this creates a *lot* of overhead filling the + * buffers (especially ZA) on emulated platforms so use the actual + * architectural maximum instead. + */ +#define ARCH_SVE_VQ_MAX 16 + static int default_sme_vl; static int sve_vl_count; -static unsigned int sve_vls[SVE_VQ_MAX]; +static unsigned int sve_vls[ARCH_SVE_VQ_MAX]; static int sme_vl_count; -static unsigned int sme_vls[SVE_VQ_MAX]; +static unsigned int sme_vls[ARCH_SVE_VQ_MAX]; extern void do_syscall(int sve_vl, int sme_vl); @@ -130,9 +138,9 @@ static int check_fpr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, #define SVE_Z_SHARED_BYTES (128 / 8) -static uint8_t z_zero[__SVE_ZREG_SIZE(SVE_VQ_MAX)]; -uint8_t z_in[SVE_NUM_ZREGS * __SVE_ZREG_SIZE(SVE_VQ_MAX)]; -uint8_t z_out[SVE_NUM_ZREGS * __SVE_ZREG_SIZE(SVE_VQ_MAX)]; +static uint8_t z_zero[__SVE_ZREG_SIZE(ARCH_SVE_VQ_MAX)]; +uint8_t z_in[SVE_NUM_ZREGS * __SVE_ZREG_SIZE(ARCH_SVE_VQ_MAX)]; +uint8_t z_out[SVE_NUM_ZREGS * __SVE_ZREG_SIZE(ARCH_SVE_VQ_MAX)]; static void setup_z(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t svcr) @@ -190,8 +198,8 @@ static int check_z(struct syscall_cfg *cfg, int sve_vl, int sme_vl, return errors; } -uint8_t p_in[SVE_NUM_PREGS * __SVE_PREG_SIZE(SVE_VQ_MAX)]; -uint8_t p_out[SVE_NUM_PREGS * __SVE_PREG_SIZE(SVE_VQ_MAX)]; +uint8_t p_in[SVE_NUM_PREGS * __SVE_PREG_SIZE(ARCH_SVE_VQ_MAX)]; +uint8_t p_out[SVE_NUM_PREGS * __SVE_PREG_SIZE(ARCH_SVE_VQ_MAX)]; static void setup_p(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t svcr) @@ -222,8 +230,8 @@ static int check_p(struct syscall_cfg *cfg, int sve_vl, int sme_vl, return errors; } -uint8_t ffr_in[__SVE_PREG_SIZE(SVE_VQ_MAX)]; -uint8_t ffr_out[__SVE_PREG_SIZE(SVE_VQ_MAX)]; +uint8_t ffr_in[__SVE_PREG_SIZE(ARCH_SVE_VQ_MAX)]; +uint8_t ffr_out[__SVE_PREG_SIZE(ARCH_SVE_VQ_MAX)]; static void setup_ffr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t svcr) @@ -300,8 +308,8 @@ static int check_svcr(struct syscall_cfg *cfg, int sve_vl, int sme_vl, return errors; } -uint8_t za_in[ZA_SIG_REGS_SIZE(SVE_VQ_MAX)]; -uint8_t za_out[ZA_SIG_REGS_SIZE(SVE_VQ_MAX)]; +uint8_t za_in[ZA_SIG_REGS_SIZE(ARCH_SVE_VQ_MAX)]; +uint8_t za_out[ZA_SIG_REGS_SIZE(ARCH_SVE_VQ_MAX)]; static void setup_za(struct syscall_cfg *cfg, int sve_vl, int sme_vl, uint64_t svcr) @@ -470,9 +478,9 @@ void sve_count_vls(void) return; /* - * Enumerate up to SVE_VQ_MAX vector lengths + * Enumerate up to ARCH_SVE_VQ_MAX vector lengths */ - for (vq = SVE_VQ_MAX; vq > 0; vq /= 2) { + for (vq = ARCH_SVE_VQ_MAX; vq > 0; vq /= 2) { vl = prctl(PR_SVE_SET_VL, vq * 16); if (vl == -1) ksft_exit_fail_msg("PR_SVE_SET_VL failed: %s (%d)\n", @@ -496,9 +504,9 @@ void sme_count_vls(void) return; /* - * Enumerate up to SVE_VQ_MAX vector lengths + * Enumerate up to ARCH_SVE_VQ_MAX vector lengths */ - for (vq = SVE_VQ_MAX; vq > 0; vq /= 2) { + for (vq = ARCH_SVE_VQ_MAX; vq > 0; vq /= 2) { vl = prctl(PR_SME_SET_VL, vq * 16); if (vl == -1) ksft_exit_fail_msg("PR_SME_SET_VL failed: %s (%d)\n",