Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp363795rwr; Tue, 25 Apr 2023 23:54:01 -0700 (PDT) X-Google-Smtp-Source: AKy350a1OEVZvDGZLr+xP82Tw46xM1XPe/5rPo8bpPXXvO2iKFxhW6PC7vHr4lw+v/ZZFh7hQM43 X-Received: by 2002:a05:6a00:1a53:b0:63d:311a:a16b with SMTP id h19-20020a056a001a5300b0063d311aa16bmr27915101pfv.23.1682492040761; Tue, 25 Apr 2023 23:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682492040; cv=none; d=google.com; s=arc-20160816; b=fKkRpmHQXQ1OmkKR1LNaKU5+MVidTBRtp6/7oqDq7sz+DSQt0YtxyMzxHhNBvFSLjW 0Bng2SRz5L3bBvuEn1/LerEYjWWbqUlTd2wfoSSg80RrbAtwEsBbvzD3Am2GYm3OZxbY m9bdTGfSy+MvQdFSGlfm1awCwyjgv3clEQqNWFNGH81fY5pF2fpTKCveG4osxDv08PZ+ 6aOvrkisVigronY12w0fAqy6ysbe0KuImNVOH5FKBXBNEwHv+Y88iyRcs8/x1yT+3yxt g8kKUQUJpRn3hjXNRzNJcbCxQGcmqjNtGmRIlhsWwyO5d0VCXzKCKFgFXPfy5YVQfCmA /SoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=E7WUK9l5ab7TXtH6Khba5tk5e927ngC9f08ZD0F1KpI=; b=yU+J5i6Qvu/lcMYIFfzW6QlNYq+vkWm7PZrCaRQ1ZDigWe9bKPWoYDmyeaMEWDv26d QECYas1EUv5nJXbON4x1tvX3yWk3bmnYFbSDn4YRUNqOv4EPMQpH7bhGdU5TqbyedVCF h8KqYErRVA/wS9vR20SZyF4C8LYz19Q4SFmETkJGVzqkaPVJCNaA/KWvWwLM2r6dziHb OzlRHNIhQPhCjrbDJ/Rletd+UH5/c7VnXOG5mgxBejI56VVu0Bfvvg7BuSG38h74ffL4 zN2oH3EW1lNCSVh9v+ysr3wOObYvl01rvveBEsjzYi7oVGXaF0aIFTdb6K9NcJRpfIjl JAWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=C26x15qH; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020aa79697000000b0063b8a054e06si15575459pfk.259.2023.04.25.23.53.43; Tue, 25 Apr 2023 23:54:00 -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=C26x15qH; 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 S239637AbjDZGwN (ORCPT + 99 others); Wed, 26 Apr 2023 02:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239504AbjDZGwK (ORCPT ); Wed, 26 Apr 2023 02:52:10 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18A2E30E0 for ; Tue, 25 Apr 2023 23:52:02 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-3ef31924c64so317791cf.1 for ; Tue, 25 Apr 2023 23:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682491921; x=1685083921; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=E7WUK9l5ab7TXtH6Khba5tk5e927ngC9f08ZD0F1KpI=; b=C26x15qHgibXkdc4k0Lq/V8+IrCd+CWATgbNfZkPlEQwjIITNgfDFNdNWjFnzXgug4 H2sHeCQg7xSfy4fCnYZQrkJYYzP8GNL1mWa23CZrNt1FSKBCS3GLf/wu46XygLOI9Amt bbm7CEAIuJAHMTBEq8v4FO9P0N7E/jtfQ19/Vy1C71wYsY2vwRY4ItdeYouNJvAORmiC sLLN/TwY/wpmBBApx+pMi/jcZHURvIu963KGrpuiN2IeljU88xY8Duk/QCzFyz5oYXRg lkQCiVbfo/Yi+NMsQNOTzTZo0Ulsle8t6+QAMxAGm7ckK1Pi7wIi1uw0TawPNAhHtU9U uFFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682491921; x=1685083921; h=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=E7WUK9l5ab7TXtH6Khba5tk5e927ngC9f08ZD0F1KpI=; b=RfSe4wbYLTeE/esysJvgNzxvybsRDNxBaYNb1HirUbpfR08DKLrRJSaGdolOlfGix+ q7onXiOMEtqk47pHNBcn11ewxp/lFSZfCNgC49HSW4HAf9ENGnKiyE+U+pFL/aNYyZG+ f/sgK+Cs8KUWlGsrIhMHX2iHBVNFXi8UqhCsEhxkiaLzOFQkbjLpQGln2qHu9fYZkO7g 5YAA+pKTrzHX1j43bxPT4XanwXLJ186oaHdYnk0hIBSFnXijmfnwr+hOB4WTcAd1Jna0 kEaCu1NKMMY5xvFyYbYgFAOD+FOtqpjO5URxWidOaDVlAo0SwnYBX57zcgEIdU/W5ez9 h69g== X-Gm-Message-State: AC+VfDxTVl7x6H0DILja9Q1aRCQKI7dwLAXS6E/llpiTJ1imR6WXtrs6 z/SNioLwOQyNi57ovt5d0zWdPFtonqZPKO5HQ+7sAw== X-Received: by 2002:ac8:7e84:0:b0:3ef:1c85:5b5e with SMTP id w4-20020ac87e84000000b003ef1c855b5emr150190qtj.19.1682491921197; Tue, 25 Apr 2023 23:52:01 -0700 (PDT) MIME-Version: 1.0 References: <20230421084226.2278282-1-davidgow@google.com> In-Reply-To: From: David Gow Date: Wed, 26 Apr 2023 14:51:50 +0800 Message-ID: Subject: Re: [PATCH v1 0/3] kunit: Deferred action helpers To: Maxime Ripard Cc: Matti Vaittinen , Brendan Higgins , Stephen Boyd , Shuah Khan , Daniel Latypov , Rae Moar , Benjamin Berg , Greg Kroah-Hartman , "Rafael J . Wysocki" , Heikki Krogerus , Jonathan Cameron , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000051124605fa37ad77" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 --00000000000051124605fa37ad77 Content-Type: text/plain; charset="UTF-8" On Tue, 25 Apr 2023 at 23:23, Maxime Ripard wrote: > > Hi, > > On Fri, Apr 21, 2023 at 04:42:23PM +0800, David Gow wrote: > > This is v1 of the KUnit deferred actions API, which implements an > > equivalent of devm_add_action[1] on top of KUnit managed resources. This > > provides a simple way of scheduling a function to run when the test > > terminates (whether successfully, or with an error). It's therefore very > > useful for freeing resources, or otherwise cleaning up. > > > > The notable changes since RFCv2[2] are: > > - Got rid of the 'cancellation token' concept. It was overcomplicated, > > and we can add it back if we need to. > > - kunit_add_action() therefore now returns 0 on success, and an error > > otherwise (like devm_add_action()). Though you may wish to use: > > - Added kunit_add_action_or_reset(), which will call the deferred > > function if an error occurs. (See devm_add_action_or_reset()). This > > also returns an error on failure, which can be asserted safely. > > - Got rid of the function pointer typedef. Personally, I liked it, but > > it's more typedef-y than most kernel code. > > - Got rid of the 'internal_gfp' argument: all internal state is now > > allocated with GFP_KERNEL. The main KUnit resource API can be used > > instead if this doesn't work for your use-case. > > > > I'd love to hear any further thoughts! > > I've converted the KMS kunit tests to use that API when relevant, and > it works like a charm and is super usable, thanks so much. Nice! I'm glad it's working well. > > One improvement we could do as a second step is to provide a > kunit_action_t type or something to make casting kfree-like functions > easier, but it's already great overall. I had that in an earlier version and got rid of it to better match what devm_* was doing, but I personally agree that it's nice to have. I'll add it back in the next version. > Reviewed-by: Maxime Ripard > Tested-by: Maxime Ripard Cheers, -- David --00000000000051124605fa37ad77 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ggz5MIIEtjCCA56gAwIBAgIQeAMYYHb81ngUVR0WyMTzqzANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA3MjgwMDAwMDBaFw0yOTAzMTgwMDAwMDBaMFQxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhM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