Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1340973imm; Wed, 1 Aug 2018 14:17:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcII6FliHKTOAsGIXMXaItUHadpxIVWOTFwwX/fD5Ymh++TeHh/1/fCOqRbcPUBPPXs3Zfl X-Received: by 2002:a17:902:7c0a:: with SMTP id x10-v6mr11215pll.77.1533158264091; Wed, 01 Aug 2018 14:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533158264; cv=none; d=google.com; s=arc-20160816; b=fkc+9zx5mPE7TZzxB7mpgKvLFQ/EnqwT3DFlWZI8/ybpfPFr261eqQ5RsuuYX7/eCa GjXK1hZvWSYtKTfuYGcxshOlCkf9n40Cis2+gphLBYSDlfwCqurTWknM/6Hb8rrHNaEY g5238Hac3ZXbd3fi00/ZKS5qx+9K++WbNPfoaLFo2I/uEnCRtahFf7diQ4DP0YepjKuW Ol227kjmg1XNNRnsTLAE9Peez9hzMmxJHBkQ7qTDjNpcS1yEPjh2t03LoTo/B4Fib8N3 IwQrE6u+70zpxy3rJMsdbQaaZa9b9Z0eNkt6jiveWG2b4M0IiHKivKLlDIrMLj7jo//K X+Sw== 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=wFjD6tqkyJd46Q0UmQtcnio7UVCpJFqorZ9p5+JtFew=; b=r3kHGGDAJDYLMWqjwF97rynOnK409dwHNqDT2B0Tc+Ln+urIdnYgRhh1FdzzdKHqSD RLQSxEw7FGonfIkrblD8SyXOdJ1MfbZB5XpmgRhwP5UAlm30wqPocK5Zs1SDdFtuSL0j BtPxOte18Z0abPS75VtbTjgoMvQvC/qhQZO8Wa4JT/Qhz3pvj0J4F1fIm8vgOJMaej4d cwwYj2Wg2jgJH5AWXzNeEK2qjoQKuybwYZeApsOrYU0Zo+rYqvkDIL9E8KY0b7MfxTCs w3rDccCBV4lfVzPjW7z9x6fVQxU2eNYuMsst8UXNjM1/9pe2iuay7kZjVc0xGyA7etXb HAkw== 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 200-v6si20971pgf.378.2018.08.01.14.17.29; Wed, 01 Aug 2018 14:17:44 -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 S1731990AbeHAXC7 (ORCPT + 99 others); Wed, 1 Aug 2018 19:02:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48558 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726880AbeHAXC6 (ORCPT ); Wed, 1 Aug 2018 19:02:58 -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 0F2C887A84; Wed, 1 Aug 2018 21:15: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 601F82026D68; Wed, 1 Aug 2018 21:15:15 +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 v4 1/8] drm/nouveau: Fix bogus drm_kms_helper_poll_enable() placement Date: Wed, 1 Aug 2018 17:14:51 -0400 Message-Id: <20180801211459.7731-2-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.1]); Wed, 01 Aug 2018 21:15:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 01 Aug 2018 21:15:16 +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 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 +++++-- drivers/gpu/drm/nouveau/nouveau_drm.c | 1 - 2 files changed, 5 insertions(+), 3 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) { diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index c7ec86d6c3c9..5fdc1fbe2ee5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -835,7 +835,6 @@ nouveau_pmops_runtime_suspend(struct device *dev) return -EBUSY; } - drm_kms_helper_poll_disable(drm_dev); nouveau_switcheroo_optimus_dsm(); ret = nouveau_do_suspend(drm_dev, true); pci_save_state(pdev); -- 2.17.1