All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: nouveau@lists.freedesktop.org
Cc: stable@vger.kernel.org, Lukas Wunner <lukas@wunner.de>,
	Karol Herbst <karolherbst@gmail.com>,
	Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 6/8] drm/nouveau: Respond to HPDs by probing one conn at a time
Date: Mon, 30 Jul 2018 20:39:51 -0400	[thread overview]
Message-ID: <20180731003954.19962-7-lyude@redhat.com> (raw)
In-Reply-To: <20180731003954.19962-1-lyude@redhat.com>

There isn't actually any reason we need to call drm_hpd_irq_event() from
our hotplug handler, as we already know which connector the hotplug
event was fired for. We're also going to need to avoid probing all
connectors needlessly from hotplug handlers anyway so that we can track
when nouveau_connector_detect() is being called from the context of it's
connector's hotplug handler in order to fix the next deadlocking issue.

This is (slightly) faster anyway!

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Karol Herbst <karolherbst@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 28 ++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 010d6db14cba..9714e09f17db 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1114,6 +1114,32 @@ nouveau_connector_funcs_lvds = {
 	.atomic_get_property = nouveau_conn_atomic_get_property,
 };
 
+static void
+nouveau_connector_hotplug_probe(struct nouveau_connector *nv_conn)
+{
+	struct drm_modeset_acquire_ctx ctx;
+	struct drm_connector *conn = &nv_conn->base;
+	enum drm_connector_status old_status;
+	struct drm_device *dev = conn->dev;
+	bool changed;
+
+	mutex_lock(&dev->mode_config.mutex);
+
+	drm_modeset_acquire_init(&ctx, 0);
+	drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
+
+	old_status = conn->status;
+	conn->status = drm_helper_probe_detect(conn, &ctx, true);
+	changed = old_status != conn->status;
+
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
+	mutex_unlock(&dev->mode_config.mutex);
+
+	if (changed)
+		drm_kms_helper_hotplug_event(dev);
+}
+
 static int
 nouveau_connector_hotplug(struct nvif_notify *notify)
 {
@@ -1138,7 +1164,7 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
 				nv50_mstm_remove(nv_encoder->dp.mstm);
 		}
 
-		drm_helper_hpd_irq_event(connector->dev);
+		nouveau_connector_hotplug_probe(nv_connector);
 	}
 
 	return NVIF_NOTIFY_KEEP;
-- 
2.17.1


  parent reply	other threads:[~2018-07-31  0:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  0:39 [PATCH v3 0/8] Fix connector probing deadlocks from RPM bugs Lyude Paul
2018-07-31  0:39 ` Lyude Paul
2018-07-31  0:39 ` [PATCH v3 1/8] drm/nouveau: Fix bogus drm_kms_helper_poll_enable() placement Lyude Paul
2018-07-31  0:39 ` [PATCH v3 2/8] drm/nouveau: Enable polling even if we have runtime PM Lyude Paul
2018-07-31  0:39   ` Lyude Paul
2018-07-31  0:39 ` [PATCH v3 3/8] drm/fb_helper: Introduce hotplug_suspend/resume() Lyude Paul
2018-07-31  0:39   ` Lyude Paul
     [not found]   ` <20180731003954.19962-4-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-07-31 14:14     ` William Lewis
2018-08-01  8:36   ` kbuild test robot
2018-08-01  9:53   ` kbuild test robot
2018-08-01  9:53     ` kbuild test robot
2018-08-06  8:43   ` Daniel Vetter
2018-08-06 19:15     ` Lyude Paul
2018-08-06 19:34       ` Lukas Wunner
2018-08-06 19:34         ` Lukas Wunner
2018-08-06 19:43         ` Daniel Vetter
2018-08-06 19:43           ` Daniel Vetter
2018-08-06 19:45         ` Alex Deucher
2018-08-06 19:45           ` Alex Deucher
2018-07-31  0:39 ` [PATCH v3 4/8] drm/nouveau: Fix deadlock with fb_helper using new helpers Lyude Paul
2018-07-31  0:39   ` Lyude Paul
2018-07-31  0:39 ` [PATCH v3 5/8] drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Lyude Paul
2018-07-31  0:39   ` Lyude Paul
2018-07-31  0:39 ` Lyude Paul [this message]
2018-07-31  0:39 ` [PATCH v3 7/8] drm/nouveau: Fix deadlocks in nouveau_connector_detect() Lyude Paul
2018-07-31  0:39 ` [PATCH v3 8/8] drm/nouveau: Call pm_runtime_get_noresume() from hpd handlers Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180731003954.19962-7-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karolherbst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=nouveau@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.