Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4274263rdb; Mon, 11 Dec 2023 14:17:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDtsO3+A/1hfSn1PoyJcQ3L8/8EKI8H4YdFv5kRVoA4xfzrYrdtUyFdMJY7SHkjZ1zqWQ8 X-Received: by 2002:a05:6a00:17a3:b0:6ce:5721:32cb with SMTP id s35-20020a056a0017a300b006ce572132cbmr3061493pfg.59.1702333026449; Mon, 11 Dec 2023 14:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702333026; cv=none; d=google.com; s=arc-20160816; b=kzYT8FTtj1HUyLDh5FqHct1P7MncX0hcQtUIz3ervJiS1uB8NwoSNLe7jj3FQaX/EF U0XctI+aV0IM/6+VOZaK+kZgHr4a3jd1aoze7LtiaMtsIgmwRNRd+k3nO0VY/0a11Xa6 LPWZZrZv697Z7ax1BlMvzpXfWEvquS34qENdwVPyizaoV2XVfpR4KmhmGKUUM06BS+YP Bf3fjFArIHql3r24ZlmuW7ZC4Z1VPKxcQVOH/iRptjVmeF1aZVVHDTXpJzXwAVUnzqMG w+Ti+gyYEVMLmoQBaYZzSl4XuLYN1ww9+BqgBqYZmz8ZIO83PUp80OI5RGC/7US52nQT 0xiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=nvF5V1Q9Ar02mtoysYDu05U7aSKEzXllew7q5EyIvRE=; fh=WrJNEbZEqZFtkgJa91CUUkBae7oEsf1zS0vVMhZJxBA=; b=hrQeLsBKHSy07wCb1KKgaZnPvZdkyKeYQdGNJHXUtGpzYLefFFTi+vFzARQibD9GeA AlRjHGyliFpUEMb4qg/V87+BJbH4D/xLzPRPVPPQTdF6w30IcXsQupf/XQPCYjUYsnQS 5COMfblLRkQtdiv1rpyPSplFTGKlEZk0AIuICYtMdckgiktQ9SKAbBZkxqfC6ZTMKdXX k8fKYG9ZJ+prSptIUal3qImYKRFgWypzrGWYIwLAonVVysaItgDe9PIVBfUeU0cHW8w/ pHmkqh0usX44eUGLaCcTXSFqqGSiTpj34pCXjjtA/HDyptDyMeWITkoLHkVWakWVT9SH jqDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="EJGkd/iw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id k6-20020aa788c6000000b006cbf2bc1af9si6648009pff.0.2023.12.11.14.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 14:17:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="EJGkd/iw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4849A8079720; Mon, 11 Dec 2023 14:17:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbjLKWQq (ORCPT + 99 others); Mon, 11 Dec 2023 17:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjLKWQp (ORCPT ); Mon, 11 Dec 2023 17:16:45 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A4E8F for ; Mon, 11 Dec 2023 14:16:50 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40c32bea30dso22375e9.0 for ; Mon, 11 Dec 2023 14:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702333008; x=1702937808; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nvF5V1Q9Ar02mtoysYDu05U7aSKEzXllew7q5EyIvRE=; b=EJGkd/iw2jT4LICCe7+1ZUUwN7mBfzeOtBXag0ZjSuy9YBg/LBxNWAFQQ7Il7oD0/W natwddcNSVEvix41/0w02yQvnstpeVWLmZW6nHMcMTCn407rnT7CZV5jkkI+ouyYG/O2 uAbBZOJlmBL2FhYDMN32/d3PHfZEuVZNkzWhfCti6QFl+1UpEUa+hAxo144ds8nGSZkD X8kVeWtJlLjj6Tuz3dfFEMu56+vgn31UFcAKVsJtIC0vkhg3ItzzyVSWW2hEJApzUJQy Qyq7JtKPNEg7ILjTzWPZObmhA3X5nGxSh4YHyk7wP3BYYZBi+E7KsrdxstPjOez//nmI yKHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702333008; x=1702937808; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nvF5V1Q9Ar02mtoysYDu05U7aSKEzXllew7q5EyIvRE=; b=mUFcR8iXUCUaIqvFOG3We4wekkKXxQe6RtOAlhtN0w6QWwgyh3ocf6QRkXfucjl4kw xHoXWr5xZ64Hh42tjAgpiLDgaRamciNcXN/g+h1PYqhpcISNdycEtFDj+au/QRunXMiE lPCZ+/Et7/+8b+y+t4x2GrYwRnlQWmVgbnGCqQbVHUHnqqVjlh3vIsEJ34cfdAKkKLjR JCXEU5nnCp3DURrNlUevjO1KKv2aM9t8ZwWyUDg6u5g/T/ih0QFRvJVdMJlnivFBRc/z 7CEAGjoxxrXgUITO2MWb0DYKEI3AaMFbvaRs4+DHQDsCxCE6kq07PlS/XmPLGj66hbiS usTA== X-Gm-Message-State: AOJu0YzTBWG7eOOUY4FDQXp+kivxg45gWWfb1ODGg18nYe6EHK5mrTAV /ibwAmV0GRU3AVQSSdgRT7z+i3VPFXtaQBhxV2fYqA== X-Received: by 2002:a05:600c:1910:b0:40c:337e:f596 with SMTP id j16-20020a05600c191000b0040c337ef596mr258861wmq.0.1702333008321; Mon, 11 Dec 2023 14:16:48 -0800 (PST) MIME-Version: 1.0 References: <20231204221932.1465004-1-rmoar@google.com> <20231204221932.1465004-6-rmoar@google.com> In-Reply-To: From: Rae Moar Date: Mon, 11 Dec 2023 17:16:36 -0500 Message-ID: Subject: Re: [PATCH v3 6/6] Documentation: Add debugfs docs with run after boot To: David Gow Cc: shuah@kernel.org, dlatypov@google.com, brendan.higgins@linux.dev, sadiyakazi@google.com, keescook@chromium.org, arnd@arndb.de, linux-kselftest@vger.kernel.org, linux-arch@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 11 Dec 2023 14:17:03 -0800 (PST) On Sat, Dec 9, 2023 at 2:58=E2=80=AFAM David Gow wrot= e: > > On Tue, 5 Dec 2023 at 06:19, Rae Moar wrote: > > > > Expand the documentation on the KUnit debugfs filesystem on the > > run_manual.rst page. > > > > Add section describing how to access results using debugfs. > > > > Add section describing how to run tests after boot using debugfs. > > > > Signed-off-by: Rae Moar > > --- > > Looks good to me, some nitpicks below. > > The other thing I'd really want to add is some documentation on > writing init-section suites, which covers the pitfalls better (as > mentioned in the previous emails). Though that could be a separate > patch if you want to keep this one debugfs-specific. > > Otherwise, > Reviewed-by: David Gow > > Cheers, > -- David Hello! I have responded to your comments below. I would also be happy to add documentation to the init-section suites either in this patch series or in a future one. Thanks! -Rae > > > > > Changes since v2: > > - Add info to documentation about cleaning up data, init tests, and > > running tests concurrently > > > > Documentation/dev-tools/kunit/run_manual.rst | 49 ++++++++++++++++++-- > > 1 file changed, 45 insertions(+), 4 deletions(-) > > > > diff --git a/Documentation/dev-tools/kunit/run_manual.rst b/Documentati= on/dev-tools/kunit/run_manual.rst > > index e7b46421f247..aebb52ba9605 100644 > > --- a/Documentation/dev-tools/kunit/run_manual.rst > > +++ b/Documentation/dev-tools/kunit/run_manual.rst > > @@ -49,9 +49,50 @@ loaded. > > > > The results will appear in TAP format in ``dmesg``. > > > > +debugfs > > +=3D=3D=3D=3D=3D=3D=3D > > + > > +``debugfs`` is a file system that enables user interaction with the fi= les to > > +make kernel information available to user space (See more information = at > > +Documentation/filesystems/debugfs.html) > > Nit: reference debugfs.rst here, not debugfs.html -- sphinx ought to > update the link automatically. Thanks for catching this! I didn't realize Sphinx would update it. > > Also, maybe we can make this introduction a _little_ bit more > KUnit-specific. I'd personally start by saying that KUnit can be > accessed from userspace via the debugfs filesystem (link), usually > mounted in /sys/kernel/debug/kunit, etc, if CONFIG_KUNIT_DEBUGFS is > enabled. Ok I will add this for the next version. > > > + > > +By default, only the root user has access to the debugfs directory. > > + > > +If ``CONFIG_KUNIT_DEBUGFS`` is enabled, you can use KUnit debugfs > > +filesystem to perform the following actions. > > + > > +Retrieve Test Results > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > + > > +You can use debugfs to retrieve KUnit test results. The test results a= re > > +accessible from the debugfs filesystem in the following read-only file= : > > + > > +.. code-block :: bash > > + > > + /sys/kernel/debug/kunit//results > > + > > +The test results are available in KTAP format. > > Do we want to note that this is a separate KTAP document, and so may > have different suite numbering from the dmesg log? Sure! I will add this for the next version. > > > + > > +Run Tests After Kernel Has Booted > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > + > > +You can use the debugfs filesystem to trigger built-in tests to run af= ter > > +boot. To run the test suite, you can use the following command to writ= e to > > +the ``/sys/kernel/debug/kunit//run`` file: > > + > > +.. code-block :: bash > > + > > + echo "any string" > /sys/kernel/debugfs/kunit//run > > + > > +As a result, the test suite runs and the results are printed to the ke= rnel > > +log. > > + > > +However, this feature is not available with KUnit tests that use init = data. > > Let's expand this slightly, and mention that this is because the data > may have already been discarded, and that you can find such tests by > either looking for the kunit_test_init_section_suites() macro or the > is_init attribute. Got it. I will definitely expand this more. > > > + > > +Also, you cannot use this feature to run tests concurrently as there i= s a > > +mutex lock around running KUnit tests at the same time. > > + > > Instead of mentioning the mutex, which is an implementation detail, > just mention that tests will either wait for other tests to complete, > or fail having timed out. > I will definitely switch this out in the next version. > > > > .. note :: > > > > - If ``CONFIG_KUNIT_DEBUGFS`` is enabled, KUnit test results will > > - be accessible from the ``debugfs`` filesystem (if mounted). > > - They will be in ``/sys/kernel/debug/kunit//results`= `, in > > - TAP format. > > + For test authors, to use this feature, tests will need to corre= ctly initialise > > + and/or clean up any data, so the test runs correctly a second t= ime. > > -- > > 2.43.0.rc2.451.g8631bc7472-goog > >