Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1304370iof; Tue, 7 Jun 2022 02:57:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZ17an0MO2/fwAnSjWkce3ser7Y/bqzCdMiO7vdD1cK6GIckMIKgzvnDk0iY7bVICfDtcD X-Received: by 2002:a17:907:94c8:b0:711:d864:fd84 with SMTP id dn8-20020a17090794c800b00711d864fd84mr6173938ejc.18.1654595827621; Tue, 07 Jun 2022 02:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654595827; cv=none; d=google.com; s=arc-20160816; b=KYVtnNd2jujqCOpJOjl2dJrqjXKePszbV6Sxg1qRpiRQwfEpwvF6x+b/WtiGdZzoaa JDz0U8gyprht49PkzBP3wSxKKB74GEdys5xTwLRRCSbyx3c3gehUgRQ4vcAsE0lioIdB Q4D+oeVtPIbfgzyv4FS7g2R30MUsr2fRsa8qPWeOdjjtnzGMsjmozGmGCmfpMuGmd/wv IPleRkuJLV2/xhKxXKgNvfeBG9ApIC+egUPCvoziB2V0oU0aSAJmL+wnA9fqmh29d7dK XaOpLTznAUef/yYqOzA+c7lWZRDOrW0Z78OAO4V7C4Ub46KQSGAGLS8xvSahwnYUAwp3 /U7g== 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=9PcUJMsE22PYq+FyjhmAfpnSlrIsq/ysnRAwNN0aJxE=; b=Z3080RoZAndQwurdtLnNrJR7I4Y5z3SKD3XG39XkrZl03Y7tYt++rcOXIYAXl9L23Z bNoDnBJmq/01/wWmXCKdIR4vj9+K2li77WK6rPXKtYVsEjn9b+QeIDW4Q+Lvr6zShLOT DgIwaQcveDzxKcSXH+spu0v3QZZxBR5k7LWhYZyrwMM7BT6Yb0fZGIlbg+Hkuh1ypaLf ooUy0QzpgTzPP+myDwR0orWf7AnFHJSRaVHZ3uuRnfO9WHFrubGqpKsN+GUZKFrg4KDT IM1P+HwrhgsQtO6gdPYONIT1VAZELBJYDL/VfnsGccHf2sO+3mZduba6OTjJlS8V48F8 hzCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cFIig+iu; 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 ne28-20020a1709077b9c00b006e89cb29660si14900366ejc.994.2022.06.07.02.56.40; Tue, 07 Jun 2022 02:57:07 -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=cFIig+iu; 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 S231322AbiFFVUR (ORCPT + 99 others); Mon, 6 Jun 2022 17:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231721AbiFFVUI (ORCPT ); Mon, 6 Jun 2022 17:20:08 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC5962215 for ; Mon, 6 Jun 2022 14:20:07 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-f2cd424b9cso20724855fac.7 for ; Mon, 06 Jun 2022 14:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9PcUJMsE22PYq+FyjhmAfpnSlrIsq/ysnRAwNN0aJxE=; b=cFIig+iuLezd7UpzZyzFTJMfFClnhdvrZy+bypNFh4PXyrr1gsDRcuefxKgXq3e9NJ 0b8HdCqqgAKQkawwFKrCrUAiqW4yi+IDGbAohG78cei+TRymvdabboTzOHh7iLDXgTmV W/fLZr0IYhAeYFX7hXPHRcOSNl/liIEM9qIo4qh6EUG5hwmVFExNfUcuyj4rXw44wYpy maSuNlyvsiQM0CDlWDq0Bi9K0QrfOj1zkoJPjcZQ+TSKvR14s0rF/v56ZQz9emef+nyk hGNtRCWsPK4X4XmZxxdM49nzhLKYuDFuQ6+E+a/amc9fW9jlTls7M6x0bE3q6RN3QqD7 cesw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9PcUJMsE22PYq+FyjhmAfpnSlrIsq/ysnRAwNN0aJxE=; b=XYZwGRTg81+cYxXtN/w8veNWPJ/d0VUOuttga+BfHPY4lyyKlFhkA/nGe9Ds1q+rXN KSwuy/Ww/Ak7MQfJKNQjp6ClhEtAGnVDsr0CsUnejdZwCZQlrSSazM7BhqEi8nnnwpTt 4HAWKlXZpJ58LSE/UjprcxGYhz0yHZSmA8loPaV6AKut9TG7GfAMfxRqAXyw3723wmDM vjBY2su17/j+tNzXJwIO2C9JaU6gtkUveSokg4MugVQqND7D1DclGuGQLIV4HdFLRYts BsdOOmdW0uLbj4gdQ8dklu4AzF2O/gXtnpuSAtZhdNGFijwdn00OMUMPTGtd2N2AI5rZ 3HgQ== X-Gm-Message-State: AOAM530VP9OSzxwC5LLzXeKFAVde9X8BGJJtIjTHkQWV5vdaNX2cAKmF ddqLzNE5mOfdPMNUWXLvTfXKNnTiemWE8w== X-Received: by 2002:a05:6870:7099:b0:f1:b164:59ee with SMTP id v25-20020a056870709900b000f1b16459eemr14842915oae.21.1654550406920; Mon, 06 Jun 2022 14:20:06 -0700 (PDT) Received: from ripper (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id bc32-20020a05682016a000b0035eb4e5a6dasm8361956oob.48.2022.06.06.14.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 14:20:06 -0700 (PDT) Date: Mon, 6 Jun 2022 14:22:31 -0700 From: Bjorn Andersson To: Maximilian Luz Cc: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/msm: Fix double pm_runtime_disable() call Message-ID: References: <20220606211305.189585-1-luzmaximilian@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220606211305.189585-1-luzmaximilian@gmail.com> 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,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 Mon 06 Jun 14:13 PDT 2022, Maximilian Luz wrote: > Following commit 17e822f7591f ("drm/msm: fix unbalanced > pm_runtime_enable in adreno_gpu_{init, cleanup}"), any call to > adreno_unbind() will disable runtime PM twice, as indicated by the call > trees below: > > adreno_unbind() > -> pm_runtime_force_suspend() > -> pm_runtime_disable() > > adreno_unbind() > -> gpu->funcs->destroy() [= aNxx_destroy()] > -> adreno_gpu_cleanup() > -> pm_runtime_disable() > > Note that pm_runtime_force_suspend() is called right before > gpu->funcs->destroy() and both functions are called unconditionally. > > With recent addition of the eDP AUX bus code, this problem manifests > itself when the eDP panel cannot be found yet and probing is deferred. > On the first probe attempt, we disable runtime PM twice as described > above. This then causes any later probe attempt to fail with > > [drm:adreno_load_gpu [msm]] *ERROR* Couldn't power up the GPU: -13 > > preventing the driver from loading. > > As there seem to be scenarios where the aNxx_destroy() functions are not > called from adreno_unbind(), simply removing pm_runtime_disable() from > inside adreno_unbind() does not seem to be the proper fix. This is what > commit 17e822f7591f ("drm/msm: fix unbalanced pm_runtime_enable in > adreno_gpu_{init, cleanup}") intended to fix. Therefore, instead check > whether runtime PM is still enabled, and only disable it in that case. > > Fixes: 17e822f7591f ("drm/msm: fix unbalanced pm_runtime_enable in adreno_gpu_{init, cleanup}") Tested-by: Bjorn Andersson > Signed-off-by: Maximilian Luz > --- > drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c > index 4e665c806a14..f944b69e2a25 100644 > --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c > +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c > @@ -1057,7 +1057,8 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu) > for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++) > release_firmware(adreno_gpu->fw[i]); > > - pm_runtime_disable(&priv->gpu_pdev->dev); > + if (pm_runtime_enabled(&priv->gpu_pdev->dev)) > + pm_runtime_disable(&priv->gpu_pdev->dev); > > msm_gpu_cleanup(&adreno_gpu->base); > } > -- > 2.36.1 >