Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4561102imm; Mon, 30 Jul 2018 17:41:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkng2whHzXA1t7QjVPrJY1IBqX3aK7Dv7ShdawVSBoQHBUQ3Mr2T+to+lyjwcxIM2HYD/k X-Received: by 2002:a63:943:: with SMTP id 64-v6mr17954615pgj.368.1532997704604; Mon, 30 Jul 2018 17:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532997704; cv=none; d=google.com; s=arc-20160816; b=Ta28tWMVl8kysOOKv1IYs+OoCl6vsNlbhnzvUocJJ9cI2YrbUlqbIhQwzF604iYAAl tzV4fniJ6t7KfJN2aOvPxVMjdpPrmmq75h80wUK7FbMYFIb1y2lPKq4cTBkVWDGYiixK ZCYhVbPYBfyx4gSogUbJUzk5JrNCn/0ssewN5w0xiwBggdynlbSeJb+kjHbouDlVUsf9 j5tPfKyxa4WY6iOLlpVqAUN659MRJWBtMgy3MxPo/mv++hwBQH0XtRQN+KTQbbYp5l2F QPy/z6CzlzgyhAtJvOc2UN4RrJZ6nsHqOTuC+B2KoiHtervUP16DdLKnSwRI+ypiT3DY kzQw== 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=HbXMxUMEKj7pujEZ2FR1EoBzrp5UCU9FZSUe1miKP/bsyV+8X4j2Fl5SunsNTF1K2z 7uLvmxXzqqDh0EYfHakupTA3oFs2i97nH0o1hFUdJafxFuiAuy8RZy+bHjaGImWw2nzw Y0FQ1MRdzMQ4dgeMbhFfF45LlULb/kXZyFqNxg+/8X7h/dEGT1/X65ucA6+nc0ibxmz2 KFIqG3x/j1iwqUDUF5HTPs2wsR/skSkxAaPXKT5QunGdDppfPI4UD6EjFPihN52Zer3c nESWiUlSxsBbEuAUlNA76dqr+wExFm7+PIzuRXAvmnN893F+w6uBhx8gAoaHD73B3t4B eqpQ== 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 p13-v6si7121785pgi.317.2018.07.30.17.41.30; Mon, 30 Jul 2018 17:41: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 S1732270AbeGaCRk (ORCPT + 99 others); Mon, 30 Jul 2018 22:17:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732253AbeGaCRj (ORCPT ); Mon, 30 Jul 2018 22:17:39 -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 1D3DF40216FC; Tue, 31 Jul 2018 00:40:06 +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 C187216875; Tue, 31 Jul 2018 00:40:05 +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 v3 6/8] drm/nouveau: Respond to HPDs by probing one conn at a time Date: Mon, 30 Jul 2018 20:39:51 -0400 Message-Id: <20180731003954.19962-7-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.5]); Tue, 31 Jul 2018 00:40:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 31 Jul 2018 00:40:06 +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 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