Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3465253imm; Mon, 13 Aug 2018 12:09:45 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy0BU354VET8YAy5+Q9IsEluWM1YaW9xHKdkQf1O7nsn4wRrJiIG35crPHSLX48RCI44zoi X-Received: by 2002:a17:902:7896:: with SMTP id q22-v6mr17722782pll.47.1534187385282; Mon, 13 Aug 2018 12:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534187385; cv=none; d=google.com; s=arc-20160816; b=mFbgSaMKiHSiQrM5Lt+yOQtFBoffktmCLwNage2TnhVWSZrvmu1Nb8Y7wdmXogCbaW 0R6CeXpVFKRiRz1LQawV8TiWLIWIPuMc4dXqiFj4wHaBr3OQ2/PbR/w6apLQ5W5NufIu E/z3RlI9AnJDNFKN8wK5W3mYQ+Wonr+IAnTkhRpTVjw9zxjOYwkBXC/duFGbw84FGZNS 72+gmCe+y6s+b2cqUd/ebiiZsB9oYD9dU3hBptCAsopYfp84J9p+9+7oIhYx/T0JJOdM YfNuZJ5Ug5Vt6iC4bJ51Ph0rWteT0RPOT2WktpU5V/SrXesiXVl3f/eS83bmukhTWfAw /7rA== 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=e5mrV1kT4vIwpFDzQ9nPV9vC5PiRXiF0FlNs7yPUsOs=; b=ccd+3QfEHmB74GkVEBEje6ibuFXBz8F+AvPqS/j+VsPJ4gLkR7zIOAD6GzIWe3nlST 2Sbeu+EOB9ZndgKX2Fec7B/MVCVErWGOxzwO6mS79MfEedVXOaAI5uPxW2fFLj2q+Px8 g5nPcr8kZFR8eDBh+vLwrFCBW7k7Lw8Rb9mDdYVOcpSw8WpypuwqLjhDjQqk9PeYWlRo UCUPy0m+Ix50uunMwLK6IYW4oHmizXcPevVGES/MZrnhBiG6fuT05/YL4n4a1JfchClf HWH0ysOwxou7kozzlvimmomDquPZoYlHC7BLf6D0Nrs7dAlwvtPwMASoYu5NRVPl8fOj reZg== 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 d1-v6si19069668pfk.166.2018.08.13.12.09.30; Mon, 13 Aug 2018 12:09:45 -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 S1730883AbeHMVup (ORCPT + 99 others); Mon, 13 Aug 2018 17:50:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34248 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730362AbeHMVuo (ORCPT ); Mon, 13 Aug 2018 17:50:44 -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 618A487A79; Mon, 13 Aug 2018 19:07:13 +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 ABE9E1007094; Mon, 13 Aug 2018 19:07:12 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Cc: Lukas Wunner , Peter Ujfalusi , stable@vger.kernel.org, Ben Skeggs , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/5] drm/nouveau: Fix bogus drm_kms_helper_poll_enable() placement Date: Mon, 13 Aug 2018 15:06:59 -0400 Message-Id: <20180813190706.24172-2-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.1]); Mon, 13 Aug 2018 19:07:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 13 Aug 2018 19:07:13 +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 Turns out this part is my fault for not noticing when reviewing 9a2eba337cace ("drm/nouveau: Fix drm poll_helper handling"). Currently we call drm_kms_helper_poll_enable() from nouveau_display_hpd_work(). This makes basically no sense however, because that means we're calling drm_kms_helper_poll_enable() every time we schedule the hotplug detection work. This is also against the advice mentioned in drm_kms_helper_poll_enable()'s documentation: Note that calls to enable and disable polling must be strictly ordered, which is automatically the case when they're only call from suspend/resume callbacks. Of course, hotplugs can't really be ordered. They could even happen immediately after we called drm_kms_helper_poll_disable() in nouveau_display_fini(), which can lead to all sorts of issues. Additionally; enabling polling /after/ we call drm_helper_hpd_irq_event() could also mean that we'd miss a hotplug event anyway, since drm_helper_hpd_irq_event() wouldn't bother trying to probe connectors so long as polling is disabled. So; simply move this back into nouveau_display_init() again. The race condition that both of these patches attempted to work around has already been fixed properly in d61a5c106351 ("drm/nouveau: Fix deadlock on runtime suspend") Fixes: 9a2eba337cace ("drm/nouveau: Fix drm poll_helper handling") Signed-off-by: Lyude Paul Cc: Lukas Wunner Cc: Peter Ujfalusi Cc: stable@vger.kernel.org --- drivers/gpu/drm/nouveau/nouveau_display.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index ec7861457b84..1d36ab5d4796 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -355,8 +355,6 @@ nouveau_display_hpd_work(struct work_struct *work) pm_runtime_get_sync(drm->dev->dev); drm_helper_hpd_irq_event(drm->dev); - /* enable polling for external displays */ - drm_kms_helper_poll_enable(drm->dev); pm_runtime_mark_last_busy(drm->dev->dev); pm_runtime_put_sync(drm->dev->dev); @@ -411,6 +409,11 @@ nouveau_display_init(struct drm_device *dev) if (ret) return ret; + /* enable connector detection and polling for connectors without HPD + * support + */ + drm_kms_helper_poll_enable(dev); + /* enable hotplug interrupts */ drm_connector_list_iter_begin(dev, &conn_iter); nouveau_for_each_non_mst_connector_iter(connector, &conn_iter) { -- 2.17.1