From patchwork Wed May 18 07:32:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 12853268 X-Patchwork-Delegate: brendanhiggins@google.com 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 52CDBC433EF for ; Wed, 18 May 2022 07:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232158AbiERHcw (ORCPT ); Wed, 18 May 2022 03:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232127AbiERHcv (ORCPT ); Wed, 18 May 2022 03:32:51 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E26261600 for ; Wed, 18 May 2022 00:32:51 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id lb8-20020a17090b4a4800b001df6e0cee58so2779936pjb.0 for ; Wed, 18 May 2022 00:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=iQ99kfljfaTYAW2ip5rvwd86TKnP6A3rksjwxYstBo4=; b=ETFp28WBtIw6zb/DJo7OGxpWaRVPCwEwQt9Z2hKeNmR/PJKNghF1UGsbkeHcvdUDJn T3wCFW937vAzCH71CfXie9HSan7MicV1ubc2z928O1NfYC573yFGkTLcetWL9usAYSfE ZF3bXnDxVkPd8KmzaKepQtytaxixa2yQKQ6wKkRr/wK3u2S0rqiyI+rtSnjtQI31VfBA y6U2mbADctk6jti3nOtYQ1Vhi7dSVW9NE9Ba4jFfu20gFzOkjym6Ui/GYWZnSzd8amsB lcMBvit9jCohmiTRQfhmjbwnoFc39D8JRRyOA1y3iQqcvbK7KQJ5rj2vMwtkbNb/vmEC 522g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=iQ99kfljfaTYAW2ip5rvwd86TKnP6A3rksjwxYstBo4=; b=kF1rVhvGoLI4Z6aumCdScfYlSTkYhUsxgOgafn9ynQPMcu5Nj4prF7lejMuKgqEURe KAxbMzCuHjVZe+ir/3CzcmuLgz+qMaEf/d6v6Kf24b+TpthX2HMU3DogDFSypS4Y5FwW /swvHNOC3WQiUxIwDOtbUqxseiFchy6Lz4M74G2rW+2aFwR7K9OkxRu55ZsJO2hyVfkP q712bXMmYOX7xdcpvOKpuJPLB1mKH6xju3gSPRD86Lehtl4mbyxQlZ38TPTgawPykCpQ FolwKuPupSP0vcAwJxko8PrXP+UqXGUASnhjJ3UstiQ+Fk9UzFtP/FkMyA283L+E7lsn Mnmw== X-Gm-Message-State: AOAM532ncyu3HewFO0J3ZecDByUE1VJ3rkEh6QM4HNYs0vQ+QEPRFqau x9TVOq3Wc2kWde5TdTA4yifQXjZVCX+ayw== X-Google-Smtp-Source: ABdhPJzYuK9WCyWsUpBLz7QPszl6IDdlhu2s0sQHA/ptFulSvFsKkAlDK/HkIvTDFn7wZyynWOx9yXPeagmfpw== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6a00:b4f:b0:518:161a:ed40 with SMTP id p15-20020a056a000b4f00b00518161aed40mr3418498pfo.19.1652859170621; Wed, 18 May 2022 00:32:50 -0700 (PDT) Date: Wed, 18 May 2022 15:32:31 +0800 Message-Id: <20220518073232.526443-1-davidgow@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.550.gb090851708-goog Subject: [PATCH 1/2] kunit: tool: Add x86_64-smp architecture for SMP testing From: David Gow To: Brendan Higgins , Daniel Latypov , Marco Elver , Shuah Khan Cc: David Gow , Dmitry Vyukov , kunit-dev@googlegroups.com, kasan-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Add a new QEMU config for kunit_tool, x86_64-smp, which provides an 8-cpu SMP setup. No other kunit_tool configurations provide an SMP setup, so this is the best bet for testing things like KCSAN, which require a multicore/multi-cpu system. The choice of 8 CPUs is pretty arbitrary: it's enough to get tests like KCSAN to run with a nontrivial number of worker threads, while still working relatively quickly on older machines. Signed-off-by: David Gow Acked-by: Marco Elver Reviewed-by: Brendan Higgins --- This is based off the discussion in: https://groups.google.com/g/kasan-dev/c/A7XzC2pXRC8 --- tools/testing/kunit/qemu_configs/x86_64-smp.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tools/testing/kunit/qemu_configs/x86_64-smp.py diff --git a/tools/testing/kunit/qemu_configs/x86_64-smp.py b/tools/testing/kunit/qemu_configs/x86_64-smp.py new file mode 100644 index 000000000000..a95623f5f8b7 --- /dev/null +++ b/tools/testing/kunit/qemu_configs/x86_64-smp.py @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='x86_64', + kconfig=''' +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SMP=y + ''', + qemu_arch='x86_64', + kernel_path='arch/x86/boot/bzImage', + kernel_command_line='console=ttyS0', + extra_qemu_params=['-smp', '8']) From patchwork Wed May 18 07:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 12853269 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 DAFB5C433EF for ; Wed, 18 May 2022 07:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232172AbiERHc5 (ORCPT ); Wed, 18 May 2022 03:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232115AbiERHc4 (ORCPT ); Wed, 18 May 2022 03:32:56 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E42B66AF6 for ; Wed, 18 May 2022 00:32:55 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2fecfc7a95aso12825437b3.22 for ; Wed, 18 May 2022 00:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=GtAQDy8qrMQs7mWCa7GmbHUrKXDNUra1mtOtVoTKAPY=; b=PitbkuosP0m9OyM6dQN2cmaA2R4TV0wtkHCCHVa73WeHclEwLHKbiFoC0Sb0UXjF4/ phkuGrGZytvuuRY+NZdRDOmesIvzLbcZ/cfcX11EoBRhBb0u62TqSAr7vPJm21/PA+sS ZeyHbua9VjgwrD5RRuvaXPuVYLix0CHBKzifC9EdkHgrl/nrCi1QiyYqvBTFw0zRZ07f 4N2tYOIDqeuFdnOciG0tqWMXLMLyXn9tT1cAk+45NpWRYOYnG2nND4vMX6jub467EYCk d3B6+0c9r80jbXS2tDHiWUp8XG/F/7fJjy9fyOeETn0N1mDCSLTjS1C4oauut4E2o9zJ 03mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=GtAQDy8qrMQs7mWCa7GmbHUrKXDNUra1mtOtVoTKAPY=; b=eNu9d39P4jDE2qkJ9KwV24j7Sr1oUVZoMfDtM4l6vTAySOQgHOyo0a4R/1s/1Yka3Y Ovku07hqdnbLzpk57lS7CNYJm1HGWlctbOAWI5bK6bvpwXmY48qsBjP8GTFtl6Bsuctt UIh2Obzo58jZo5XDxu1rrtrx3X2G7Y4FURfP2F6cBHfZcxDyUFp4bj5BJAP8YaO+ZAA1 dC4wrKgwk9klpIDrVfxajtuk6/cjPiA1Fb8GUVAJHCjrAglgfgZGBf3a8iOGjaFM1wir qPbnFeye/uLhRUIpk100L9GAqkwasleThYapvnVRcnH2dRTGwdn72viALDFZMRyx1RGb 4czw== X-Gm-Message-State: AOAM533VTHVFYBShGIXN33Jfw6l7mF2smEtDzgopD0lt9OVDrlGTCZTh Lwi1gVl+VOxWN+3MWZF2V5jYhXXmH/UxMg== X-Google-Smtp-Source: ABdhPJypIjypMVBz81HOJFDpHJ7rpL5x8W5jV1aqxXIeXWi9VdXO2Rh5JREbuHPp6e6Kke8tghRgheFxC3ijYA== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a81:2643:0:b0:2f4:c975:b7ca with SMTP id m64-20020a812643000000b002f4c975b7camr28529608ywm.494.1652859174736; Wed, 18 May 2022 00:32:54 -0700 (PDT) Date: Wed, 18 May 2022 15:32:32 +0800 In-Reply-To: <20220518073232.526443-1-davidgow@google.com> Message-Id: <20220518073232.526443-2-davidgow@google.com> Mime-Version: 1.0 References: <20220518073232.526443-1-davidgow@google.com> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog Subject: [PATCH 2/2] kcsan: test: Add a .kunitconfig to run KCSAN tests From: David Gow To: Brendan Higgins , Daniel Latypov , Marco Elver , Shuah Khan Cc: David Gow , Dmitry Vyukov , kunit-dev@googlegroups.com, kasan-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Add a .kunitconfig file, which provides a default, working config for running the KCSAN tests. Note that it needs to run on an SMP machine, so to run under kunit_tool, the x86_64-smp qemu-based setup should be used: ./tools/testing/kunit/kunit.py run --arch=x86_64-smp --kunitconfig=kernel/kcsan Signed-off-by: David Gow Reviewed-by: Marco Elver Acked-by: Brendan Higgins --- kernel/kcsan/.kunitconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 kernel/kcsan/.kunitconfig diff --git a/kernel/kcsan/.kunitconfig b/kernel/kcsan/.kunitconfig new file mode 100644 index 000000000000..a8a815b1eb73 --- /dev/null +++ b/kernel/kcsan/.kunitconfig @@ -0,0 +1,20 @@ +# Note that the KCSAN tests need to run on an SMP setup. +# Under kunit_tool, this can be done by using the x86_64-smp +# qemu-based architecture: +# ./tools/testing/kunit/kunit.py run --kunitconfig=kernel/kcsan --arch=x86_64-smp + +CONFIG_KUNIT=y + +CONFIG_DEBUG_KERNEL=y + +CONFIG_KCSAN=y +CONFIG_KCSAN_KUNIT_TEST=y + +# Needed for test_barrier_nothreads +CONFIG_KCSAN_STRICT=y +CONFIG_KCSAN_WEAK_MEMORY=y + +# This prevents the test from timing out on many setups. Feel free to remove +# (or alter) this, in conjunction with setting a different test timeout with, +# for example, the --timeout kunit_tool option. +CONFIG_KCSAN_REPORT_ONCE_IN_MS=100