From patchwork Fri Feb 25 16:58:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 12760633 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 746FFC4332F for ; Fri, 25 Feb 2022 17:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243753AbiBYRfP (ORCPT ); Fri, 25 Feb 2022 12:35:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243748AbiBYRfP (ORCPT ); Fri, 25 Feb 2022 12:35:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 012A21A8CBE for ; Fri, 25 Feb 2022 09:34:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9055D61CB9 for ; Fri, 25 Feb 2022 17:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F63DC340F5; Fri, 25 Feb 2022 17:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645810482; bh=a4sECHG5GdNTFF/5Rhso4njulI4h3qk685MNPIcrt+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pEVNeUNDjzNjLW8aiRLWgPXt9yGo2wIwakGmmfKIoX6FwmpHCgUbftncGN7GYoXvu 1uf2xMmdEs/tmS7BqO7h+lknq4hqNv65eO0rxFi0/oCffP1QIVJfUzP1bY4ff0fZBx F8ePMCsg/5yxhqDf+iYSyGsmWhFxBd8OgrG3pzNaH73zROdhdBU60tHPrf0f4o2ef3 iHhQUf1x8pqa/USi1tGEoM/1IOVHgILA23DuL4YWKGjMyWAtOtLfHqB+3uXX6Ky/pm xrsU6JpwPkJh04UUW8CNHduJyggMpHpm/N67JaGJxSKu0JWdPremWqu0117lDiomhv LDvLIAdM+5wfQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Marc Zyngier , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Mark Brown Subject: [PATCH v12 05/40] kselftest/arm64: signal: Allow tests to be incompatible with features Date: Fri, 25 Feb 2022 16:58:48 +0000 Message-Id: <20220225165923.1474372-6-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220225165923.1474372-1-broonie@kernel.org> References: <20220225165923.1474372-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4042; h=from:subject; bh=a4sECHG5GdNTFF/5Rhso4njulI4h3qk685MNPIcrt+g=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBiGQrO6ypm1XCmEOnZ78NAb7851JhKmBr+BA3NVXlB biUkC6qJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYhkKzgAKCRAk1otyXVSH0MRnB/ 92fjpwZheXtN0UL5uiFG0y5IJp/qU4SoI1sz3BfMHkhB3MD6UJKaOY3cRwyw7tqCHW4nOm6J1OZcdW Uy3lHblYY6q8o++Fr1lxPNpNxJ3mWN+fRRZAa8qDRILcV7R5RZEUUfJQjNs1NA+BiCfAhBhm5hoCyL DmsJmikdUzWdNvgLnysduO/FRjqDidizav5NTlTxHLKfbzpRnYNnRWW5weU0J9bSPBeXpXxHsDBPLW K8tvd9csGcz1BBmEXCDTnpBdiJCyPDTBMl2wiJ7XsqO0eTC7UNMg5MlXA4ksMOzSVtP7DfPIlr7wH2 MUYSWH617EfYtsHMc/FmXIPhA4AC6Y X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Some features may invalidate some tests, for example by supporting an operation which would trap otherwise. Allow tests to list features that they are incompatible with so we can cover the case where a signal will be generated without disruption on systems where that won't happen. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- .../selftests/arm64/signal/test_signals.h | 1 + .../arm64/signal/test_signals_utils.c | 34 ++++++++++++++----- .../arm64/signal/test_signals_utils.h | 2 ++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/test_signals.h b/tools/testing/selftests/arm64/signal/test_signals.h index ebe8694dbef0..f909b70d9e98 100644 --- a/tools/testing/selftests/arm64/signal/test_signals.h +++ b/tools/testing/selftests/arm64/signal/test_signals.h @@ -53,6 +53,7 @@ struct tdescr { char *name; char *descr; unsigned long feats_required; + unsigned long feats_incompatible; /* bitmask of effectively supported feats: populated at run-time */ unsigned long feats_supported; bool initialized; diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c index 2f8c23af3b5e..5743897984b0 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.c +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c @@ -36,6 +36,8 @@ static inline char *feats_to_string(unsigned long feats) { size_t flen = MAX_FEATS_SZ - 1; + feats_string[0] = '\0'; + for (int i = 0; i < FMAX_END; i++) { if (feats & (1UL << i)) { size_t tlen = strlen(feats_names[i]); @@ -256,7 +258,7 @@ int test_init(struct tdescr *td) td->minsigstksz = MINSIGSTKSZ; fprintf(stderr, "Detected MINSTKSIGSZ:%d\n", td->minsigstksz); - if (td->feats_required) { + if (td->feats_required || td->feats_incompatible) { td->feats_supported = 0; /* * Checking for CPU required features using both the @@ -267,15 +269,29 @@ int test_init(struct tdescr *td) if (getauxval(AT_HWCAP) & HWCAP_SVE) td->feats_supported |= FEAT_SVE; if (feats_ok(td)) { - fprintf(stderr, - "Required Features: [%s] supported\n", - feats_to_string(td->feats_required & - td->feats_supported)); + if (td->feats_required & td->feats_supported) + fprintf(stderr, + "Required Features: [%s] supported\n", + feats_to_string(td->feats_required & + td->feats_supported)); + if (!(td->feats_incompatible & td->feats_supported)) + fprintf(stderr, + "Incompatible Features: [%s] absent\n", + feats_to_string(td->feats_incompatible)); } else { - fprintf(stderr, - "Required Features: [%s] NOT supported\n", - feats_to_string(td->feats_required & - ~td->feats_supported)); + if ((td->feats_required & td->feats_supported) != + td->feats_supported) + fprintf(stderr, + "Required Features: [%s] NOT supported\n", + feats_to_string(td->feats_required & + ~td->feats_supported)); + if (td->feats_incompatible & td->feats_supported) + fprintf(stderr, + "Incompatible Features: [%s] supported\n", + feats_to_string(td->feats_incompatible & + ~td->feats_supported)); + + td->result = KSFT_SKIP; return 0; } diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.h b/tools/testing/selftests/arm64/signal/test_signals_utils.h index 6772b5c8d274..f3aa99ba67bb 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.h +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.h @@ -18,6 +18,8 @@ void test_result(struct tdescr *td); static inline bool feats_ok(struct tdescr *td) { + if (td->feats_incompatible & td->feats_supported) + return false; return (td->feats_required & td->feats_supported) == td->feats_required; }