Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8695135rwr; Thu, 11 May 2023 05:10:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5leBbduMeruELQ8zRqBaorwB5/7FbQ086FkP2raCE+AioT0VmJ31yDIkMQJlQ6/5a7JsJk X-Received: by 2002:a05:6a20:12cb:b0:104:1ab7:8242 with SMTP id v11-20020a056a2012cb00b001041ab78242mr800643pzg.43.1683807029033; Thu, 11 May 2023 05:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683807029; cv=none; d=google.com; s=arc-20160816; b=t03iPSI72EmPPmZ+Qn5hrM1NnQf9CJjeQFtSdikBULH1JOe71pc+Q0+QvFe4D4UzEz fWwp6fkTaY1O46fZWxKZm/wd3hM9UpWRuDonzYg+zX98A8lMFDjAHYpYnMQ57HSU10fC iScSm3e4YgUFh1KMNOmFhT4Anl8kTYYeVubHU3JsqG/zmHy1UMZBSfk997yYFfQdCsVo iKgT8ZFlVzDxhQKA4H+YauzOOXwm8wpevtDqF/j3mSJqHSHq4zhCGcggz7iZfxyRdDuL A6Lu3sL7Vrws7cm3LtM9cr/MaFlnZgVSQ7Hc5rA89JbM9ORA4e3U/AvTCY3oYoWGpg5U OExw== 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=KSZVHmGjCQPHFXDSajcfyeTbIidWLtBvySKaQ92AWos=; b=m3Rgohh2ZOFC/aOkwcEotFt6RYk2UbmhDkOQVuGrc8ysFXd8RuNEgOEFTtx/JmnBDf qBCgYq0ho/y6o3lnhzlxVAxyk/p0IXo7nYe/frJ9XluEIlCYM7h9N8pPZPn1qSUQyzKc gVJeRjoXex4ytdBQ5VT862FrYdOesZsok6PwG0Fq2HQJKGpXHRhi7vv7Ijvpp9GLUZZh 30Q5vsPmbSvB2fQZ82Z0bPXkcNKdWynv5wqdkUw8jyBTCyOh+yyW5gZKzYPSAMHhUBnE zZpGecYDpo0NcOTK1nCQFxxmebnac2IYEXWhtpNkS+5byjV3sWDWFgh9KbeYkYUedsY5 KRQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iIXskn8/"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a63af55000000b005285958c85bsi1821256pgo.807.2023.05.11.05.10.11; Thu, 11 May 2023 05:10:29 -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="iIXskn8/"; 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 S237598AbjEKLsE (ORCPT + 99 others); Thu, 11 May 2023 07:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237195AbjEKLsC (ORCPT ); Thu, 11 May 2023 07:48:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24CDE2D77 for ; Thu, 11 May 2023 04:48:01 -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 AF13E64BF3 for ; Thu, 11 May 2023 11:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE80C433EF; Thu, 11 May 2023 11:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683805680; bh=ywt+0Zr1X76Z2OEmm1AvLswJH2dZ2KmiLgCy1lCgePo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iIXskn8/TVzBMWdCoSD64b53K22Md5kU5vHlzOtuVUv+HKZy70Qxlpd2DtwUe4qC9 7wmIgDnFLBwI+veBCJMD1jL3HFoe5fUbhewr+sRzfG+kOZpunn2/0R7Fwb16tPbtE+ CUG5b83w6S4ZJmAMgeTg4+Zo8fgmq0i0m3NTmUwoqQ1euv9/yhB0emk7kZw4GSpvlR q0xXocrDTjP3989z9Lzdnq7HGxKeglApM+CVbYjZA43hgSNa+0DS0lAood/dDSX4AH hFxRyWX1/SwX/K96+Vw58nmC1ruqAFVcYD8X1hHUSfBcF2E2oI3UrFvKmIuFGWNlzr +OHeNmxiOjvTw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1px4mX-0001KH-Dv; Thu, 11 May 2023 13:48:25 +0200 Date: Thu, 11 May 2023 13:48:25 +0200 From: Johan Hovold To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: "Rafael J. Wysocki" , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH] driver core: Call pm_runtime_put_sync() only after device_remove() Message-ID: References: <20230511073428.10264-1-u.kleine-koenig@pengutronix.de> <20230511103923.hvibdyo5ges4bab2@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YjvbUq+RuprNibir" Content-Disposition: inline In-Reply-To: <20230511103923.hvibdyo5ges4bab2@pengutronix.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --YjvbUq+RuprNibir Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 11, 2023 at 12:39:23PM +0200, Uwe Kleine-K=C3=B6nig wrote: > On Thu, May 11, 2023 at 12:18:09PM +0200, Rafael J. Wysocki wrote: > > On Thu, May 11, 2023 at 9:34=E2=80=AFAM Uwe Kleine-K=C3=B6nig > > wrote: > > > > > > Many drivers that use runtime PM call pm_runtime_get_sync() or one of > > > its variants in their remove callback. So calling pm_runtime_put_sync= () > > > directly before calling the remove callback results (under some > > > conditions) in the driver's suspend routine being called just to resu= me > > > it again afterwards. > > > > > > So delay the pm_runtime_put_sync() call until after device_remove(). > > > > > > Confirmed on a stm32mp157a that doing > > > > > > echo 4400e000.can > /sys/bus/platform/drivers/m_can_platform/= unbind > > > > > > (starting with a runtime-pm suspended 4400e000.can) results in one ca= ll > > > less of m_can_runtime_resume() and m_can_runtime_suspend() each after > > > this change was applied. > > > > > > Signed-off-by: Uwe Kleine-K=C3=B6nig > >=20 > > I'm not against this change, although I kind of expect it to trigger > > some fallout that will need to be addressed. So caveat emtor. > >=20 > > Anyway > >=20 > > Reviewed-by: Rafael J. Wysocki >=20 > Thanks for your review tag. I wondered if there will be some fallout, > and don't know what to expect yet. Sounds like getting it into next soon > is a good idea?! No, this seems like very bad idea and even violates the documentation which clearly states that the usage counter is balanced before calling remove() so that drivers can use pm_runtime_suspend() to put devices into suspended state. There's is really no good reason to even try to change as this is in no way a fast path. NAK. Johan --YjvbUq+RuprNibir Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQHbPq+cpGvN/peuzMLxc3C7H1lCAUCZFzWBQAKCRALxc3C7H1l CEmdAP48YvGUiT2voAzj2gqP4ohmaHTEH7q7zfd6Qe6cRNqedQD8DCJURAE0CXXO Z/Kg3dnErUpngBFKmBFtaZScllflIwM= =+8jj -----END PGP SIGNATURE----- --YjvbUq+RuprNibir--