Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7876601rwl; Thu, 23 Mar 2023 09:40:55 -0700 (PDT) X-Google-Smtp-Source: AKy350Y1HMykFAvwLjujbOeQI88+6+UN4dPvHDb+aaN9XEjmXCVppjhSG84686UP1EtygaIIA2z7 X-Received: by 2002:a17:902:ea0f:b0:1a2:7d:17ea with SMTP id s15-20020a170902ea0f00b001a2007d17eamr4775476plg.56.1679589655114; Thu, 23 Mar 2023 09:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679589655; cv=none; d=google.com; s=arc-20160816; b=0u4SYxyZ38/LjN/BFiJJnyCrNBDTs+XsOFxKkSRqdnhgqBMiBUicPRKzuYSZ3dVSd9 jxI0hOeNBW7f1W3q3wGDdGflxbsqaKQPBDHpmXdYS/qRwgVZBYdvbga+a9fIlQ4FopMY 23NsLlJSUbFdgWPR4vokufA28tdUAZyIm72vMiAuLiWuz+6YQIf+Tg41OeM6eoObmqTa Ac3VrWBYDWzkHYl0WGwAksFGJKVC/j9Y1dDW9ymWeb3bTLyMC7B+K+bRZuFyOVR4c5R5 hCX79x9lx7gWhvtkI+AIFSgnkiKe9vcxACNNnI/xKW5XyNNc9hUAj0fHiGtribMwB1gq f7ZA== 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:feedback-id :dkim-signature:dkim-signature; bh=E4if9a3f9X77bOqnOjkoI5r0nXevqMRV38iVxaTmEaw=; b=Jdqe/gA68GO6GZ21ehXp/cwOkcbFqaQI+p2oq8AGmndWe48DJs3DEBIoLdRH3dlGL3 hZ58G/1X/JzrOmExywjquEnSbBfv7nOHEzu925TvJyfmGryOtkO8eI39QvgmkId2hfN6 kvtvC8bj9XLoRFj0B5/dHc163NmGm0wXFRStS9PmXpMi0SHp+x2tAwGPC9M3EXRA8WAE NLnU5soGAlMngbSgT2G5CTGq9/89IwxNhQl61K7wfK7AFqLCnlZ7x+x3wIxAkadOcmRT 8lumNeVK6D9XUquvZe7B2LeBG42y1ZUGlLSrt8MxKFyCeEGeNoAauX+CQAi5WAlvGO+C 8KCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b="g6/3/dAP"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=f7pdvdHC; 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 jz3-20020a170903430300b0019f39d634basi18298842plb.262.2023.03.23.09.40.41; Thu, 23 Mar 2023 09:40:55 -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="g6/3/dAP"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=f7pdvdHC; 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 S232367AbjCWQjb (ORCPT + 99 others); Thu, 23 Mar 2023 12:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232369AbjCWQjL (ORCPT ); Thu, 23 Mar 2023 12:39:11 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3EF835EF8; Thu, 23 Mar 2023 09:37:23 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id EDCF75C00BA; Thu, 23 Mar 2023 12:36:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 23 Mar 2023 12:36:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1679589401; x=1679675801; bh=E4 if9a3f9X77bOqnOjkoI5r0nXevqMRV38iVxaTmEaw=; b=g6/3/dAPpfW7mZxRyV jPOpRzoyHXVPTKrALp/6Zwe9xO10hFRBcAvyZBM2dEjgYOK6hbiHF9bjSYJnWIT1 wylR3m+93h12OQAGpv5Lf9/gNEFez2Ptzd3HIC3pDoU1s8GC31LpE0CfmszvhIv0 3OklsofQDnBz3CGwMygcgs2lBOiGnJP1PJYGbkxemSIEP43Cx+YTeYD0rS3reD1k rWyJfDhqc3JllW5a4/Lpe16UFPI2P0qEWXgH/niYJG8NKDsm0FLs7nBSEM7OLiO7 UQ9BGLry/ceQugSHSnjRSQ7Zd/QFs6mso1RWbMSe06G4yAXWripOvAWfCPI1W0KW /1Ng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references: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=1679589401; x=1679675801; bh=E4if9a3f9X77b OqnOjkoI5r0nXevqMRV38iVxaTmEaw=; b=f7pdvdHCS5EL5R+baqKkwkuQa5f8G UOzxn6XsttwT0bX91cNI16WTUD787PcZ9N+MZW8lmNjSpExH/MG1c5aT0BfV8bFY 76kmdLfLewjpc8fBRmVWsCZKmpUXC7Oor0co5mTlQh8slQdyE3EaMQMlB9RYC0iC qoiCAa4PxGNmLjPFP7PqGarH+xJufg8s3kAg9DD4EzD4XxRaCSnz6J3iSH7iXp46 hPuSmcarS7w7EHjMzgMpdRlfGZ42A7IHEMcD91M9rHJJdmIZzvcNI/NdsLOIcCd7 gQ07OG+n6yDvxH8zhK1a5HAY9tFk22A21HB5YJFC4kPoPN+bFEuKAeU/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeggedgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpedtleekjeeiudefvdfhieffteelhfeivdeliefgieeugffhvdelieffjeei geetjeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggt hh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Mar 2023 12:36:41 -0400 (EDT) Date: Thu, 23 Mar 2023 17:36:39 +0100 From: Maxime Ripard To: Matti Vaittinen Cc: Greg Kroah-Hartman , Matti Vaittinen , "Rafael J. Wysocki" , Brendan Higgins , David Gow , Andy Shevchenko , Heikki Krogerus , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, Stephen Boyd , Jonathan Cameron , linux-iio@vger.kernel.org Subject: Re: [PATCH v5 1/8] drivers: kunit: Generic helpers for test device creation Message-ID: <20230323163639.xtwpid2uunwnzai4@houat> References: <25f9758f-0010-0181-742a-b18a344110cf@gmail.com> <20230323101216.w56kz3rudlj23vab@houat> <8a03a6fb-39b9-cd17-cc10-ece71111357d@gmail.com> <20230323122925.kqdnomr7i46qnyo4@houat> <590189b3-42d9-ab12-fccd-37338595cb6f@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="siftfz462ycziuwe" Content-Disposition: inline In-Reply-To: <590189b3-42d9-ab12-fccd-37338595cb6f@gmail.com> 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,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 --siftfz462ycziuwe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 23, 2023 at 03:02:03PM +0200, Matti Vaittinen wrote: > On 3/23/23 14:29, Maxime Ripard wrote: > > On Thu, Mar 23, 2023 at 02:16:52PM +0200, Matti Vaittinen wrote: > >=20 > > This is the description of what was happening: > > https://lore.kernel.org/dri-devel/20221117165311.vovrc7usy4efiytl@houat/ > > Thanks Maxime. Do I read this correcty. The devm_ unwinding not being done > when root_device_register() is used is not because root_device_unregister= () > would not trigger the unwinding - but rather because DRM code on top of t= his > device keeps the refcount increased? There's a difference of behaviour between a root_device and any device with a bus: the root_device will only release the devm resources when it's freed (in device_release), but a bus device will also do it in device_del (through bus_remove_device() -> device_release_driver() -> device_release_driver_internal() -> __device_release_driver() -> device_unbind_cleanup(), which are skipped (in multiple places) if there's no bus and no driver attached to the device). It does affect DRM, but I'm pretty sure it will affect any framework that deals with device hotplugging by deferring the framework structure until the last (userspace) user closes its file descriptor. So I'd assume that v4l2 and cec at least are also affected, and most likely others. > If this is the case, then it sounds like a DRM specific issue to me. I mean, I guess. One could also argue that it's because IIO doesn't properly deal with hotplugging. I'm not sure how that helps. Those are common helpers which should accommodate every framework, and your second patch breaks the kunit tests for DRM anyway. > Whether it is a feature or bug is beyond my knowledge. Still, I would > not say using the root_device_[un]register() in generic code is not > feasible - unless all other subsytems have similar refcount handling. >=20 > Sure thing using root_device_register() root_device_unregister() in DRM d= oes > not work as such. This, however, does not mean the generic kunit helpers > should use platform_devices to force unwinding? platform_devices were a quick way to get a device that would have a bus and a driver bound to fall into the right patch above. We probably shouldn't use platform_devices and a kunit_device sounds like the best idea, but the test linked in the original mail I pointed you to should work with whatever we come up with. It works with multiple (platform, PCI, USB, etc) buses, so the mock we create should behave like their real world equivalents. Maxime --siftfz462ycziuwe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZByAFwAKCRDj7w1vZxhR xZYoAQD0EfI8ZCSq1KpU73P+V49HUzeC9ingQ95MQn3oUWcu3wD9HQRLsSfxvM7A K3Xa8SyESe39WCse9VZjO2fd9YvqoQM= =9U43 -----END PGP SIGNATURE----- --siftfz462ycziuwe--