Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9922817rwr; Fri, 12 May 2023 00:53:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VyyN9m1sgPbZefGmjmmDsIYuiViTvji3QRHu/3AstQx6RJuIQ1GJVmc5f1BQxcsIjXS7W X-Received: by 2002:a05:6a21:7899:b0:101:2dde:37b7 with SMTP id bf25-20020a056a21789900b001012dde37b7mr17950826pzc.11.1683878011452; Fri, 12 May 2023 00:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683878011; cv=none; d=google.com; s=arc-20160816; b=iczaizfyIUjX97NDCCPPBnR6g8PTkvLF8wnqhTPZ6JPnZV1fycDGBhEqaiS9r+qXK3 p/nKaY02WeEsLTfd7LTkgU8AjItogMIsTf1nJGvvLfgTG/sT+19Eka3eHhKEmScGK0NX Jh6F8EWRF9JLEpObS9KSEWHxbqWOH9bc0wDF23BesylYg2eLEgi3hAMojq9fjITyTSVN bR9EyrwmXLLH0jYRG60iuGXub0gB66R/Ig4h9oUmTp0t1fKlo7780HDpRVsSet15JGWO X391uHrzRPU3nP5VkC5dJ5iplq9C3IWdMtfP/mwuoJdGzZ4ry4NHYp4rJev3xsahwVLt /6sA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WdnEXbYz58x2xMBowFOyLjvL2xX6+9urxJfCO3mgjpY=; b=aCGbojMnIuNjT/tHFw2yUARJa9szaRXjkcAzMjKkGlXzhITIWYxZAPFBEA4DCTSR0M ere/hr5cJOOgbwaq2bzjcM3xarOeShZmD1uiGUTXnoBb28xjTwLXCLBjKHQ++euvtQH8 vZA4O0P1IaVAGA4dNL5LTX9dGHOEeY+AUL/9soZ+xKhz+Iu8eJqYsaygR11DKyad+hX8 JFxMtd8dW5wSvcETEkzUrkF/eu7vL6bXZ/M2YhgQ9qSQte7XO7uAeyPG4ta76W9UahJT 37XJ1jqYnTTskEm6w7O4dWIjoh8pBNapqHNjZ1/KUThMLduu+O5pd+x9TW0urqFmy+fo KfMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HzYhSjT1; 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 h15-20020a63384f000000b00513237d939esi5477369pgn.563.2023.05.12.00.53.19; Fri, 12 May 2023 00:53:31 -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=HzYhSjT1; 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 S240044AbjELHjh (ORCPT + 99 others); Fri, 12 May 2023 03:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239949AbjELHjg (ORCPT ); Fri, 12 May 2023 03:39:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 903F9171C for ; Fri, 12 May 2023 00:39:35 -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 29C7865371 for ; Fri, 12 May 2023 07:39:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ADB6C433D2; Fri, 12 May 2023 07:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683877174; bh=nDtcWk3EKB1qZfgTY/ci16KXsxriXqq2B/zKkywLwC8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HzYhSjT12xFXX0ZJWzzVMKclifXdMN/xfE/4IlklqIO7cfs7Q/YhWmJXvaDL/a2dR 41dDbnyhP47+wrr8Zc8QNQNjaH/14vu5Poidd8UbeWAuBFbVw/9+gI5VzVZj/6QJMk aBUITvWsExO+VsfaaSw0nVF3O7b2SI0ESj4CScoOLKTbHN2Odjgk7RQWR82kIq2jv0 3NnLZaCbnHkeuvdYm+VBqAqI8SCvMoHSOrWwQOFWAj0Sh0JRa0A7/rCdReWLhI4K/K ZLeC5lYPZ+ODUfc6UpL3UzEeOyXNWl+DJ2kjyPCVIAGUxviHwsIfRGWA6Oi2wDVogL lt3orx6d6kfsw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pxNNh-0002Qs-IR; Fri, 12 May 2023 09:40:02 +0200 Date: Fri, 12 May 2023 09:40:01 +0200 From: Johan Hovold To: "Rafael J. Wysocki" Cc: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , 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: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.1 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 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 On Thu, May 11, 2023 at 04:44:25PM +0200, Rafael J. Wysocki wrote: > On Thu, May 11, 2023 at 1:48 PM Johan Hovold wrote: > > 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. > > I missed that, sorry. > > > There's is really no good reason to even try to change as this is in no > > way a fast path. > > Still, I think that while the "put" part needs to be done before > device_remove(), the actual state change can be carried out later. > > So something like > > pm_runtime_put_noidle(dev); > > device_remove(dev); > > pm_runtime_suspend(dev); > > would generally work, wouldn't it? No, as drivers typically disable runtime pm in their remove callbacks, that pm_runtime_suspend() would amount to a no-op (and calling the driver pm ops post unbind and the driver having freed its data would not work either). Johan