Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1340159imm; Wed, 1 Aug 2018 14:16:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfG3Bz5iUpOjoXSCnDJ26xpZrG2pqsfkwbaKteC65nSNG7aKyjaGkp/hpemmZRW6Dw+3IOP X-Received: by 2002:a63:291:: with SMTP id 139-v6mr26338130pgc.365.1533158209681; Wed, 01 Aug 2018 14:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533158209; cv=none; d=google.com; s=arc-20160816; b=rgg7AAZeHYpGw6H3JomTEtc1+W0InyAomr5Yzlw/MB8dnmMtKq+r/WTpwgAcygyvY9 Yh1jj4obyjy/Z18H6ZLaj37he1xBMfoKCv5dNrJmRwtcLOzn2Kd076ayWGRByJ5P97lc vyyqz4zFRdutLOYrC6QN0g7XyLw6Q7fTu8Juy+b2l7smaGN3S6ImjQjcKBRRp2Y8Bibn ZpS/mnzUetWLGYKU7HeOarM0YNcmi228nkClMQ8DUWEoK+KMR2q9suUlLwXa/k3YlSof pXXGCcvjPFKvTVL1TbM+D+jqEf8Qdtv5GuH6LIoiSsRpZoXfIJZZvRjVm+w0DJp56Xys ZG1w== 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=IlJPttWCxpi7jSNvErA/FvY1drZmdzAoe9gS/Alxn3k=; b=o2sdMdxIkeYatRyls7BPEcTyfodhEfjMs3LIZ89OE/MukSYIOoCYGrSrONqaaqrk8Q Jl55oqKRscuG0Es2M/YUVRf1buLdMrLM6CsSH21o5Vux7N7wHi3ucQ9RRYTglgdxp9T4 kMZK/F9XFZe3Ht4Xgx52Q7KHDzwHMTKEtkheIFu6z8mN/+cm9ndnhWJv6KGOi/eVhkgB S0ZqwSMaZLIy3aONKu8oDZkDXmmmEcH3uxaOvLAp2Os11cDwAfoy3MxaDTCXKwnKfLNe ClSYbWkGiavMy9qm7laEaGpy6Cc2P5XfWJoU1pAw05tVXr9AuiegViHHIwSc+RhP2/sc 3Mag== 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 p14-v6si20000pgd.306.2018.08.01.14.16.35; Wed, 01 Aug 2018 14:16:49 -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 S1732454AbeHAXDS (ORCPT + 99 others); Wed, 1 Aug 2018 19:03:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56388 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726043AbeHAXDA (ORCPT ); Wed, 1 Aug 2018 19:03:00 -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 C079140216E5; Wed, 1 Aug 2018 21:15:18 +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 71A992026D68; Wed, 1 Aug 2018 21:15:18 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Cc: stable@vger.kernel.org, Lukas Wunner , Karol Herbst , Ben Skeggs , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 6/8] drm/nouveau: Respond to HPDs by probing one conn at a time Date: Wed, 1 Aug 2018 17:14:56 -0400 Message-Id: <20180801211459.7731-7-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.5]); Wed, 01 Aug 2018 21:15:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 01 Aug 2018 21:15:18 +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 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 Cc: stable@vger.kernel.org Cc: Lukas Wunner Cc: Karol Herbst --- 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