Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5210574rwb; Wed, 17 Aug 2022 13:09:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR6WAMPhwz+tdrkkEqUvxcGTdq880kJbnf/ojGRf0CzEZWJl6+5Ku9dop0gpf8f3eji4+Rhd X-Received: by 2002:a17:907:8a01:b0:731:4316:b0ad with SMTP id sc1-20020a1709078a0100b007314316b0admr18143000ejc.477.1660766968688; Wed, 17 Aug 2022 13:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660766968; cv=none; d=google.com; s=arc-20160816; b=uuF2OlQWURw91ml/6kOYwcRjleUoaXMIRrds79jkhTSoCYIhFAnRQYCARa/QYBO0Vj raow85CpTpnkNF+3XjschmYqmc4CJBnOTe5/Nn5dsKkgLWZYdtnwwbigJNRi5d54lclp lwcGB2K5k5ttjBj+2uCfjfTufCp9+B9l3VS/dyCtL7LijCOEONa5KJz13gMuauhyHefj O5yJ5pbBKhfMfIv65r1oEBFo31xfGAduG7HN/vCxnw57tZuRma2BmTmY7r/sAMMCbZcN NHXaDnbpjotig2kWh9BesfCWQnK3aiRLp1QsVZud44oKlc0GiiaaYOXnvXNy4AWPUBgV dQbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Lwx8PaWh6vygwU1UFyt3KfAFGt9fHxhNC+ENd2udmJQ=; b=DAOjF08xZgFPodon5z1lL5MqayaPdo7Tm7soN3DD4GsZ+K5i4VI0qwkKCKXJBCMb8o vu69fvh37EiCTRhDufwxfi2EKvF0QetmTjBmmTV4qrp+ali3NDdIv75BvR9pKZizwom3 pV4BXqLA4pP5z9m1Jt1Qd413JrbBn5TtzJNJWCgQinUfC7Dp9P7iKT+hVs5R7lPQRM97 bZxG5eoAyl+MgON1nT5hc9Wm9LeW42qCrNYdIfslvh+LsepZGOZQVhRq+8bfl23k9yoR e2CFYP06VeRzLoVKYf2Vhrr8W3Hu2WeVBoJAMSJ0LHGlbGlPBkT5lcGzknBmlo4CloYT Wqsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JUWfKSDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx9-20020a05640222a900b0043bb8c45f26si12090000edb.128.2022.08.17.13.09.01; Wed, 17 Aug 2022 13:09:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JUWfKSDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241638AbiHQTmJ (ORCPT + 99 others); Wed, 17 Aug 2022 15:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241702AbiHQTkr (ORCPT ); Wed, 17 Aug 2022 15:40:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C292A50E9 for ; Wed, 17 Aug 2022 12:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660765244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lwx8PaWh6vygwU1UFyt3KfAFGt9fHxhNC+ENd2udmJQ=; b=JUWfKSDv1pLxhEmJiHWXoHeNTRaqDjWK6d6ICWyevvGU4zPf8CNEUfi+xiD0hoo++thQN3 p2VlOt3o73F20br/jdLqfjj3Kw0Bg2fvB9uMGfVpuR/SQyiecNY9gjQUzvnNjd/pbR+LWZ dX9x/MKDlmuAICL2TRg7nWx+lkQZcmg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-341-Ud7XGgcCPoq0YbT_jcJUOQ-1; Wed, 17 Aug 2022 15:40:39 -0400 X-MC-Unique: Ud7XGgcCPoq0YbT_jcJUOQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F9FE8032FB; Wed, 17 Aug 2022 19:40:38 +0000 (UTC) Received: from emerald.redhat.com (unknown [10.22.18.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FCB2492C3B; Wed, 17 Aug 2022 19:40:37 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: Wayne Lin , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Fangzhi Zuo , Jani Nikula , Imre Deak , Daniel Vetter , Sean Paul , David Airlie , Daniel Vetter , Thomas Zimmermann , Bhawanpreet Lakha , linux-kernel@vger.kernel.org (open list) Subject: [RFC v4 14/17] drm/display/dp_mst: Drop all ports from topology on CSNs before queueing link address work Date: Wed, 17 Aug 2022 15:38:43 -0400 Message-Id: <20220817193847.557945-15-lyude@redhat.com> In-Reply-To: <20220817193847.557945-1-lyude@redhat.com> References: <20220817193847.557945-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We want to start cutting down on all of the places that we use port validation, so that ports may be removed from the topology as quickly as possible to minimize the number of errors we run into as a result of being out of sync with the current topology status. This isn't a very typical scenario and I don't think I've ever even run into it - but since the next commit is going to make some changes to payload updates depending on their hotplug status I think it's a probably good idea to take precautions. Let's do this with CSNs by moving some code around so that we only queue link address probing work at the end of handling all CSNs - allowing us to make sure we drop as many topology references as we can beforehand. Signed-off-by: Lyude Paul Cc: Wayne Lin Cc: Ville Syrjälä Cc: Fangzhi Zuo Cc: Jani Nikula Cc: Imre Deak Cc: Daniel Vetter Cc: Sean Paul Acked-by: Jani Nikula --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 97e8f8a83ed4..a5460cadf2c8 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -2509,7 +2509,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, return ret; } -static void +static int drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, struct drm_dp_connection_status_notify *conn_stat) { @@ -2522,7 +2522,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, port = drm_dp_get_port(mstb, conn_stat->port_number); if (!port) - return; + return 0; if (port->connector) { if (!port->input && conn_stat->input_port) { @@ -2575,8 +2575,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, out: drm_dp_mst_topology_put_port(port); - if (dowork) - queue_work(system_long_wq, &mstb->mgr->work); + return dowork; } static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_topology_mgr *mgr, @@ -4060,7 +4059,7 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_branch *mstb = NULL; struct drm_dp_sideband_msg_req_body *msg = &up_req->msg; struct drm_dp_sideband_msg_hdr *hdr = &up_req->hdr; - bool hotplug = false; + bool hotplug = false, dowork = false; if (hdr->broadcast) { const u8 *guid = NULL; @@ -4083,11 +4082,14 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr, /* TODO: Add missing handler for DP_RESOURCE_STATUS_NOTIFY events */ if (msg->req_type == DP_CONNECTION_STATUS_NOTIFY) { - drm_dp_mst_handle_conn_stat(mstb, &msg->u.conn_stat); + dowork = drm_dp_mst_handle_conn_stat(mstb, &msg->u.conn_stat); hotplug = true; } drm_dp_mst_topology_put_mstb(mstb); + + if (dowork) + queue_work(system_long_wq, &mgr->work); return hotplug; } -- 2.37.1