From patchwork Fri Sep 17 12:08:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 12501757 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 99B68C433EF for ; Fri, 17 Sep 2021 12:10:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80A0D60F9C for ; Fri, 17 Sep 2021 12:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbhIQML0 (ORCPT ); Fri, 17 Sep 2021 08:11:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:48126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhIQMLZ (ORCPT ); Fri, 17 Sep 2021 08:11:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C64960187; Fri, 17 Sep 2021 12:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631880604; bh=7ylfGXXJ8kffqS5H5ss3UKZCeSeFg8BoMiJBHNfE90c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oe47OioeXswMQgT91lPgmAaQZ6sGSYqfSWeSIUz2y+9wsyu8Mr8aohumPu/Cf7a11 PuOvCAq3ulPa94KXIqS/3YjRqfmzqJbDy7wTdvUMuGKqxO5nRObP2YWroOR9kC/3V4 ZH+88nbBCuz3b0bG5FADJKeZaS8BexeUNngJWlTeVvXr5H/aw9AwfWcOTn+Xqvu3MC HRnm1Gyha3fVWg5fxpkl/UIPK36kIbnAgaqOzq1vURM9Jpq+dC3aJrHtIXun0glmdt VDXuY7UD51+YjRR27VU8fNf3ZFBuGh1a7w6qHlqs0R2wOzYLaWgZ3fPADm7Ufb1CIp pwKzCbO9r5Rwg== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, misono.tomohiro@fujitsu.com, Mark Brown Subject: [PATCH v2 1/4] selftests: arm64: Fix printf() format mismatch in vec-syscfg Date: Fri, 17 Sep 2021 13:08:52 +0100 Message-Id: <20210917120855.13858-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917120855.13858-1-broonie@kernel.org> References: <20210917120855.13858-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=901; h=from:subject; bh=7ylfGXXJ8kffqS5H5ss3UKZCeSeFg8BoMiJBHNfE90c=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhRIVSFfNKGnLFWLyli3f4LmQge9pq7YMt+YL9ck0m EvunI0qJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYUSFUgAKCRAk1otyXVSH0FWUB/ 92GYL7NxN+w9+JXU5U8s7CvvXrZYC9XFIK/ljJBt0MG7SiRwBSSZ9eHsHdw9mO+/gYvP5VKVbCP97O 0JLoR7m3Xubp9rLz0i6u5ygb+nPxW6DkUYqV9Y605qoJoAtUlnZNO1BoaPtdXWzfYER7HEqqQVmEVY 8MR970WrdlwDJTOghzv/jMEqpPjg3DSXXUmkgAjgah118enrKeJIM3fpch4u96a2fgfEkUqTalN5x0 trMlahPBm+yox2tLx7TiDPjoy+p/4efDSdid/Z7snyM5CIt4REde/lbLp6Ku9n5mAFpdsRmjFw3cFt cScK5QveYHIeV9AHe29bRQP+4F0EIJ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The format for this error message calls for the plain text version of the error but we weren't supply it. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/vec-syscfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index c02071dcb563..b2de002ee325 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -109,7 +109,7 @@ static int get_child_rdvl(struct vec_data *data) /* exec() a new binary which puts the VL on stdout */ ret = execl(data->rdvl_binary, data->rdvl_binary, NULL); - fprintf(stderr, "execl(%s) failed: %d\n", + fprintf(stderr, "execl(%s) failed: %d (%s)\n", data->rdvl_binary, errno, strerror(errno)); exit(EXIT_FAILURE); From patchwork Fri Sep 17 12:08:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 12501759 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 A627DC433EF for ; Fri, 17 Sep 2021 12:10:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FDF960F9C for ; Fri, 17 Sep 2021 12:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229923AbhIQML2 (ORCPT ); Fri, 17 Sep 2021 08:11:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:48180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhIQML2 (ORCPT ); Fri, 17 Sep 2021 08:11:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E82561029; Fri, 17 Sep 2021 12:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631880606; bh=yJ4ueh+BO+Eim5GlQAHvD/jC8/yyMw/A2pszTTlipf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIt81/ZvyJWP6ElADvEl64I067AReSwhQeg0YZlHP+ugWr03sSLTbNwjqmhNTWGDh YJjsfZHED5nMmaBkvDNVHFVJUXdRlItJp5PzSShxAevHoSfieAAGSCv3HLL6YrPlBE /Av8Fmt3kvAh/L5HVQtbzC3G6dL34uATS3HcvJvd+yLXKqHiPsdt1OuBpJE3PXm53v Od/BDMKtHTXQ4fv8Z6J+tEhrn7+GqQl6wedfxmd9eYmJqUE8wQSjXBL3yWiMeN0gJU F+61KSmM3IN5xGLmiK2GcAov3ROo8ywnt5pvakEkLqCrnzQZ2Zt62xIX1HDvd8cvOZ ndke3FJNseR2g== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, misono.tomohiro@fujitsu.com, Mark Brown Subject: [PATCH v2 2/4] selftests: arm64: Remove bogus error check on writing to files Date: Fri, 17 Sep 2021 13:08:53 +0100 Message-Id: <20210917120855.13858-3-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917120855.13858-1-broonie@kernel.org> References: <20210917120855.13858-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1028; h=from:subject; bh=yJ4ueh+BO+Eim5GlQAHvD/jC8/yyMw/A2pszTTlipf8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhRIVTGHlxtnIY4Eu/5/J5cdKSDM5mRmL00dmRJpB8 pcoNJEyJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYUSFUwAKCRAk1otyXVSH0AsnB/ 4uF8UuO/qc8eC2OvSne45kbXQK7H/UqOVOJdfbCbtJZ/Yg6SVz3EIkmHEbjFFFxPnDuDsKF361i/1q /ZZOUtDowrvahmjD40x96SQFrRrFSX+PLtMfJv1QfFzRfeNU0j3y0IsjL905+WdbiCMHg5qyGsJGPW JEzJ0ym76gMzopdWFf1CWa5P/qRcmxsxaksL/NSFz++NJhuCPHwdB7xUcwA0gcbiPrjYiw72ZPzjHI qds/4rUmG8hx8IzObBBrMt5e5HWbswz+gAZTQepCuJExjYyyZyfp4kwlhE3m/p4W1rbPm8/SQ5p/YN tHJBWupoGarDuXJOKp32YqJen54xX8 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Due to some refactoring with the error handling we ended up mangling things so we never actually set ret and therefore shouldn't be checking it. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/vec-syscfg.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index b2de002ee325..d48d3ee1bc36 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -180,7 +180,6 @@ static int file_read_integer(const char *name, int *val) static int file_write_integer(const char *name, int val) { FILE *f; - int ret; f = fopen(name, "w"); if (!f) { @@ -192,11 +191,6 @@ static int file_write_integer(const char *name, int val) fprintf(f, "%d", val); fclose(f); - if (ret < 0) { - ksft_test_result_fail("Error writing %d to %s\n", - val, name); - return -1; - } return 0; } From patchwork Fri Sep 17 12:08:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 12501761 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 BA49BC433FE for ; Fri, 17 Sep 2021 12:10:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 989BB61212 for ; Fri, 17 Sep 2021 12:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231147AbhIQMLb (ORCPT ); Fri, 17 Sep 2021 08:11:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:48250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhIQMLb (ORCPT ); Fri, 17 Sep 2021 08:11:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABE5660187; Fri, 17 Sep 2021 12:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631880609; bh=034J/1+mWeQStGpdMFtVOiBVU1WdpiXGK6aJYR8cNz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q1AJZJ/ykgRigh5f2FwPivzoyK1bX7icB7x8k3oiSidyEEfiMAFsLb+o//L25z5xT VEVRl5bhO/wbzLdqcSGkpD3hkxirkDUz/Dvc4lWS2hh1yUPyejmPlNylERG6PRfW4q hxm4ZCm8BOrB9zwzkfazzA2yCFYGOdgnPUgvIsgXD6qFefHp2kfue1bZbTuVp4PpkL FLBM+LoyZNO9GS7LmCORhmfB8qxtn3bleyCLoqWXNRoboQnJbYWscnKrWCbdg8XMMH b45lvp8ka6jcw8T1aZxz1233Fk7CKGXAuyps5gEaOxgvoLMWyrRw3BDacy843pF16i kVUiJDPpj9J1A== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, misono.tomohiro@fujitsu.com, Mark Brown Subject: [PATCH v2 3/4] selftests: arm64: Fix and enable test for setting current VL in vec-syscfg Date: Fri, 17 Sep 2021 13:08:54 +0100 Message-Id: <20210917120855.13858-4-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917120855.13858-1-broonie@kernel.org> References: <20210917120855.13858-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1350; h=from:subject; bh=034J/1+mWeQStGpdMFtVOiBVU1WdpiXGK6aJYR8cNz8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhRIVTFuBDgWBwg6p1HNOQXNGec+AhKNKFSyB3BGEV FVIWvTmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYUSFUwAKCRAk1otyXVSH0PIIB/ 9jetOr4qozgIrSr+rO4ct6fg2NiySwJCBd+qPDdhxnIoUhTwMD1RJHJ9HLS7wdPdXbycp6IdxBr8Qu i9E5EFTvoP33SONsNuLDCoQRoLvq1hJiYIYyMhfUrChyVeUJtNGfTfOL4b+26a/mzyWJ2J9Rf/2moN ypWx7X0cNsk5z9onjeIWQfkpp/YYis6qlMElMk0AnRhuIbX9P+PClis7d9GHRfw491Ne+BtrfiGRDX mLRW0kO5mWL+pBMKiVDDSl7UWVgZAhxbSzWUL9MsduUEFg3h3NhsdE86YjAGkvnGO1gWDXOHhadu1+ xNLLIpxdb0+Un3+RmKaZDlje8ZE0Ck X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org We had some test code for verifying that we can write the current VL via the prctl() interface but the condition for the test was inverted which wasn't noticed as it was never actually hooked up to the array of tests we execute. Fix this. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/vec-syscfg.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index d48d3ee1bc36..9d6ac843e651 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -329,12 +329,9 @@ static void prctl_set_same(struct vec_data *data) return; } - if (cur_vl != data->rdvl()) - ksft_test_result_pass("%s current VL is %d\n", - data->name, ret); - else - ksft_test_result_fail("%s prctl() VL %d but RDVL is %d\n", - data->name, ret, data->rdvl()); + ksft_test_result(cur_vl == data->rdvl(), + "%s set VL %d and have VL %d\n", + data->name, cur_vl, data->rdvl()); } /* Can we set a new VL for this process? */ @@ -555,6 +552,7 @@ static const test_type tests[] = { proc_write_max, prctl_get, + prctl_set_same, prctl_set, prctl_set_no_child, prctl_set_for_child, From patchwork Fri Sep 17 12:08:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 12501763 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 5B394C433F5 for ; Fri, 17 Sep 2021 12:10:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41E8F611F2 for ; Fri, 17 Sep 2021 12:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231897AbhIQMLe (ORCPT ); Fri, 17 Sep 2021 08:11:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:48328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhIQMLd (ORCPT ); Fri, 17 Sep 2021 08:11:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B52D61029; Fri, 17 Sep 2021 12:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631880611; bh=kxlmWsIvJBPFCGEqPWM9dGFH0Yj8wRu49i4D5IG/WpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DjssvoiUN5ANfMlWEbsdVn27ClLMffxblPudScRWVEYnp70toFZQEF5yluaGvcD5T tcwWUgZ7BV8I8VTPTiYTyaKElxEvm3udJnn2pjfdh7Fq6JwfjbPb9L52aKZrL5oBT5 oA9J2bfntOd6hOOAJupg9l6LDGZDY619hpuxESuVatHAPuEObluGG39IZohXfl8450 bZODniQo2zAlX/+vww/QUTzjqE5LOFjH+ooUxmwLICYSshKet6vCypnFGcnSRtPcsV BzvYz2fn5y2l6C63SEgSWsZ9G1AET4t4OCMq+ZjGQV4on8m8WmpT2+DAaKKD2OtJDH l/BlQA8Mh0yZQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, misono.tomohiro@fujitsu.com, Mark Brown Subject: [PATCH v2 4/4] selftests: arm64: Verify that all possible vector lengths are handled Date: Fri, 17 Sep 2021 13:08:55 +0100 Message-Id: <20210917120855.13858-5-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917120855.13858-1-broonie@kernel.org> References: <20210917120855.13858-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3010; h=from:subject; bh=kxlmWsIvJBPFCGEqPWM9dGFH0Yj8wRu49i4D5IG/WpE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhRIVU7U6WVRMbQ4I9XZp4rIOvx6l6GsqSZbOGzJik VwZX33qJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYUSFVAAKCRAk1otyXVSH0GjyB/ 9OudLcJQvNJfeWWWwTv0IOwf9iJzcdz57NT/VhZhZeKz0Wa49MaxrVo/M8/eT6cDV1M4eXDZ4LQP7p aJ96q4m1oDRHHk+mNSxwOikjecvNd0T1jNwKQt1hQmfBqe6b7QBfExKcPG7JJas3k77Als3XlzYI7q jpRQyrcpyYAqlABUl+gQnI32isOCaJwHHyCGQX0A5WYzoBc01a4a7U8jNZerEL+5+dVwWMvExrqs5u jy3JkODPeluOmpM1668rlNb3lLErdRciVL0DHOmUT+K6T9P0fY9aSXbfiprFf8LjQgl7SYplwPSDsZ nPv/33qFF2z6NyZ5IA7DeY0oEcnGJ3 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org As part of the enumeration interface for setting vector lengths it is valid to set vector lengths not supported in the system, these will be rounded to a supported vector length and returned from the prctl(). Add a test which exercises this for every valid vector length and makes sure that the return value is as expected and that this is reflected in the actual system state. Signed-off-by: Mark Brown Reviewed-by: Tomohiro Misono --- tools/testing/selftests/arm64/fp/vec-syscfg.c | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index 9d6ac843e651..de11cd2f5d79 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -540,6 +540,76 @@ static void prctl_set_onexec(struct vec_data *data) file_write_integer(data->default_vl_file, data->default_vl); } +/* For each VQ verify that setting via prctl() does the right thing */ +static void prctl_set_all_vqs(struct vec_data *data) +{ + int ret, vq, vl, new_vl; + int errors = 0; + + for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) { + vl = sve_vl_from_vq(vq); + + /* Attempt to set the VL */ + ret = prctl(data->prctl_set, vl); + if (ret < 0) { + errors++; + ksft_print_msg("%s prctl set failed for %d: %d (%s)\n", + data->name, vl, + errno, strerror(errno)); + continue; + } + + new_vl = ret & PR_SVE_VL_LEN_MASK; + + /* Check that we actually have the reported new VL */ + if (data->rdvl() != new_vl) { + ksft_print_msg("Set %s VL %d but RDVL reports %d\n", + data->name, new_vl, data->rdvl()); + errors++; + } + + /* Was that the VL we asked for? */ + if (new_vl == vl) + continue; + + /* Should round up to the minimum VL if below it */ + if (vl < data->min_vl) { + if (new_vl != data->min_vl) { + ksft_print_msg("%s VL %d returned %d not minimum %d\n", + data->name, vl, new_vl, + data->min_vl); + errors++; + } + + continue; + } + + /* Should round down to maximum VL if above it */ + if (vl > data->max_vl) { + if (new_vl != data->max_vl) { + ksft_print_msg("%s VL %d returned %d not maximum %d\n", + data->name, vl, new_vl, + data->max_vl); + errors++; + } + + continue; + } + + /* Otherwise we should've rounded down */ + if (!(new_vl < vl)) { + ksft_print_msg("%s VL %d returned %d, did not round down\n", + data->name, vl, new_vl); + errors++; + + continue; + } + } + + ksft_test_result(errors == 0, "%s prctl() set all VLs, %d errors\n", + data->name, errors); +} + typedef void (*test_type)(struct vec_data *); static const test_type tests[] = { @@ -557,6 +627,7 @@ static const test_type tests[] = { prctl_set_no_child, prctl_set_for_child, prctl_set_onexec, + prctl_set_all_vqs, }; int main(void)