Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1340038imm; Wed, 1 Aug 2018 14:16:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIX3EUmbAYmjN/+ii9GFOyu+l7ADTRjWiqm1TML3p3VVpPyh9VTmh/rEhWoyZp/S33b4rx X-Received: by 2002:a62:5d55:: with SMTP id r82-v6mr32353pfb.150.1533158201779; Wed, 01 Aug 2018 14:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533158201; cv=none; d=google.com; s=arc-20160816; b=B/MeJhVsbsT/JFulDV2vU9BV1iVPjIGyEkNtNqGrKHxn7jcgWY21WGOioJ86mNlTeJ J7Tp9yr0Pv3IGkWv0KZqqicmfjRNz5Jtf+qModvUKIL4fB7/wLiutQx+DL4CU671qo6x agcSN9yrgdo6TcmZVzpV2h84d0ylbScpiCylJO7RvRHt6DHzO7QqJb08yKY2VvsPU5RI usnJlni1iWRXIXXvWkLTrhvKf62kgAs1NgTQCPy3wFUAdlHTJc7tq1yNnnEypIzYibnh LvP+aZSqEg3yb/Ke+ZskNIWGnvaGWliO+dVrlcki/ZZqlSYdz2CGJmfrEqhaUKZ7gqJg aXWg== 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=oEwvs7805iCIV/buKyyOp1Mqv0hAg+1HR9qZY+iVZ1FdkA14eUCkt1CNzl8IXSXQIn 3mHA3iPSe0s0Qn6GkevixdCYiHux6+WUCy+cYmxM6ag4u0sPMv4GeiUsMgVz11snwdK2 A0mwTr3tTxA9L7iW6F/NpzM3XV0HkKaL4WxnMHXe3IHjyNvUyE9fgSKywhq35XWrUzKm SSYfOr9Md1j9G7HlalfV3hTlrrjGzQF+bEoYggGy7WIh1LOmexlDCG5GY3UghdDKC1j3 AaD1gADJO3qz2VxE27yBvIU01iCmq/jgiDYWGIvlVtaNegYbFciZpFR7se6xEG3/aVCQ bCyw== 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 9-v6si3169pgm.659.2018.08.01.14.16.27; Wed, 01 Aug 2018 14:16:41 -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 S1732328AbeHAXDA (ORCPT + 99 others); Wed, 1 Aug 2018 19:03:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45370 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732118AbeHAXDA (ORCPT ); Wed, 1 Aug 2018 19:03:00 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4289C40201BC; Wed, 1 Aug 2018 21:15:18 +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 E61472026D68; Wed, 1 Aug 2018 21:15:17 +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 v4 5/8] drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Date: Wed, 1 Aug 2018 17:14:55 -0400 Message-Id: <20180801211459.7731-6-lyude@redhat.com> In-Reply-To: <20180801211459.7731-1-lyude@redhat.com> References: <20180801211459.7731-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 01 Aug 2018 21:15:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 01 Aug 2018 21:15:18 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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