Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3474087imm; Mon, 13 Aug 2018 12:19:55 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwIcDbza+apCXZjEdBMhyWTnBV1duQTB6A7HRkb1jdgAZtDsIm9nQaXr8STEd2I7AOxAKpk X-Received: by 2002:a17:902:a24:: with SMTP id 33-v6mr5121835plo.263.1534187995571; Mon, 13 Aug 2018 12:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534187995; cv=none; d=google.com; s=arc-20160816; b=fquQoqLee2RqMm/k4SZfHuyVjKWp9Aw4WSYFraKj5qroJBM2AshG9CgqNd1orR52k2 KMl7oSjWWcwjNEjCGGzLDfTYkAOgsKpm4yLyUok9IagLCAcE2fTGOlh+r7H+VE8lTt0a Vob6UMG6K0I6UrFlW8Qw8aS7fhAypiRjTRD4FMQlfnU8WG2izypV4CAUmeTGZqrG8TWG SjNN9XlZ9BH9R7wOnbNC4xPYul3zdRlBgcTonnCPY4UO/WJRtAqvSveHkFFuyQPKarWE iAZ5vRPNYtmtdUGFaOzfcTNE0APi/dggJrmrxln5/WHuo768I2nk8VIVXuQv05N4yrA0 nPuQ== 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=wab7NDNsItM+To7+Jksp7ZcJ+MdSRkugT1z7MFWp2sMC9NSe2A03GN+vniWZ9vwdGw gjusrZP9+SfMwZzL/cIFf29Dr247XFp3yI/yUByAKyUi+6b1dGCbD4qn0PnUzWfJAqtK KEzieT2pSRajpjXONrfeB4sk37AefJzPV6DCeGzTfMBP3pC9r3v4jz+J/M6quM4yN1wd 4HvaqM3AQMKijlBE2OkfrZY8sPMdipihvkYOEJ8/m1KrSOWo+011bkFeB1YHljBZDZbm ldbBeNWgbTMJUJxLSwdi5NNEKE/zYpvWHBu4Ef9uf+kHZpj+bpdcrYP3Zs1hPhiZNhUF FK5Q== 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 a17-v6si18620867pgb.369.2018.08.13.12.19.40; Mon, 13 Aug 2018 12:19:55 -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 S1730912AbeHMWAi (ORCPT + 99 others); Mon, 13 Aug 2018 18:00:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50150 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729990AbeHMWAh (ORCPT ); Mon, 13 Aug 2018 18:00:37 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61525818F02C; Mon, 13 Aug 2018 19:17:04 +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 04E922156712; Mon, 13 Aug 2018 19:17:03 +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 v7 1/5] drm/nouveau: Fix bogus drm_kms_helper_poll_enable() placement Date: Mon, 13 Aug 2018 15:16:41 -0400 Message-Id: <20180813191648.27419-2-lyude@redhat.com> In-Reply-To: <20180813191648.27419-1-lyude@redhat.com> References: <20180813191648.27419-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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:17:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 13 Aug 2018 19:17:04 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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