Message ID | 20230329-kunit-devm-inconsistencies-test-v1-0-015b1574d673@kernel.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1116135vqr; Fri, 2 Jun 2023 08:36:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6NaLSecyVEnH6Cyf+eWuPxTjdVMfvzWpGpGmiXgS3SYt4KgGQTSCWKY7mbDmhj7VFg1UWV X-Received: by 2002:a17:902:fe01:b0:1b0:307c:e6fe with SMTP id g1-20020a170902fe0100b001b0307ce6femr325351plj.10.1685720187671; Fri, 02 Jun 2023 08:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685720187; cv=none; d=google.com; s=arc-20160816; b=Cx5oS93dyigKgMgZmy6rlqbF/XhmVdFl7JDwO6y0gmrD0BEFoxKKbk22Rz6vbfTuRT J+tmYpBY3cUDEwm0qw3VYN+b6UtRJDB3U4B3lsN5TrLyu++2HGNy9ZeSIUpPX9qFr6QG yzCH11PL6traviTshpZqb8i+KXyyPM8pL4oBh/2i2kkNacAouNKa5UPO1dOcjMz2Dcwn y9+LXkH6gsuJe4UvUoVLZQJpX+unZ3OU05k6T6/A2gjKcOArJWekNSrnVmEgj0z3NeFw oXH0OT79NDpSNLlmvZ58cbbLxby9qlDbkm8JUzoMF49uxnFEbmRpmdPmPJCBWZDs13Sn wXcQ== 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:dkim-signature; bh=eyA3aEiqv1jWvPz1ivBurxg+Ug/42ovTT0BEA0xYq04=; b=c/b52ClTAKhHkEnLZaBFTsSTOpaKR9VehVSISKqKxYJtJtgfzMS+fHQM0FekEUg5SH s+4a6Z8jOIvVB7kUnkzKN8w3bLpZuTXqqmqfpY6EUbF3+etvw01LTUUpK+g3zaflq/jd 2yeAlDjuY/P5EaUKmT3b4tmrKhAZvWRrKodIe+A1VKeaqr4rtLlve8OhiDnMyOxG9a2U cdTTNfZ8z1WhMM8OfGf9h+uMgTruktRwOjuzRZa5uFgWNjzDLkpizlnoiQvlHdgYFwKj xL0dmEE68B54QyR65ZuF/u7+sywKH7bFESxklI7/y72idQIL5L7r2+zFq0UHYL+BUecD G4hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h7knj2B5; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw7-20020a170903044700b001ae57456ab4si1075877plb.6.2023.06.02.08.36.15; Fri, 02 Jun 2023 08:36:27 -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=@kernel.org header.s=k20201202 header.b=h7knj2B5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236549AbjFBPUx (ORCPT <rfc822;limurcpp@gmail.com> + 99 others); Fri, 2 Jun 2023 11:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236245AbjFBPUv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 2 Jun 2023 11:20:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2483718C; Fri, 2 Jun 2023 08:20:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B590B6176E; Fri, 2 Jun 2023 15:20:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7545C433D2; Fri, 2 Jun 2023 15:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685719249; bh=JrdWhqdwYCo5+dxpyaTBpOM09b+3lqOKw8HosotnMs0=; h=From:Subject:Date:To:Cc:From; b=h7knj2B5GdpIqG30KBjAmBUV7y4Y2EqxsA8SDIG1kJB05mbthV5F579lioekLHG59 zDnBn8LOr1eTgmCyd5BtOXiry8vkipsS7M0YyELkzh/OlkCW4k7h1X8b+ByCu/ASEa uePeEu5HrE7Pm/qd9bnB8QggpmzsrYJuf/unXWRv+2pw+AUb2QSSCIxIoUCMz8Aph0 m3FLu94JvZv/6u2JwjS39wMIyyGMAKDNoin8whj8a1Rxx6hBw/jB85G/hLlUA8Hcvl Nwt/Cts0k4s6khrOLkeGTT0dx61LjRzAUrZ97t99xcXd38fb7cWxUGYt2Z5OEHV5HI d/jK6YA4963GA== From: Maxime Ripard <mripard@kernel.org> Subject: [PATCH RESEND 0/2] drivers: base: Add tests showing devm handling inconsistencies Date: Fri, 02 Jun 2023 17:20:42 +0200 Message-Id: <20230329-kunit-devm-inconsistencies-test-v1-0-015b1574d673@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev>, David Gow <davidgow@google.com>, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard <maxime@cerno.tech> X-Mailer: b4 0.13-dev-02a79 X-Developer-Signature: v=1; a=openpgp-sha256; l=1520; i=mripard@kernel.org; h=from:subject:message-id; bh=JrdWhqdwYCo5+dxpyaTBpOM09b+3lqOKw8HosotnMs0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDClVHOdeLlF4eeoU99T1PBu/a+a6zLhmWfjOkqNW2zjkhVVv 98rzHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZhIiSXD/8grpcxXFgQ1Mi1/zT9XdP Mn4QvHJSIubRT7vOoj9yLLzgeMDBtv6m1TYXv2bTlT/ueKhqZZbS2Fh3j3GCxQsn/26aiXBwcA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767605731218307677?= X-GMAIL-MSGID: =?utf-8?q?1767605731218307677?= |
Series |
drivers: base: Add tests showing devm handling inconsistencies
|
|
Message
Maxime Ripard
June 2, 2023, 3:20 p.m. UTC
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@cerno.tech>
---
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,