Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4561402imm; Mon, 30 Jul 2018 17:42:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmPpPF4snoaDqQJxEuU2qaDfoT4Cf/KCuk3Ig/j/9GuzUGc5sRmhvoF5p2Y8radcFlJfNL X-Received: by 2002:a63:1811:: with SMTP id y17-v6mr18283803pgl.356.1532997734780; Mon, 30 Jul 2018 17:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532997734; cv=none; d=google.com; s=arc-20160816; b=r4ofbQs4YK6n1Prf/chC2u1zuXA7BNkYcfKfxNuthKBQsRAiKvI3SSy4LBpcPq2sRI UYndjBrlxpc+waM2jqOIj9Z4050QN3tKDwVh84LKMmxpNbjKLZuCuIz/gMIKAqA0M1Ma clPxF7O0suCcDVec7mFYbdJ9MsAYiLgI3j4Rw5Wf6aTc8z5HfWfdKuLI7UsJH0egH5Eg +3GHkJBqU3uukXvaBOlrM1uo6upxuKMhU0ttnOtiQMMYLw8x+TYApDjSJ1yscHHYvnbp x7riWDlfFBweD4+9mPZEGbefwXpgz6EkZh6lYTQOktP1qYWlStuWLTGNjJXTTJANNDrS W8rQ== 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=QYyqqowXh5n40a7xyXsnu0qJ0lxqDqFYGHnS3wVh8CwACKjic8yRLIVHz1AH64JsLN 64yrci2V1Cm12kLIsGA5u4oJQNtf/FYNvxzqDL4XrdpMNQCwOxXPRBtmADUC5px/ajcg mx3sPyaaQD+ZvMQeHACSZy9/Z+k0Wv0jsAS8haKDJg0HXqBk0uMeaQiSuFN141FGQpaQ CF2QzKNlF4dOdXs1/In7pj4EPZYqfIi0MiM0iR3Rt8pxZMGfj+Q6Yj835Hu3OYpsaPNZ Lsj4Kwf4ZqOD96jyZSdB0+ZgOMUnXPTSLxYYo+f9IUTY8xexc5yQ10FPmHpfmj0RPdtY rATQ== 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 g1-v6si10966095plo.176.2018.07.30.17.42.00; Mon, 30 Jul 2018 17:42:14 -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 S1732234AbeGaCRi (ORCPT + 99 others); Mon, 30 Jul 2018 22:17:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37228 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732039AbeGaCRh (ORCPT ); Mon, 30 Jul 2018 22:17:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 706CD40241CB; Tue, 31 Jul 2018 00:40:03 +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 F3989FF5B; Tue, 31 Jul 2018 00:40:01 +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 v3 1/8] drm/nouveau: Fix bogus drm_kms_helper_poll_enable() placement Date: Mon, 30 Jul 2018 20:39:46 -0400 Message-Id: <20180731003954.19962-2-lyude@redhat.com> In-Reply-To: <20180731003954.19962-1-lyude@redhat.com> References: <20180731003954.19962-1-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 31 Jul 2018 00:40:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 31 Jul 2018 00:40:03 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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