From patchwork Wed Jul 19 22:23:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rae Moar X-Patchwork-Id: 122862 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2748946vqt; Wed, 19 Jul 2023 15:38:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlEFT/BRKtuZqMLZTa1/2p1BNbKbkA+cs+WCU+IbcDLuMAWatR/5UZ5O7yd9sDKHU6JKoVBZ X-Received: by 2002:aa7:cd49:0:b0:51e:1a3b:bd6 with SMTP id v9-20020aa7cd49000000b0051e1a3b0bd6mr3668705edw.31.1689806337051; Wed, 19 Jul 2023 15:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689806337; cv=none; d=google.com; s=arc-20160816; b=RPHiIHskjFxVbXsTkxX0m7MK5H+rftsFybRfEH6MmcV86DY0wN+c+ICMqJ+Em8aKzN Wff1P0ag7jH9Qf82p3npqNjbCMZE9Zj3T3Mx7vOSz953pD9sFqjL8F1DRe8YZhCHks9L BMdaqjQ8oimpMTaAKqowV0RkzYNMMzEcge/mjT6ynX5Sm9D71jD1OyR5mfQT9M7vwMEw h+/JayJLqec3UYtq3raTNwsH1SRADGqMPxTdURQHZQQzmkylozAYl3qulZPeBtG4m0sB D6M6NMFvOrQa3A9Tv+CvL/bJhmc4QzLzxWC3j34c+OQeDGfipbowYRN7N4nmyZev17bp A0dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=sIpA2pCI31/vstZBCLZcYLfoiRSlzDk26WYykbpKRs0=; fh=eSOGplXNKm0TQlVMiAPjma3ZxjxuDQ0l9LD5ETEQPUY=; b=wjPag7X6chmwfjhDsvhLZKCmUpT1Fmrt5GhZMlvbn7odak13KU8BdrteI/oODQq9Tn 5o52iFHHNH/cQjgbO2HfOvmy3jRP7IDoH2uQbY3j5tHvDs4Vj/ay83DBhUQKQhGFxiGX wVEZlT0BHRe8ZA1WFxcF+IJlBxTgxsqz0MbXR3pGapMpbt7OOE4nMnKbVITtwkKNct2A 2dHlcKa5kq7HJNaDwT4CibywsoGBMctjpE5Jl+Bkea2/H1SwgfWnLMeQ8ehuaKUtrtjk HxHhjvZcBj/m71SMOxsIQsnPXzpqDZZdTZPisiSYOaeXAjZnph693dFmdUZEWqQGuHHV ZRZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=aExkNcdC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020aa7de87000000b00516b291217fsi3731254edv.0.2023.07.19.15.38.33; Wed, 19 Jul 2023 15:38:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=aExkNcdC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbjGSWYe (ORCPT + 99 others); Wed, 19 Jul 2023 18:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjGSWYX (ORCPT ); Wed, 19 Jul 2023 18:24:23 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A12D926A0 for ; Wed, 19 Jul 2023 15:24:04 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-cf0bc5604eeso112542276.2 for ; Wed, 19 Jul 2023 15:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689805443; x=1692397443; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=sIpA2pCI31/vstZBCLZcYLfoiRSlzDk26WYykbpKRs0=; b=aExkNcdCiwSKCRFZQRazAUw+POtV1ZY1oY9KqCPuUxyVDSTb4m7ZAUwBMuxPLeoQ+E DhWO8r0jkU27P0phJTEl3A8y68Whl8jlHqJ1E+Rx0jpAgawkmZAJ/x1Mx0BmYLFGdHVz eo20uVmy3pITzg5bS2045EFmAZwykYS14y1/Qg4NekGJRL7Bc7WwSYMfLr5at3TNAxJM jf6Y83WMI3JiuA/PuMczSd6rk8iLz2RLaiY09ZDjFbtGXVJphJ/lSohb7khozR5skgCP cceUTwiITld3gT+F4qjy1dNl1t39Ji0Z4QyZdZ1SCY3b7NeGFUJUE25UexBP6Sx+AbQb kBJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689805443; x=1692397443; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sIpA2pCI31/vstZBCLZcYLfoiRSlzDk26WYykbpKRs0=; b=I+A0jUh8pWyX0aVQrT/PX27SmUOGyE9r/JdlGvjXwIKhJlv/7dxaf2+ai3vVoN0kXx qcU5lZik+aZJfh/JgGP0oXHFvFFWKPu/8SsyopVJSQLRt+Ye6FP41TiPhJf/qThSt6X+ YYLEL64GpyNKCRNlh2QhDPjtsumX9R1F0bsk/AxSWKPsA/J7NIa0AHd0YUm9v8Lqgwd6 AS9jBm+TeYSLydAd7/NWtysrN9Y23D46UJRMrW4eQkB1YGsCZHQMRXmC8Jr9awq6HqZ3 OoUdsMA8yPRxzSNYtVF3iClYZD/nfAr+iiOhciJqVCW8oTU/eOLi+ilnDJAEdsJNrrS5 fLOg== X-Gm-Message-State: ABy/qLaeAFajnXXWdbYfb3oKnqKCQoH3MKBMy6uRQcaPOQDIakpeHdJ6 RKAaAzciZ6u8WhOyPC3q0SFxfgV9YQ== X-Received: from rmoar-specialist.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:45d3]) (user=rmoar job=sendgmr) by 2002:a25:26cb:0:b0:c22:c2e0:93bf with SMTP id m194-20020a2526cb000000b00c22c2e093bfmr29785ybm.6.1689805443549; Wed, 19 Jul 2023 15:24:03 -0700 (PDT) Date: Wed, 19 Jul 2023 22:23:33 +0000 In-Reply-To: <20230719222338.259684-1-rmoar@google.com> Mime-Version: 1.0 References: <20230719222338.259684-1-rmoar@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230719222338.259684-7-rmoar@google.com> Subject: [PATCH v1 6/9] kunit: memcpy: Mark tests as slow using test attributes From: Rae Moar To: shuah@kernel.org, davidgow@google.com, dlatypov@google.com, brendan.higgins@linux.dev Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, keescook@chromium.org, linux-hardening@vger.kernel.org, jstultz@google.com, tglx@linutronix.de, sboyd@kernel.org, Rae Moar X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771890369924321728 X-GMAIL-MSGID: 1771890369924321728 Mark slow memcpy KUnit tests using test attributes. Tests marked as slow are as follows: memcpy_large_test, memmove_test, memmove_large_test, and memmove_overlap_test. These tests were the slowest of the memcpy tests and relatively slower to most other KUnit tests. Most of these tests are already skipped when CONFIG_MEMCPY_SLOW_KUNIT_TEST is not enabled. These tests can now be filtered using the KUnit test attribute filtering feature. Example: --filter "speed>slow". This will run only the tests that have speeds faster than slow. The slow attribute will also be outputted in KTAP. Note: This patch is intended to replace the use of CONFIG_MEMCPY_SLOW_KUNIT_TEST and to potentially deprecate this feature. This patch does not remove the config option but does add a note to the config definition commenting on this future shift. Acked-by: Kees Cook Signed-off-by: Rae Moar --- Changes since RFC v2: - No changes. Changes since RFC v1: - Added note under CONFIG_MEMCPY_SLOW_KUNIT_TEST. lib/Kconfig.debug | 3 +++ lib/memcpy_kunit.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 550cb967b668..1b3894e861f2 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2701,6 +2701,9 @@ config MEMCPY_SLOW_KUNIT_TEST and bit ranges. These can be very slow, so they are split out as a separate config, in case they need to be disabled. + Note this config option will be replaced by the use of KUnit test + attributes. + config IS_SIGNED_TYPE_KUNIT_TEST tristate "Test is_signed_type() macro" if !KUNIT_ALL_TESTS depends on KUNIT diff --git a/lib/memcpy_kunit.c b/lib/memcpy_kunit.c index 887926f04731..440aee705ccc 100644 --- a/lib/memcpy_kunit.c +++ b/lib/memcpy_kunit.c @@ -551,10 +551,10 @@ static void strtomem_test(struct kunit *test) static struct kunit_case memcpy_test_cases[] = { KUNIT_CASE(memset_test), KUNIT_CASE(memcpy_test), - KUNIT_CASE(memcpy_large_test), - KUNIT_CASE(memmove_test), - KUNIT_CASE(memmove_large_test), - KUNIT_CASE(memmove_overlap_test), + KUNIT_CASE_SLOW(memcpy_large_test), + KUNIT_CASE_SLOW(memmove_test), + KUNIT_CASE_SLOW(memmove_large_test), + KUNIT_CASE_SLOW(memmove_overlap_test), KUNIT_CASE(strtomem_test), {} };