Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1777033imm; Thu, 27 Sep 2018 02:17:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV63RQR0yQu26sQybrsHdihgcNaGgNvQYQbMiki3E6Z4qCcy+zpeoxlD80P/06LQYZiTwNaDf X-Received: by 2002:a63:d256:: with SMTP id t22-v6mr9063536pgi.335.1538039835409; Thu, 27 Sep 2018 02:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039835; cv=none; d=google.com; s=arc-20160816; b=OsrWSGCmREjO9bUbBG0A/HZ/V4p3ULfjlX6a/eRySrG1wot0MxaMO40FtA5T9Tts5F 9KgiW2z/lHq73PQz8UYulYqyf0WNG9x4XB4LAb1n8MRdgw2RB/7VaAGCAe3hFDlnUuf1 R3lYii1RVxvCl0IhrEGAdCu6t9/Dl6k/sArZsKUJu4nLBcUEzUmNe0mejj8mJed2exhW 9mBn7rNOKJ7zM+aU+6acO5bWWJ/7ooFu0XHkBv3cKoztzDRd4uZSf+Xtc/hgoXR9ATU3 vgEFyBNi+mkCA4LdZ5MtSqtKWubu78b/o5Sq28DFcyneMsqID51dBIlenBT4rlomK+cR kbOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=6yzoxhs0KwK3OnoS/MyR3QO/Ck5hH5GG8ml1tVAO/+0=; b=cYSMRCyiOR1dnk1SX+jj+QC19fca5hTNzZoyAwOs7lh66pgBc6wHRWoiw8razsfhZp dIeNr+GLJbKyJSd7pnl+ZlH8Y9G3fCtDjGdq5oZmvKpYfwh7t0r7jDJFEmkLXVYEJTaa q8h6L2GMkP9UC2GmdT2qk1i5QvzMRTbLZphzfzNYTZwZii955oJvF77SDJqmKYygmAki vf5UIv6bxTjDyY1TW/gjyvfrKrRt0aF58yQnmIWExqLfm9A3ClEqvB73TBQu+9SvYiLC oF2FwTvFuUFijBzwd3VCeK2wt0rWSWZaS2Ss0RYNV7JwPAaFBip8EEvf+0zVfK3hyfqr DnQw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7-v6si1486421pll.162.2018.09.27.02.17.00; Thu, 27 Sep 2018 02:17:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728770AbeI0PdZ (ORCPT + 99 others); Thu, 27 Sep 2018 11:33:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55792 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728353AbeI0PdZ (ORCPT ); Thu, 27 Sep 2018 11:33:25 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0E6281117; Thu, 27 Sep 2018 09:16:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Karol Herbst , Daniel Vetter , Lukas Wunner , Ben Skeggs Subject: [PATCH 4.18 69/88] drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Date: Thu, 27 Sep 2018 11:03:50 +0200 Message-Id: <20180927090309.094671495@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lyude Paul commit 6833fb1ec120bf078e1a527c573a09d4de286224 upstream. 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 Reviewed-by: Karol Herbst Acked-by: Daniel Vetter Cc: stable@vger.kernel.org Cc: Lukas Wunner Signed-off-by: Ben Skeggs Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_connector.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -570,12 +570,16 @@ nouveau_connector_detect(struct drm_conn 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; } @@ -653,10 +657,8 @@ detect_analog: 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; }