Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp570500rwb; Mon, 26 Sep 2022 03:03:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5h/nVi2CcrHhTRbeqMJGxQaj2h0Cvi0WbR4g6cHaso+Oe7CxDwZP5P+cx6tyl1nA8vHqid X-Received: by 2002:a17:902:d512:b0:178:6946:a2aa with SMTP id b18-20020a170902d51200b001786946a2aamr21547940plg.116.1664186611889; Mon, 26 Sep 2022 03:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664186611; cv=none; d=google.com; s=arc-20160816; b=Xlb+jO4kMikmpANVr2FwvV3Tk7D3ICoUpKL+gbXPMfk1ZI5debLLX5ZE/uRR67M6ox 2ZZ8TvFmN34dj4iO449RZ5nXBqmUfEPEi8O7SC8lC478G154sFQfaY5nAC5jY5hn5E+3 pP/8EdKS9bTWZcgRE+iXXJYF2k2fZnr4X+hAAMcO4DKTYbSak2uq83NHs9XYoqNr2DBU 0HBbQj1+Yk3n2yxwEPU2GIlfhdnR4VKCLCSnR/IBSCqCaJ7HWhtmLelTXrzZ0UD5uqxJ XUfCF6ksw7J1jPnir/15EgRPxbw0Pvkb0Eg740PAYNtsZtT0iglG/vMQXChvMoxuvYYV HoOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rhaVxqhRFD4ReD1YmvEfA36I59kgV9ycJURpgQIgPAY=; b=ci2ZwXiK3GZSetoaEalJ3mZwAazA+H38I6dEGldvxFvPQfU0+f7w1IA+4+eOlWUHed mM7ePWvPdbzUOgwPMwddlrgpGi2hBfnaDTeP013qF3aOaWjCCmbIxyMqZY/ke7IstcMv BSiEvJo6ros444n1JZ8F9NX5DQx2TRKzkK+RUX6F1rovk+8jx48uiofcaHRY4MFi6Iqq 6kylyxDZhMtHiN1xu4Qvw8ER9e9HyGpsL8ePuW6Ofl7FmARYfF2ujCvOjiFGMuaQZYPt f+VCU16TF3gSs4KJohTQWUqquJsAkPwGJejb2K77lDGzCa3P41mlvU3dKsLsPtyFThcn aLRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O0TGduRG; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l22-20020a056a0016d600b00536c198ca83si19973987pfc.15.2022.09.26.03.03.20; Mon, 26 Sep 2022 03:03: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=@linaro.org header.s=google header.b=O0TGduRG; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233851AbiIZJtK (ORCPT + 99 others); Mon, 26 Sep 2022 05:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233645AbiIZJs0 (ORCPT ); Mon, 26 Sep 2022 05:48:26 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60FBE23142 for ; Mon, 26 Sep 2022 02:48:21 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id t14so9299183wrx.8 for ; Mon, 26 Sep 2022 02:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=rhaVxqhRFD4ReD1YmvEfA36I59kgV9ycJURpgQIgPAY=; b=O0TGduRGFfxCPs1TNKBUjv2K0TRM3DSlGM8hGNEn2FmYLBYNJjuttfVFcSFBjmuxk4 WDFfaWg9OIrIvgA+2Ck+eOg6SPcFURWT2Lev/2Bdr04NH0V7VsIQPW7IM3L+9/mlcUxo 0npnBC7t9nP049u8cNYgRTEOkm/BZ2KXMTizB/vqAzwwbniRxnGmzOtLD2OmbIE5CDkJ bsDrHghNyiZ/NtxVazztuz03LTIP20/Epo79GFR2XSkjJ+AEUUKmQFCb9ndAcZ0+vg51 DoeqtFuetskqORqVry16CF7xCqKcBP4GidFrt4dMgV5m8xOFQKOChoX/TMVtQgynNExZ 1U8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=rhaVxqhRFD4ReD1YmvEfA36I59kgV9ycJURpgQIgPAY=; b=HY1zWdI9eN1JiSrISknUomSKEAhJZcBAxCvhMya6uVDmyqC0vHJupu6S8V9PH8nvox rCqGk8AWD/QENxLdU1nIxtIps76gr1VrqIkLYHzmw/Cfm+BuENsQTTFwOjsPsTZ34dZo 8h4Nk3oyJBghblToO+DDt1E3KO1KQYMM6YU/7BER6IC+P7Z2kCRpneKsXhwDXRbkjtXo LwbhM1WuTUMgbvSStkO18/A9zHkjYtUkcnTEvcw3VQ2A82c3dgPVblyPYI2MATgFNLx8 3BUFDFpxA31GuKpf0nQDxK63CqGUWQ0dK8zDcG5XtMoafwAEy418aK1ULwHoxVFKG0TL w80g== X-Gm-Message-State: ACrzQf3lnA8UzNoTT5b5FU8NYnQdkhbzIrCWPYi56GcAA5ZSOYJ/qg8B s7AFBEdcCTytjPAlys4PXn/D4ruF8fMV4PbsLQ9NKyUBMRE= X-Received: by 2002:a5d:6c6f:0:b0:22a:7778:6ea2 with SMTP id r15-20020a5d6c6f000000b0022a77786ea2mr13171324wrz.15.1664185699688; Mon, 26 Sep 2022 02:48:19 -0700 (PDT) MIME-Version: 1.0 References: <20220923124904.1373936-1-victor.liu@nxp.com> <75366bfac9fcd4f8c35309193705f0277a164ae4.camel@nxp.com> In-Reply-To: <75366bfac9fcd4f8c35309193705f0277a164ae4.camel@nxp.com> From: Ulf Hansson Date: Mon, 26 Sep 2022 11:47:42 +0200 Message-ID: Subject: Re: [PATCH v2] PM: runtime: Return properly from rpm_resume() if dev->power.needs_force_resume flag is set To: Liu Ying Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-imx@nxp.com, "Rafael J . Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Fri, 23 Sept 2022 at 17:23, Liu Ying wrote: > > On Fri, 2022-09-23 at 15:48 +0200, Ulf Hansson wrote: > > On Fri, 23 Sept 2022 at 14:47, Liu Ying wrote: > > > > > > After a device transitions to sleep state through it's system > > > suspend > > > callback pm_runtime_force_suspend(), the device's driver may still > > > try > > > to do runtime PM for the device(runtime suspend first and then > > > runtime > > > resume) although runtime PM is disabled by that callback. The > > > runtime > > > PM operations would not touch the device effectively and the device > > > is > > > assumed to be resumed through it's system resume callback > > > pm_runtime_force_resume(). > > > > This sounds like a fragile use case to me. In principle you want to > > allow the device to be runtime resumed/suspended, after the device > > has > > already been put into a low power state through the regular system > > suspend callback. Normally it seems better to prevent this from > > happening, completely. > > Not sure if we really may prevent this from happening completely. > > > > > That said, in this case, I wonder if a better option would be to > > point > > ->suspend_late() to pm_runtime_force_suspend() and ->resume_early() > > to > > pm_runtime_force_resume(), rather than using the regular > > ->suspend|resume() callbacks. This should avoid the problem, I think, > > no? > > I thought about this and it actually works for my particular > panel-simple case. What worries me is that the device(DRM device in my > case) which triggers the runtime PM operations may also use > ->suspend_late/resume_early() callbacks for whatever reasons, hence no > fixed order to suspend/resume the two devices(like panel device and DRM > device). > > Also, not sure if there is any sequence issue by using the > ->suspend_late/resume_early() callbacks in the panel-simple driver, > since it's written for quite a few display panels which may work with > various DRM devices - don't want to break any of them. What you are describing here, is the classical problem we have with suspend/resume ordering of devices. There are in principle two ways to solve this. 1. If it makes sense, the devices might be assigned as parent/child. 2. If it's more a consumer/supplier thing, we can add a device-link between them. In this way, the PM core can guarantee that the order becomes correct. Kind regards Uffe