Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3464585imm; Mon, 13 Aug 2018 12:09:05 -0700 (PDT) X-Google-Smtp-Source: AA+uWPywC0nztfltQBom5yQxMGJB1gq/vOH7VadEutmUnNrv3AXvCLoslLJo8Y4kEt51JczrNlEO X-Received: by 2002:a62:5a01:: with SMTP id o1-v6mr20459755pfb.0.1534187345334; Mon, 13 Aug 2018 12:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534187345; cv=none; d=google.com; s=arc-20160816; b=WymjyW4D/TK6j6QBFjkR6g3MhjsaY6NJMMCY9FDP7gAGkU198AKh44SQm3L5GG98Rz b/s/ZHTt+Xn4uDWm0xBJSzlbRlr6P5qRfTqjIM3T9IbFJMP1PUQ6bN4vIuYmEVMoCjeS HF9JbXUbfRCzfzJA2m0884YmKivza/pk7dNxVPYmEb6H3g7zly1nTTQP1eJmeGIFiXxz HdGgjOPuQGXDUEPdk9xp6704Z5Vr+PEJ9P/Ysv1Rt6Ssjm76X/CElYedxuv+uTqTuN4w 5HcUeP5U3E3pNY0YbqL5hce7oqLM8GNGLixmZMcO6xi4Bmb3vsXrsoNFsnYJS4g08oMh vC9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Gw57oFML7fyodmjvYrK2p5hGUjwXMglNFccdd4mGJRk=; b=vNYRksIe/VUgsFPR6zoFka+cAxhxDeXAwnuh3JJSvms6jjpjJtY81jox7Tmf/zAqYO jdDqwCCvSc2fNeBEyfu+nJ+kD4BbJ32y1EOBwm3qItUxSvSVOhm7t9QjcvMBLA70LSqQ 5ArCjGwB/lUnVm4gADTHUHVXZC9uAu6jQ10pq9qtoLZJxaj1OkR+4/DIgAP1lb6jOUgf c//+boW8Rgp/BDyHOHu3xeLBuNm9YyDLFZweCPtYtIWUhtzsEcMHRUBVKwtWODzmRYCi A/lURYWIfuK4WnlzwLLRHwoaxsYlIEO9GJ0sCapCdf2fhawCyOXYxJBEnPVPCzY82ZPn M8UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a72-v6si19597720pge.497.2018.08.13.12.08.50; Mon, 13 Aug 2018 12:09:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730979AbeHMVur (ORCPT + 99 others); Mon, 13 Aug 2018 17:50:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49858 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730352AbeHMVur (ORCPT ); Mon, 13 Aug 2018 17:50:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2232818A6A9; Mon, 13 Aug 2018 19:07:16 +0000 (UTC) Received: from malachite.bss.redhat.com (dhcp-10-20-1-11.bss.redhat.com [10.20.1.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E32810073B7; Mon, 13 Aug 2018 19:07:16 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Cc: stable@vger.kernel.org, Lukas Wunner , Karol Herbst , Ben Skeggs , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 4/5] drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Date: Mon, 13 Aug 2018 15:07:02 -0400 Message-Id: <20180813190706.24172-5-lyude@redhat.com> In-Reply-To: <20180813190706.24172-1-lyude@redhat.com> References: <20180813190706.24172-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 13 Aug 2018 19:07:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 13 Aug 2018 19:07:16 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lyude@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's true we can't resume the device from poll workers in nouveau_connector_detect(). We can however, prevent the autosuspend timer from elapsing immediately if it hasn't already without risking any sort of deadlock with the runtime suspend/resume operations. So do that instead of entirely avoiding grabbing a power reference. Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Cc: Lukas Wunner Cc: Karol Herbst --- drivers/gpu/drm/nouveau/nouveau_connector.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 2a45b4c2ceb0..010d6db14cba 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -572,12 +572,16 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) nv_connector->edid = NULL; } - /* Outputs are only polled while runtime active, so acquiring a - * runtime PM ref here is unnecessary (and would deadlock upon - * runtime suspend because it waits for polling to finish). + /* Outputs are only polled while runtime active, so resuming the + * device here is unnecessary (and would deadlock upon runtime suspend + * because it waits for polling to finish). We do however, want to + * prevent the autosuspend timer from elapsing during this operation + * if possible. */ - if (!drm_kms_helper_is_poll_worker()) { - ret = pm_runtime_get_sync(connector->dev->dev); + if (drm_kms_helper_is_poll_worker()) { + pm_runtime_get_noresume(dev->dev); + } else { + ret = pm_runtime_get_sync(dev->dev); if (ret < 0 && ret != -EACCES) return conn_status; } @@ -655,10 +659,8 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) out: - if (!drm_kms_helper_is_poll_worker()) { - pm_runtime_mark_last_busy(connector->dev->dev); - pm_runtime_put_autosuspend(connector->dev->dev); - } + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); return conn_status; } -- 2.17.1