Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1102636rwl; Wed, 29 Mar 2023 12:44:41 -0700 (PDT) X-Google-Smtp-Source: AKy350YlrI17JWI+U+DXUF16nB9rXLDR3DP7tVqgIa1CfP7mNyW7axTw91ygGlcHlrB2dkGRI0tX X-Received: by 2002:a17:906:a3ca:b0:926:e917:133c with SMTP id ca10-20020a170906a3ca00b00926e917133cmr20198954ejb.47.1680119081449; Wed, 29 Mar 2023 12:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680119081; cv=none; d=google.com; s=arc-20160816; b=UWWDtEtITAqUNuDp5jppR8DhXecs4VQUcwKPdn5QHFZipxJaMy9KuqSwcg+cB1bPO/ IOsTArgm5ZAqdBCiK0Bl+G9scmMY7HwmdUSV3ZDBFHnvh5gClqksMwWDXBAcx/w5ULAW 7ayUmg1z8VGwyBg9GKiFZAahPSEPjyTxNwLSHEa+Ekljb7wWnDCY9vCYWJh2PdPilLbC ycy61ecBkg8CAX5tsy7ryo25KoVWBE7eWyoOLVTu/3+vizTt2mUaP4+oD5wFjm2byiOj KOS9dQRp+qV0bbgK3fGKCc3q4Y0M2EvseYrTW6GSWQVFC5QulS86FxZtsNV5vSB8X0CI 3mfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:feedback-id:dkim-signature :dkim-signature; bh=2f5rYYd0tlnULsG95qckYDb8lBBCrzn8vdFiBpBskrI=; b=Hz1Dk4bAq7RVfJ9NR452pbryGX3vphTGELLVeP/tHd/bzI54SnyxBRqfs/c1ZDnViE IBH44T6XIeT1yFGeMrhHaTrkUmgbdRtKAc48aZue7VJ/KjLeU1vshvNsLJeDgJ12uWHS 4mBNha3c/0eFUhf2kngaRUXeMIUhAAcqI6ViZRp5GcOnKUaQpdgod6oMNxg1cDE1qEA8 M5CQ0GRhsgvATqe279GJ1Kp/iCvIUZdWam3vDjLJbawlZA6XwB/7/V0kEy9KHV8eVlt0 ow2HuhWIH8Ptq+7la2XUC5yS2nZdh2SfA/hYCiJ/BnEgi51W3yTlWnZXejXMp38tVwyG BgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=NDjnjQio; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=uyB+3G5W; 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=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rk5-20020a170907214500b00930a3fe36f2si31781556ejb.38.2023.03.29.12.44.15; Wed, 29 Mar 2023 12:44:41 -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=@cerno.tech header.s=fm3 header.b=NDjnjQio; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=uyB+3G5W; 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=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbjC2Tk4 (ORCPT + 99 others); Wed, 29 Mar 2023 15:40:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbjC2Tkg (ORCPT ); Wed, 29 Mar 2023 15:40:36 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAC2B61AB; Wed, 29 Mar 2023 12:40:27 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CDF553200970; Wed, 29 Mar 2023 15:40:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 29 Mar 2023 15:40:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :sender:subject:subject:to:to; s=fm3; t=1680118823; x= 1680205223; bh=2f5rYYd0tlnULsG95qckYDb8lBBCrzn8vdFiBpBskrI=; b=N DjnjQioxravOwTiq91yztIm1lN0V9CX2/jADRcbJ0ZBkr1M3tjp4dX2usXG0fqqO iE3NCrxJo9xTBxLpPz5Q8fu/JAvKIW6qh1MyRpgHq3Qb8I62YYWvmDUAb9ppl/Tr da2o0XYqOHVspIWsEIhxvsKzS2sbD9aNWZRXa9aXDGOMLXH0Xg9vjhds8XyzvOvz 4b3QZPpEHmEzDK9TX+7oZk2TkiieeZtpKvO9WYHQkryrhfsP37nckakRoJm1mA5z il1gpuaVrkav/wX8FiKyKs2BW3M/0guY13wWu+0NrEmTz2pYHw8Yd8Y0Gz9g6kmW lMRTzkFZ2IbPNwF+alGrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1680118823; x=1680205223; bh=2 f5rYYd0tlnULsG95qckYDb8lBBCrzn8vdFiBpBskrI=; b=uyB+3G5WVug9wiQJ3 wBmGqvwq1Y0nG2zLdy4Z3EIeQihQQOAgDKTDzX3RjCUzV0VKfe54cb+B6mAS1Am7 ZG8ZVDgtSX6gwpb5lsg5llXoSOoq7USDKl/pV6ERmaRCjEMzRjCAbbH405I1FktX rp8IxJBak3RTt+urxRVtP3Siq2fcpHPB7/rzvfwsTW0mTg0ZnHpeAQNa8d66zPjT gSC/lVFbxqfgtJfIyad9Jb7LBk++DJe9WG8xL6HhZ5Az79fHRRbANyfjJ9aTSuRV rafkyUyyPsdQ9EvSqZBbmB6QBsFhq1V7gZz/96lKsMuVTqBdPg9S2I0Yn5HWGQ4L bGHaA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehiedgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhufffkfggtgfgvfevofesthejredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpefguedtjedvieehffevteeijedthfelkeelffehjedthfekheefkeegvdeg iedttdenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggt hh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Mar 2023 15:40:22 -0400 (EDT) From: Maxime Ripard Subject: [PATCH 0/2] drivers: base: Add tests showing devm handling inconsistencies Date: Wed, 29 Mar 2023 20:38:30 +0100 Message-Id: <20230329-kunit-devm-inconsistencies-test-v1-0-c33127048375@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIALaTJGQC/x3NwQ6CMBCE4Vche3aTUoJGX8V4KO0oG3Ex3UJIC O9u4/Gfwzc7GbLA6NbslLGKyaw12lNDcQz6AkuqTd75znX+yu9FpXDC+mHROKuJFWisBhdY4R5 9uCTX4uwSVWUIBh5y0DhWR5dpquM34ynb//b+OI4fTB2fkoYAAAA= To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Brendan Higgins , David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1519; i=maxime@cerno.tech; h=from:subject:message-id; bh=JFmIiuIgbQg8/mhZab8A/LJP1D9dGdFGvbtghkhMhpU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCkqk3dtrFtfvGp912q5/0vkI/UYvZ5utz1z7nXwo9r3T GsidetrOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRShWGn4yJqmYmgmHMDaLX Q59V1x/4KHmE/ZHxHbXw+jOM+x4/Oc7I0NtytSArOXHlYwc7xUNxq39a8d95b1MszJ63Qlc6f90 eBgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS 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 Hi, This follows the discussion here: https://lore.kernel.org/linux-kselftest/20230324123157.bbwvfq4gsxnlnfwb@houat/ This shows a couple of inconsistencies with regard to how device-managed resources are cleaned up. Basically, devm resources will only be cleaned up if the device is attached to a bus and bound to a driver. Failing any of these cases, a call to device_unregister will not end up in the devm resources being released. We had to work around it in DRM to provide helpers to create a device for kunit tests, but the current discussion around creating similar, generic, helpers for kunit resumed interest in fixing this. This can be tested using the command: ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/base/test/ Let me know what you think, Maxime Signed-off-by: Maxime Ripard --- Maxime Ripard (2): drivers: base: Add basic devm tests for root devices drivers: base: Add basic devm tests for platform devices drivers/base/test/.kunitconfig | 2 + drivers/base/test/Kconfig | 4 + drivers/base/test/Makefile | 3 + drivers/base/test/platform-device-test.c | 278 +++++++++++++++++++++++++++++++ drivers/base/test/root-device-test.c | 120 +++++++++++++ 5 files changed, 407 insertions(+) --- base-commit: a6faf7ea9fcb7267d06116d4188947f26e00e57e change-id: 20230329-kunit-devm-inconsistencies-test-5e5a7d01e60d Best regards, -- Maxime Ripard