Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2426130rda; Wed, 25 Oct 2023 02:17:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6X9e8PbejIv5/endxUbwpmivOIhLIlChrdRsPbP6akW08NxKhyTRpTIBe604dNRSGaUV9 X-Received: by 2002:a0d:dbc5:0:b0:5a8:17d4:aea1 with SMTP id d188-20020a0ddbc5000000b005a817d4aea1mr15857498ywe.28.1698225453244; Wed, 25 Oct 2023 02:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698225453; cv=none; d=google.com; s=arc-20160816; b=gG7DYHBJhrWNvD2TViGLyZjLUVGdMXaDtL/YQZ2rjIBgRZ2b2Bdh5CapAJpN+T812f GdbjTJ/ZIVhKJxlBqoGL5cmcy+oQ0ik7asrL+L9vhEt1F9OlcUxqepCIDLnbwMUw1Y9b QmHQma8sqiSNAFpT3NrtoAGmzhlJlc41tI6Yu1ZYgBliezBDyOSpKD7ar6UP8MBP4SXs 78P55Z+3VmAu/FaVa7MzPpIK6VLSXRuqrrnzVeyV7SARxflCsmzRYt3nwz8YmVjBDxKm RVUUmyWoWo14R6TVaG3N9HBGOmc7yeZK73n9SVwosgFvp9bXEB7ZIC3rtB1+Bh5Io+XW e96g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HVDkloAT1B0sCtj0v68l3Mt6p4enIWYpFWPRfUvvNYg=; fh=X0u0u7ATynxcphLgXtt65DEN0xXYfbGNaRIakkq+nc0=; b=Np5KNP4EV55azQFzoVczT2Rm4+6/mPr7asx846VlYfN23eh1EG/3+LWUizQ6BdAmMg 6+uZvH+tQFjLaZQzhLQC2jQPxGC0hfoaA0I81bVbOaJ0qJ+PMGf44xwT9Rbvq+xbQuAb cPdjA/d2vkHqs5+sOPk5kriTDv4THP1C17pm7HJmxnolkNaSkWBzD+MX1j4gI7TDFoDp Q/+30u6H32WcOGalf6LlQZcgPASviE1phHAcuoufHMbWS+n/hWon15Pkl7mt+xMHj4/+ XG69+i9bKcoBLte23l7mlipOcf2p3eE873jOXvKvwaqFVhwBDECew+E5owrcBPhIPoQm o+dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6umIJie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id r7-20020a818107000000b00592620eba39si10861146ywf.448.2023.10.25.02.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 02:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6umIJie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 75306801B99A; Wed, 25 Oct 2023 02:17:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234242AbjJYJR1 (ORCPT + 99 others); Wed, 25 Oct 2023 05:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234230AbjJYJRY (ORCPT ); Wed, 25 Oct 2023 05:17:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96FD1181; Wed, 25 Oct 2023 02:17:22 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC42EC433C7; Wed, 25 Oct 2023 09:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698225442; bh=SQKdM/Kxu04h1c8FbFA9IJo9KecIQs7DTttOwbPdWUM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X6umIJieOSUHChlY+IijtgaGmlGx3wekwa6Uu5S1+5yivcZn7/BF0BA+5elFjJNDe voG0wWuWiysAY2i6u5gxdj5MGckjeATvIs9LnfF2ETpEdC2oKvYt9xGdCq2JO9mrES MwHOKBVTpXV8An6kqxtwoypKHyVWtTZ10Pltdr/Yz9Ru4IfBRiGmz3+FS/7gkN8iW1 6Dov2iNdPybyWJyB9q+tBCyQ63fAacFwLqKv2ntjAQrQYFRyjOcPFvZLicylPoixLa GI2sQco4vZ0dvvrZN4Edm4SoL8kF1RTFNZpoSqBmxZkZLHF4N/ss+3pYk5ZN7mbuGc +N1RZLqx937Bg== Date: Wed, 25 Oct 2023 11:17:19 +0200 From: Maxime Ripard To: Rae Moar Cc: Brendan Higgins , David Gow , Jani Nikula , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] kunit: Warn if tests are slow Message-ID: <7nhmlcn3bbe3ey5tw43umsahjei3fisyxxp3vhf34lsi5s4wkr@qpp4bsdv4wom> References: <20230920084903.1522728-1-mripard@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="re4ceqeclcsd5wjq" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 02:17:31 -0700 (PDT) --re4ceqeclcsd5wjq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Rae, On Tue, Oct 24, 2023 at 03:41:33PM -0400, Rae Moar wrote: > On Wed, Sep 20, 2023 at 4:49=E2=80=AFAM Maxime Ripard wrote: > > > > Kunit recently gained support to setup attributes, the first one being > > the speed of a given test, then allowing to filter out slow tests. > > > > A slow test is defined in the documentation as taking more than one > > second. There's an another speed attribute called "super slow" but whose > > definition is less clear. > > > > Add support to the test runner to check the test execution time, and > > report tests that should be marked as slow but aren't. > > > > Signed-off-by: Maxime Ripard > > >=20 > Hello! >=20 > Thanks for following up! Sorry for the delay in this response. np, I kind of forgot about it too to be fair :) > This looks great to me. I do have one comment below regarding the > KUNIT_SPEED_SLOW_THRESHOLD_S macro but other than that I would be > happy with this patch. >=20 > This patch does bring up the question of how to handle KUnit warnings > as mentioned before. But I am happy to approach that in a future > patch. > > And I do still have concerns with this being annoying for those on > slower architectures but again that would depend on how we deal with > KUnit warnings. Yeah, I agree there > > To: Brendan Higgins > > To: David Gow > > Cc: Jani Nikula > > Cc: Rae Moar > > Cc: linux-kselftest@vger.kernel.org > > Cc: kunit-dev@googlegroups.com > > Cc: linux-kernel@vger.kernel.org > > > > Changes from v1: > > - Split the patch out of the series > > - Change to trigger the warning only if the runtime is twice the > > threshold (Jani, Rae) > > - Split the speed check into a separate function (Rae) > > - Link: https://lore.kernel.org/all/20230911-kms-slow-tests-v1-0-d3800a= 69a1a1@kernel.org/ > > --- > > lib/kunit/test.c | 27 +++++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > > index 49698a168437..a1d5dd2bf87d 100644 > > --- a/lib/kunit/test.c > > +++ b/lib/kunit/test.c > > @@ -372,6 +372,25 @@ void kunit_init_test(struct kunit *test, const cha= r *name, char *log) > > } > > EXPORT_SYMBOL_GPL(kunit_init_test); > > > > +#define KUNIT_SPEED_SLOW_THRESHOLD_S 1 > > + > > +static void kunit_run_case_check_speed(struct kunit *test, > > + struct kunit_case *test_case, > > + struct timespec64 duration) > > +{ > > + enum kunit_speed speed =3D test_case->attr.speed; > > + > > + if (duration.tv_sec < (2 * KUNIT_SPEED_SLOW_THRESHOLD_S)) >=20 > I think I would prefer that KUNIT_SPEED_SLOW_THRESHOLD_S is instead > set to 2 rather than using 2 as the multiplier. I realize the actual > threshold for the attributes is 1 sec but for the practical use of > this warning it is 2 sec. Right. So I kind of disagree here. To me, the define should match the definition we have for a slow test. We chose to report it only if it exceeds it by a margin, but that's a separate thing from the actual threshold. I guess I could add a new version to make that distinction clearer. Would that work for you? Maxime --re4ceqeclcsd5wjq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZTjdHwAKCRDj7w1vZxhR xTdtAQD0p4cQm0zUoPf24k74/8nRBRRg4MM1MIick9LeHTrQqQD/fmHItzqlVDea tpzEFOtAAZg64NPAvfUr4OqoLeuxIAY= =MNhh -----END PGP SIGNATURE----- --re4ceqeclcsd5wjq--