From patchwork Wed Oct 23 20:38:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13847886 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C1761FF7A8; Wed, 23 Oct 2024 20:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715983; cv=none; b=Nys2niRpxW46cnJfgsaNUPTTfNTgRlOF4kGK9FYhng8IrCxByDklNIiPb/rCpih234sx2eJHq9sMRHeMHAIQJG+j0zQu/XO/fAa90bLTvZ7sNzUar4VnZKv8QKLNMhLm2pK3Vms1pr0ZA7/nJkyR6PgrHksIzp6fLOPxqYcoYFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715983; c=relaxed/simple; bh=/bHrhesLCeIwKS6Tm5OOpULv9OOeXujD+y0vb5AVloM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lfSW1LjtYYHlvyW+Er8IMQAvA96kBTiq2vwPRaVtGJSoovhv4XMm9ntkrQYQvtM4E7Culm65NTPQR5bYkcFhYslBWTV7lmlp8jb3GkVwRsttp1wUl/b5VNkGT4wj/qCIMxieJea21YH/qu2zkhxrOGou7S6+vo+fJpxZ6eroGvE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HEBz9J2S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HEBz9J2S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 451BEC4CECD; Wed, 23 Oct 2024 20:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729715982; bh=/bHrhesLCeIwKS6Tm5OOpULv9OOeXujD+y0vb5AVloM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HEBz9J2SYayNbbRkBwd2iwxoESLTRpgf1SxBFOntvWwBVNUv28S3mZIaSuhRmvayR jQ2lwTFB5OV24DDouzZMEsU9VYK8Mpf+ft/Vcva8GApuEThPqQwXFmrF8APwzG3czW 2Chi4MNYNRA3IpODaKSuCt8oW3b4sxHbCVA7M3MdxuwYIozafqU2TxQpRe5NLo2otu xmqM9O2HWAj7ptDz3y6DAPQV+ts2l/oD/fx5RJ37NdPFDBBNMNhgIu9OBumBnYq0P+ rH3RqA/nOa4AR0HraXZ5lqUo7qilZEhp8SaHhoa4NmvdEIW6zIky2/CEkuN44alSQR mS33JnbX5cPdQ== From: Mark Brown Date: Wed, 23 Oct 2024 21:38:29 +0100 Subject: [PATCH 1/6] kselftest/arm64: Correct misleading comments on fp-stress irritators Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241023-arm64-fp-stress-irritator-v1-1-a51af298d449@kernel.org> References: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> In-Reply-To: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=2112; i=broonie@kernel.org; h=from:subject:message-id; bh=/bHrhesLCeIwKS6Tm5OOpULv9OOeXujD+y0vb5AVloM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnGV8Gc55M2w82ehj/LpjjHUBt4adVvVgcz0prD+dS XvsOxI2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZxlfBgAKCRAk1otyXVSH0CA5B/ 0c7+WD7+iS6lYyf0bnJuH8r+L60B8ehcqJrpsjYxePuktHethpL14YIdnlm0MeLaomjRQqDl26a7h0 7QEyHO8j9AwYw6KYE0gIZfQLbawPVnu5cl4Hwo9nODuwfvRo8286EF8lBzbpPPvFRaHO1VYuYhCNeA lNfN16OdFKjhP6YpxNxYKuJHChn2L4BZeqy7kMcBiqISG6+MbUlD6YgzxsvpbwRzxKAHodXlNfaMHp sJpVOv3LW4gibvdMHqDEEghYc5SkuWcvfjRWYhsObwwrNev33WFLOeIKNlzU3bSLZmbLXYGb2Bgtsr 3lUfYaJb55y0v/wJGedDx53K8xYUam X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB The comments in the handlers for the irritator signal in the test threads for fp-stress suggest that the irritator will corrupt the register state observed by the main thread but this is not the case, instead the FPSIMD and SVE irritators (which are the only ones that are implemented) modify the current register state which is expected to be overwritten on return from the handler by the saved register state. Update the comment to reflect what the handler is actually doing. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/fpsimd-test.S | 3 +-- tools/testing/selftests/arm64/fp/sve-test.S | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/fpsimd-test.S b/tools/testing/selftests/arm64/fp/fpsimd-test.S index 8b960d01ed2e0ef516893b68794078ddf8c01e1f..bdfb7cf2e4ec175fda62c1c2f38c6ebb1a1c48bf 100644 --- a/tools/testing/selftests/arm64/fp/fpsimd-test.S +++ b/tools/testing/selftests/arm64/fp/fpsimd-test.S @@ -134,8 +134,7 @@ function check_vreg b memcmp endfunction -// Any SVE register modified here can cause corruption in the main -// thread -- but *only* the registers modified here. +// Modify live register state, the signal return will undo our changes function irritator_handler // Increment the irritation signal count (x23): ldr x0, [x2, #ucontext_regs + 8 * 23] diff --git a/tools/testing/selftests/arm64/fp/sve-test.S b/tools/testing/selftests/arm64/fp/sve-test.S index fff60e2a25addfd4850ef71aa3cf6535ac880ffd..e3c0d585684df29723a49265f3df6d23817498c7 100644 --- a/tools/testing/selftests/arm64/fp/sve-test.S +++ b/tools/testing/selftests/arm64/fp/sve-test.S @@ -291,8 +291,7 @@ function check_ffr #endif endfunction -// Any SVE register modified here can cause corruption in the main -// thread -- but *only* the registers modified here. +// Modify live register state, the signal return will undo our changes function irritator_handler // Increment the irritation signal count (x23): ldr x0, [x2, #ucontext_regs + 8 * 23] From patchwork Wed Oct 23 20:38:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13847887 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 239B91D174A; Wed, 23 Oct 2024 20:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715985; cv=none; b=saJK99LxHPHaLIS1IKPlBr5igmw+eLL1U3PC7WjVUshQoc8fLao7GiNcQu1h/UuVhGufK57g9ZjNDVkXwQDCEPHAna2SopDTGtKH3UYvZ4JrkOHQbGiMXMEMlHuv7KsisTjUJSFZRgFFXuf9I8iV4BKjv9PhTdUdqyt0B9ffh3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715985; c=relaxed/simple; bh=A0xCV0/PSvevUax4GW3txbWNtrgIm8u+5XUscwTPb/o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Oj7IFgI8m0xmJOYuy1iIhS8CdaajPL1Cm/5E94dz5WNegZmRHdY3VkPbeO5GSLjfF/sCI0Imr34+mavP7bb/HhpiQo7t8MMbyxMCFE+JrAZ9TkR+/F1qwFCLyqzwbSh3HuxWDWh7JQN2MuSCp6ot4BSwkTtN5XNhD99jMutYMp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GAwtJDup; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GAwtJDup" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5059FC4CEC6; Wed, 23 Oct 2024 20:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729715984; bh=A0xCV0/PSvevUax4GW3txbWNtrgIm8u+5XUscwTPb/o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GAwtJDupEyWOB3uuEGnaulVAgHAukMaigDlXwBOK/DK5UrHfJ04dEZpVvJHQru2Qy JrS5jofMrUiccO3pL9n/A1HbMCNpFQZu7kJB7vTz9jFTDJeKrSMixnsZjGMv5K8F5j 8o0Cm+wWK3/vWiXr3Lk517Pj0ZnMxFKr8mqOqkBshm8KKT7FQ2R886EIxX2CUBNGWy Af5kJM+fDzNbajd4GJBWYbPOH3FlHqUACAKwyzCzwopBR7RuwHlKwqfGMPnBnZ1awS 21nOuSbDKCG658SpD7ksW1KQgN6qI/rCUZ9/fOJvIrXZNNoMWebYdglt+RJDLFqYui zZnGVTJPu+Tew== From: Mark Brown Date: Wed, 23 Oct 2024 21:38:30 +0100 Subject: [PATCH 2/6] kselftest/arm64: Remove unused ADRs from irritator handlers Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241023-arm64-fp-stress-irritator-v1-2-a51af298d449@kernel.org> References: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> In-Reply-To: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=2606; i=broonie@kernel.org; h=from:subject:message-id; bh=A0xCV0/PSvevUax4GW3txbWNtrgIm8u+5XUscwTPb/o=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnGV8HpM2/QKONGuDoJRvv7T//ECB/Hh6Fht25u/wh bXTfT0eJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZxlfBwAKCRAk1otyXVSH0KM5B/ 0WNMHqxiKcGxbpdzPHNYqwJzUbmWOTTHmbNlhyehRneGnNCvkwuaW7HSPHCncZK3WuJu5ZxGujaDbw hSX3xomF3kvFN++b6sLJvowe3lgwXeadwd8NRAuKuFwZNRaJlrwqSRfpGeNZRvPd9zAnJBQE52CL5J 1DKNnlI1y7uAhieuL2aGoWQBzrxvBLn7c5myKCEeQYuE9V9Ub3XhU04rUkoFjK05ZcQTDtf1lBtTLd qyFgwUAUizrgXECgz93ffnB7ED86olrhWBFQxWwR7YJAxQe6UnLhbfCZ0CEeQNDudd0Nba+KzNwiBu Oz6gHCXYVR5zI+JUGijriZuillOYAZ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB The irritator handlers for the fp-stress test programs all use ADR to load an address into x0 which is then not referenced. Remove these ADRs as they just cause confusion. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/fpsimd-test.S | 1 - tools/testing/selftests/arm64/fp/sve-test.S | 1 - tools/testing/selftests/arm64/fp/za-test.S | 1 - tools/testing/selftests/arm64/fp/zt-test.S | 1 - 4 files changed, 4 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/fpsimd-test.S b/tools/testing/selftests/arm64/fp/fpsimd-test.S index bdfb7cf2e4ec175fda62c1c2f38c6ebb1a1c48bf..9977ffdd758a51a7af67cd607d019a6c54d3a6c6 100644 --- a/tools/testing/selftests/arm64/fp/fpsimd-test.S +++ b/tools/testing/selftests/arm64/fp/fpsimd-test.S @@ -142,7 +142,6 @@ function irritator_handler str x0, [x2, #ucontext_regs + 8 * 23] // Corrupt some random V-regs - adr x0, .text + (irritator_handler - .text) / 16 * 16 movi v0.8b, #7 movi v9.16b, #9 movi v31.8b, #31 diff --git a/tools/testing/selftests/arm64/fp/sve-test.S b/tools/testing/selftests/arm64/fp/sve-test.S index e3c0d585684df29723a49265f3df6d23817498c7..f1fb9745c681786f686f1fafcb7e1154f3c8e1a3 100644 --- a/tools/testing/selftests/arm64/fp/sve-test.S +++ b/tools/testing/selftests/arm64/fp/sve-test.S @@ -299,7 +299,6 @@ function irritator_handler str x0, [x2, #ucontext_regs + 8 * 23] // Corrupt some random Z-regs - adr x0, .text + (irritator_handler - .text) / 16 * 16 movi v0.8b, #1 movi v9.16b, #2 movi v31.8b, #3 diff --git a/tools/testing/selftests/arm64/fp/za-test.S b/tools/testing/selftests/arm64/fp/za-test.S index 095b45531640966e685408057c08ada67e68998b..1ee0ec36766d2bef92aff50a002813e76e22963c 100644 --- a/tools/testing/selftests/arm64/fp/za-test.S +++ b/tools/testing/selftests/arm64/fp/za-test.S @@ -158,7 +158,6 @@ function irritator_handler // Corrupt some random ZA data #if 0 - adr x0, .text + (irritator_handler - .text) / 16 * 16 movi v0.8b, #1 movi v9.16b, #2 movi v31.8b, #3 diff --git a/tools/testing/selftests/arm64/fp/zt-test.S b/tools/testing/selftests/arm64/fp/zt-test.S index b5c81e81a37946c1bffe810568855939e9ceb08e..ade9c98abcdafc2755ef4796670566d99e919e5c 100644 --- a/tools/testing/selftests/arm64/fp/zt-test.S +++ b/tools/testing/selftests/arm64/fp/zt-test.S @@ -127,7 +127,6 @@ function irritator_handler // Corrupt some random ZT data #if 0 - adr x0, .text + (irritator_handler - .text) / 16 * 16 movi v0.8b, #1 movi v9.16b, #2 movi v31.8b, #3 From patchwork Wed Oct 23 20:38:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13847888 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71CA71E32A5; Wed, 23 Oct 2024 20:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715987; cv=none; b=qmKg6BTwCGBSi8KieIHAO4F+ZAp1UZmgApElNkO32i6yYuF2xpq/mWraL6orK57/sYBEb5EcJOrrzR6s5dOA8eTYMLx5uETYOp4S4ktNMzRJGcpnoRaEqE6cN59NmzAsz2PCWmzlxXPx1dFjndFLz3DGuugjECK1JjIkCPQTngM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715987; c=relaxed/simple; bh=FhWCGlX4GqW3drCLhOz7oP3Ieg9TfDbYSvqYk0V+nyI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YgwwABD3/J/kTz5Kr/8EM+SesE/bFtucx1D2sVFrvQeKqqiS2/+63En/ugeJpOHrVpNv38gljL2cD6Jb1cL49EtCzB9shf6EGanEf15BapBoja5Z+rRPe+KxBT2ycUBT0/tIC9MYzgjf2vAbAlkdI1eGajkHw6Rvcdas0UX9s6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cG2jZxEY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cG2jZxEY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C8EAC4CEE5; Wed, 23 Oct 2024 20:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729715987; bh=FhWCGlX4GqW3drCLhOz7oP3Ieg9TfDbYSvqYk0V+nyI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cG2jZxEYaHm79SoQxc8GhTLIsCsTiHQHhRBHsxmhAZolW8/XUSWmqgZsX/inQT+Jt cZ6Y85/epCbKDJXhUad5vZOsCkCSEh4bmOOcaDBwiSv0cEmXxOReInTXyNhB/Kqf+/ hmXCJjMqzKRREXXR9o7WUfErMqtj00v047ATZ378/zdQegMcSMpays2WcTa/2EAHAS l4ALs86z5InFdcs2ZmX/V/NYBXJOAtxivOzrlS7xi4yYAvSkQVbaUD89wTpZJQATcz BX75Sy1ZtkR8+L5Yj7rZdNPEixSkpt/NiWkdUmbbiKsBpn+Hy+0VYhS0ZtN84rTFLK PjbX9vj7TTskg== From: Mark Brown Date: Wed, 23 Oct 2024 21:38:31 +0100 Subject: [PATCH 3/6] kselftest/arm64: Corrupt P15 in the irritator when testing SSVE Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241023-arm64-fp-stress-irritator-v1-3-a51af298d449@kernel.org> References: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> In-Reply-To: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=893; i=broonie@kernel.org; h=from:subject:message-id; bh=FhWCGlX4GqW3drCLhOz7oP3Ieg9TfDbYSvqYk0V+nyI=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnGV8HAtprWkaDeom0J0zZOIBZaJtVL+0CTV3rfZXo 5d9PGCOJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZxlfBwAKCRAk1otyXVSH0IToB/ 9RCm0u32j8dB88IyUiR+Jhgoe6iur7nWhVM9wLnewqQD7jW/StOFMDou1lhDiduv8Rf/njUEjfqfSP NFkQaaRcQYqdDB9xJ88pl6oLiq3PEPbN09UaUp5iaDhUGMxGAhMDHKJfYIL9QGx7cMWSXGZkPVkB/d CbP5m2e4LFcmJysjRmhCJHJnRCoQDGx79bn1nWsOqYd1AHeouicl+OyjKhQW+c0KlOyG4BMCjm1y3e Bboe9erv4FX/4cTxqHbvc5Fx9UDu4D5MOIjYvS7jw8GPAw2M1SXzjUkx8RWUJNzPlhmOql5MZVlvn0 eU6Z/sCDxCJ5Cf+O4vLuIjNGnLSmE+ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB When building for streaming SVE the irritator for SVE skips updates of both P15 and FFR. While FFR is skipped since it might not be present there is no reason to skip corrupting P15 so move the ifdef appropriately. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/sve-test.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/fp/sve-test.S b/tools/testing/selftests/arm64/fp/sve-test.S index f1fb9745c681786f686f1fafcb7e1154f3c8e1a3..3c88dfe9c8cad29f44217314aeaffa984bac05e5 100644 --- a/tools/testing/selftests/arm64/fp/sve-test.S +++ b/tools/testing/selftests/arm64/fp/sve-test.S @@ -302,9 +302,9 @@ function irritator_handler movi v0.8b, #1 movi v9.16b, #2 movi v31.8b, #3 -#ifndef SSVE // And P0 rdffr p0.b +#ifndef SSVE // And FFR wrffr p15.b #endif From patchwork Wed Oct 23 20:38:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13847889 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 817B62003A8; Wed, 23 Oct 2024 20:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715989; cv=none; b=ZQVUq7bomnm1+VaHFUIcxVPIV+nK0ZPFutA3z3Zxs076y+PgYEbK5wWtyg18sgXSdr82zFKEqk3mHDjQmQiWOjOJEtzvbC1i2AUSsUoMTBH9vPH4MhVkkjZMOcQ6faVww1fg183yc+COxtnr/3THDSnsV+URF6fVE6v5KzfBeRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715989; c=relaxed/simple; bh=WEpX97GMGue5h7bD/Qq1020rZU1gV6I6QjnRHlLOdmM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KVSjWO6h0oAtUCKHBJQmk6cfUVsQ2ksIHGA6vM6PVXssypubiu8Piv+mIxbheiX+ll0aPrO0OBDvtmITd/y1AzQ17yeYiGWfqP49flrgdq7wqSsjtEFd+F6aLpH2E+sYpIwl0hGcjbgu7vINdLXMdovaOcvOt/0Hdckba8mDF9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dahnr0R7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dahnr0R7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67550C4CEC6; Wed, 23 Oct 2024 20:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729715989; bh=WEpX97GMGue5h7bD/Qq1020rZU1gV6I6QjnRHlLOdmM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Dahnr0R796Tfqila1uyH46kYi0NyolVV4NVVXPx6GyX+TrSMZvzYKC2IORDw91YcN tKn1v2LWgFdFPtpoEwjbgjk6TcOIttCRanO+Wn1Kx9ktepzB0DLWfPn2k9kRbxHEpv QVJKi4Vw2rDOt4PFgydLmUw68t6yFax8L3/qoTLFOZ8PTnT7PfbFP2Bi5t25UtJb/L 6DSwhJRBYZF4xpoY6+nQKd+4pjUNnGnL5IqlXi/vM6Trl54bV9JIarDJsED5Y7BdQA L+46L5knrXhElA4DrTtP4mAA62AOtl3HX8KthlH7C5vPXUsyLB8HoAnyPG094zqjm1 RfDstiEW0BL5w== From: Mark Brown Date: Wed, 23 Oct 2024 21:38:32 +0100 Subject: [PATCH 4/6] kselftest/arm64: Implement irritators for ZA and ZT Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241023-arm64-fp-stress-irritator-v1-4-a51af298d449@kernel.org> References: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> In-Reply-To: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=2511; i=broonie@kernel.org; h=from:subject:message-id; bh=WEpX97GMGue5h7bD/Qq1020rZU1gV6I6QjnRHlLOdmM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnGV8IqFapOgWCDGYthrlNY7lK+roKfgEiszak93NR OziALsmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZxlfCAAKCRAk1otyXVSH0C8aB/ 9UFKrDED/C0Pc/AaNhAZcgAygaJXFU3+FqMiLgUTnRqeckBQB23OIdfU76q00F6+cT6wcXrddgjfVq MN5mRc7jPQF2rWgQEsUviDNoaRJuSk89KZDFW0vOjP0KOqSS3U6rVinrrSGwF/1S3Y2VU9mdRY7ZGY gtvGmm+spMMl+ImoOlbp2kwd589P2O798KVzGLyKtjt0vWyzTPzEeNBWN92SbdgYKuH2tBvd35PhEy hW1oGvxgsIaWSIuuik8tF7zyvh76LntL4xi+PKyt8f/uv6RFAjkr3TFONT9HaYPi8vg3r9V4EhcHsY pwKFhl48BWyYjvD6WHIwzrUzHfEUBP X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Currently we don't use the irritator signal in our floating point stress tests so when we added ZA and ZT stress tests we didn't actually bother implementing any actual action in the handlers, we just counted the signal deliveries. In preparation for using the irritators let's implement them, just trivially SMSTOP and SMSTART to reset all bits in the register to 0. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/za-test.S | 12 ++++-------- tools/testing/selftests/arm64/fp/zt-test.S | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/za-test.S b/tools/testing/selftests/arm64/fp/za-test.S index 1ee0ec36766d2bef92aff50a002813e76e22963c..f902e6ef9077bfa34fa7f85ce572ce3df4346789 100644 --- a/tools/testing/selftests/arm64/fp/za-test.S +++ b/tools/testing/selftests/arm64/fp/za-test.S @@ -148,20 +148,16 @@ function check_za b memcmp endfunction -// Any SME register modified here can cause corruption in the main -// thread -- but *only* the locations modified here. +// Modify the live SME register state, signal return will undo our changes function irritator_handler // Increment the irritation signal count (x23): ldr x0, [x2, #ucontext_regs + 8 * 23] add x0, x0, #1 str x0, [x2, #ucontext_regs + 8 * 23] - // Corrupt some random ZA data -#if 0 - movi v0.8b, #1 - movi v9.16b, #2 - movi v31.8b, #3 -#endif + // This will reset ZA to all bits 0 + smstop + smstart ret endfunction diff --git a/tools/testing/selftests/arm64/fp/zt-test.S b/tools/testing/selftests/arm64/fp/zt-test.S index ade9c98abcdafc2755ef4796670566d99e919e5c..c96cb7c2ad4b406c54099fe3f73917259bd947e4 100644 --- a/tools/testing/selftests/arm64/fp/zt-test.S +++ b/tools/testing/selftests/arm64/fp/zt-test.S @@ -117,20 +117,16 @@ function check_zt b memcmp endfunction -// Any SME register modified here can cause corruption in the main -// thread -- but *only* the locations modified here. +// Modify the live SME register state, signal return will undo our changes function irritator_handler // Increment the irritation signal count (x23): ldr x0, [x2, #ucontext_regs + 8 * 23] add x0, x0, #1 str x0, [x2, #ucontext_regs + 8 * 23] - // Corrupt some random ZT data -#if 0 - movi v0.8b, #1 - movi v9.16b, #2 - movi v31.8b, #3 -#endif + // This will reset ZT to all bits 0 + smstop + smstart ret endfunction From patchwork Wed Oct 23 20:38:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13847890 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D77A20012B; Wed, 23 Oct 2024 20:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715991; cv=none; b=lH3ybxaQcSPu9a2kOqqP0Uih3Y88RMvqmwUHR/aXkArjphN51+Wpo4ngGR4ScEnKVwFlNuT2XiPhAbJHKTVAYp/hufwb6yBrh9qa8BUX2LJHvm2sT3pBc0BlEP+4ePxQ+Paus/sGQi0EUO+9fV2K9zkkjr9u+9bVN4+EFBBMvTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715991; c=relaxed/simple; bh=2eYH4MlA2swbnr7Adf9Eu7+rMkjhAxSKCoo92NFhmpw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aq1g3sDLhgHCPO5VjJpgajutakRAZlEXlInGskxMGWHxEzzKPs+zhRPHn9pA5DtKM0F6m6/Vtv2ErKufZm4WyM91pCTVhBjP3q0irNVjnY6iymWJ3NmjjyWVMY77l8qc/UYsXIQ30qsJQzpXA+MrZAuKeNpPjFempGrMForvhSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HHtL0+aZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HHtL0+aZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76CF0C4CEE5; Wed, 23 Oct 2024 20:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729715991; bh=2eYH4MlA2swbnr7Adf9Eu7+rMkjhAxSKCoo92NFhmpw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HHtL0+aZd7/UFWdJoQ1PUrq2RV2TSukC8tOFWZ8I3o8vQY4dHdkOzmBCQTEyb7ZbT SWbG/D5ipAZWBUWmZjAx5BV1wK9e5KWqWRKargoNf+IfxvN/QS49LScmAQDbWp7/Cq JKupvjpZWV+jqn+tIXeDNRoTTc7NR060b06Gj5cBV26xRlTQiIjNUpUGlvdzabtVzY NzE8PG85FZMx6Cs4N4TNBpafoRwq0dfgWBajllRdkkx+fDUOBLLrPGgvwin/aHCnmJ J2UdHBhfNoBmOB+hFbiyeLd31w14RSqmPogQ8wUUgATZh50KxUFRXJhAq60cNgIesO wpCwCESrNztFQ== From: Mark Brown Date: Wed, 23 Oct 2024 21:38:33 +0100 Subject: [PATCH 5/6] kselftest/arm64: Provide a SIGUSR1 handler in the kernel mode FP stress test Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241023-arm64-fp-stress-irritator-v1-5-a51af298d449@kernel.org> References: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> In-Reply-To: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=1266; i=broonie@kernel.org; h=from:subject:message-id; bh=2eYH4MlA2swbnr7Adf9Eu7+rMkjhAxSKCoo92NFhmpw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnGV8JzNZQSvHQxUSc42pdgj2HsNPx/BcpVh07gynO a+c6ELeJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZxlfCQAKCRAk1otyXVSH0A/XB/ wKth7XVx9oz7qbfbhUEMkGwkOSykh7+5RLlvAUOJIoBYlh1ieDD1L9OWcTkbAa2RD+uhlnQrQc2eUm eUG/QBJVTQryVUwdV0wPEbOt9JARw63DmunugDrJ5ZzsHKJjNSeVswGtEU+C12ZSO3DmjSt+YQgKiy CML0owjEHha21n4gBuapaeBgeWUlGPAOEcWWFxQDPf/bCigtcl61nptjMwpkHisLNDg34Xw3MoVVbv rJHizDjXjmogDrvp/XAwGY2MZEFOeNcat73ig+/AOhdYuYg54HSQGvrCeRk9tYBZe5iWnjofKP4rdd 5JLYCyp/lk5qIIURn4WaTlXEglTh7G X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB The other stress test programs provide a SIGUSR1 handler which modifies the live register state in order to validate that signal context is being restored during signal return. While we can't usefully do this when testing kernel mode FP usage provide a handler for SIGUSR1 which just counts the number of signals like we do for SIGUSR2, allowing fp-stress to treat all the test programs uniformly. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/kernel-test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/arm64/fp/kernel-test.c b/tools/testing/selftests/arm64/fp/kernel-test.c index e8da3b4cbd23202c6504ffd8043f8ef351d739f6..859345379044fc287458644309d66cf5f3d8bdf5 100644 --- a/tools/testing/selftests/arm64/fp/kernel-test.c +++ b/tools/testing/selftests/arm64/fp/kernel-test.c @@ -267,6 +267,10 @@ int main(void) strerror(errno), errno); sa.sa_sigaction = handle_kick_signal; + ret = sigaction(SIGUSR1, &sa, NULL); + if (ret < 0) + printf("Failed to install SIGUSR1 handler: %s (%d)\n", + strerror(errno), errno); ret = sigaction(SIGUSR2, &sa, NULL); if (ret < 0) printf("Failed to install SIGUSR2 handler: %s (%d)\n", From patchwork Wed Oct 23 20:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13847891 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41E0E2003DC; Wed, 23 Oct 2024 20:39:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715993; cv=none; b=q66SfD4Q9aTuHI+jxJEu96RtR5VPQBrTLAqvZym/qR6xlOx4ge8EiKX0DibI5ab3F7PjLWfp/7MTDaH6/V4YOn+MYq35otMIet0WXXujMsxmoYgToFiGX5aIoEa7eRdYLYkdO0SKa0OlZw95g09Ka7aJrejLq5L3JSd7SVvl0bI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729715993; c=relaxed/simple; bh=fVAM10zHyP6GG1K9/Odp1Yp4otIM0+Fw+7dp79I2hf8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MOH81p9l4oAEByLHtHN69gNxS+FsMFKgxWRmxIeJ7WEF4k6fD8oo7iO9cxh5vgG/hYS9NCJjtahPj9fXEMj/a7uysCyBvU9xWBtoZn+ZqSldVpd8qBlwlEOuhL8dr+1dMFF3lfXR5zMZf5CsxX/7el3Gfxq656L7FGWS3ozFDe4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kxNgiSR+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kxNgiSR+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 839AAC4CECD; Wed, 23 Oct 2024 20:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729715993; bh=fVAM10zHyP6GG1K9/Odp1Yp4otIM0+Fw+7dp79I2hf8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kxNgiSR+Wp1mt3SId9CP2ql3ho0BI8q99db+wRWSjZ3R/LkgGZpJe81d40QYGrvvd FzRFy9z0nlSJhtigrWi5JJNCGYwhCv/pNJu0RRMwfgJbs3rvjUKbeBmeAcZGeKDd44 SLpL0jyCRhQCHGXJA6bSChvSp7A/C7ACk+VfwQUfP6IhA4QiuSqBYHKkHHgcokqmLn WV4M9CVU1D0qBo7LrIq8ebO5cfa0zzRTIckZgiv1KkfW6f3fw2a8qU6VyAnjYqGXzT 7nV4EC+vphQGdjcgIdgEN3Gg2mRDWS8xfoSBiP6WrbhJGYmdMW900OU5ygoLXJLmhZ 0FohyD/Ua+NdA== From: Mark Brown Date: Wed, 23 Oct 2024 21:38:34 +0100 Subject: [PATCH 6/6] kselftest/arm64: Test signal handler state modification in fp-stress Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241023-arm64-fp-stress-irritator-v1-6-a51af298d449@kernel.org> References: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> In-Reply-To: <20241023-arm64-fp-stress-irritator-v1-0-a51af298d449@kernel.org> To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=1298; i=broonie@kernel.org; h=from:subject:message-id; bh=fVAM10zHyP6GG1K9/Odp1Yp4otIM0+Fw+7dp79I2hf8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnGV8Kfm83OfpsWup68vNgZGsjfwOxMdRatu9MK/EX EdADtWGJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZxlfCgAKCRAk1otyXVSH0NdBB/ 4ovaIlGKNe94pSK3mKdh49lKzuMNLJ2f8VGtLwmXBVXGhnglT2HKySG/zPktYrphwp93qyS5YYsieP myhszUgkF3kQX80vnQRsEzta0e6Ycs/Q3GhttYo2upy2rIKC8ZV6jCDaLY9XFrJIRk4/B1BtRvlJe3 dOQGO9MEcDOZ/l59v0sholBFfq+j8jcfk3OUPXQnyNXpKFJymV5+3YZcy53rSRRVCQ22KShEx+P7ju Y9bP9QzD6cszgI5i6WM+Ibl7hzFdvjuo/wTlkGBd1Iy+h3h3/W7RnpRt6CHtbpuNIXZBrlnMRj0+cx lU2usTwPpNX6XrRhSkWlnQgrE4rBCa X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Currently in fp-stress we test signal delivery to the test threads by sending SIGUSR2 which simply counts how many signals are delivered. The test programs now also all have a SIGUSR1 handler which for the threads doing userspace testing additionally modifies the floating point register state in the signal handler, verifying that when we return the saved register state is restored from the signal context as expected. Switch over to triggering that to validate that we are restoring as expected. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/fp-stress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/fp/fp-stress.c b/tools/testing/selftests/arm64/fp/fp-stress.c index faac24bdefeb9436e2daf20b7250d0ae25ca23a7..3d477249dee0632b662b48582433d39323d18e18 100644 --- a/tools/testing/selftests/arm64/fp/fp-stress.c +++ b/tools/testing/selftests/arm64/fp/fp-stress.c @@ -221,7 +221,7 @@ static void child_output(struct child_data *child, uint32_t events, static void child_tickle(struct child_data *child) { if (child->output_seen && !child->exited) - kill(child->pid, SIGUSR2); + kill(child->pid, SIGUSR1); } static void child_stop(struct child_data *child)