Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1830049ybn; Thu, 26 Sep 2019 02:53:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWWgdhiX1TlchCyPUS5x5d/Ep9N1OPXqUHM0Cy1lpM6EEwAre1JMXqCFVfzEzulodOK6EG X-Received: by 2002:a17:906:d926:: with SMTP id rn6mr2154783ejb.175.1569491631823; Thu, 26 Sep 2019 02:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569491631; cv=none; d=google.com; s=arc-20160816; b=qW1BO02fRrqjCMGSZpsdHWbBmWemnKorrkFcDmHnoH43C+UTYG1KNFY3p9gkaXT27L Cbo0OUNKKvqslfWiYiTbTVqS0S9+IIUX4MhY+dCuBvXNEOZBpeGptHffI4PeczgzBt/f /Ns61vItrkKrxx+bnn0mpGyRRlcPHqtIljlCUwLSJ2LNp7ieCizIjrXnNe+vlYXiPyMn YiiqvUvWtRJGCAlT0wtuH48juYUsApDYfyqNxCcV73em+c14moasUBmdT8+GgxiG3ncT FjUS/WaxRPdsfejg8cOOia0P2kILw2Sbl9W16RSXfIEkjzy9wkZ4Kn5gn1KXKDBpPuvg vnLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=f/jxq31Chxv3B7qohD7ZMPi0ff06Ouw1g9e6KDnszS4=; b=E3MLrVGQKEFzVPC/r3yiLhvnf04Eo/LCtBvlcj6Wss86RM23aki+SLBM/ZVnC2PGQZ kY0WFT/m8AUwdK9G0qbktnUphgRGFk+HJvoomZVv7lHz8AEEhpxF2UcPq10pue1TcgAk 7U9lEvFhX5g3k3bzm2w80XA0KLs6u/NGvqSkfDQg9OClHn4N0O8rMuBMCNCjFllLI8GJ jTGQzPABeasc4uv01Rv+l8WKjch9CGQ8OeX1qpWAdDf9/ZJY+Juht4xxvfzh6RdLrvOI znyFnOoPKZPbEWvMZ1rmWRJvtmihK1k6k/61StcnQxlJcdmFGVLLadJ75cu7qKdBojwH 4Aeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=dqP9Wlgg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17si694599ejt.173.2019.09.26.02.53.28; Thu, 26 Sep 2019 02:53:51 -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; dkim=pass header.i=@poorly.run header.s=google header.b=dqP9Wlgg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439885AbfIYTBA (ORCPT + 99 others); Wed, 25 Sep 2019 15:01:00 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:33816 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731534AbfIYTBA (ORCPT ); Wed, 25 Sep 2019 15:01:00 -0400 Received: by mail-yb1-f196.google.com with SMTP id p11so1453787ybc.1 for ; Wed, 25 Sep 2019 12:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=f/jxq31Chxv3B7qohD7ZMPi0ff06Ouw1g9e6KDnszS4=; b=dqP9WlggW+YzUAoVttZW7SbwyfyXhXuvQ/pcf4gDYZUkEDO9fc6yg8+WBDvn/WnSvW 35Nl8J+tlxvpTC/4O/q1YIn9TF/ZNJnSahvy7o+Iy6/OyrA41FQY4bu55o2OP6B62XcP 9qmn70iZALGTGQ5d3m73y9qacyWfO5Oo1z6WNbnM+hH991JewFPFaKUFJ58DICRMmN8w ec+EXWP+WSEMn8g6a6qx+dB+mIms/bAsrPwDZNw2RIYWKmx1Ow8WVdejtzIS0KbABryg cHRJOTuOtfeM3M/aH521kcbThOT79EFrlzuuv7i15fuwr4B1JoJknvepLeApFe3477NB DqAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=f/jxq31Chxv3B7qohD7ZMPi0ff06Ouw1g9e6KDnszS4=; b=CRxbmeQQoP7EgE7m+zbzRsvQFJv42Ewmbl3HMBkfeGdshz9MX+I8bSPXHXBJZ/CmjL 6FVIUoFzYVIHINW7hYg07PiniFGLzejhPd7dNRapISoHe7i4Z/Q/ktJwLWw9gWd1sPTM bVMVkHLdUooOEhvCDFXpccAPZwABwgvpVrAHKsdMo+e5xI9OG9R35N7yk9i6q9bqrlBV BR2dzkkNIw+EsRszRlZ7Y7LDUuzxJxmkgGqLKMFwIvXT1Ql5+Na7spccHA4qXQW0UccH 9Tf5jiJAwVM+I6LiueyC/JXdudPz0FPEzh99VfC0nWmz/rjW+RrNBUUzk/wjyFOtHMWg ONFQ== X-Gm-Message-State: APjAAAUVEG7eYLBqLUHRxMUdbwOyLGXKmH66PWiX/8Tk/CR3FK0MrR6P BwThGfhnYC/wOzIGmQc8qMpA1w== X-Received: by 2002:a25:f509:: with SMTP id a9mr4048605ybe.85.1569438059472; Wed, 25 Sep 2019 12:00:59 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id i14sm1346933ywe.107.2019.09.25.12.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 12:00:58 -0700 (PDT) Date: Wed, 25 Sep 2019 15:00:58 -0400 From: Sean Paul To: Lyude Paul Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Juston Li , Imre Deak , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Harry Wentland , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 08/27] drm/dp_mst: Remove PDT teardown in drm_dp_destroy_port() and refactor Message-ID: <20190925190058.GF218215@art_vandelay> References: <20190903204645.25487-1-lyude@redhat.com> <20190903204645.25487-9-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190903204645.25487-9-lyude@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 04:45:46PM -0400, Lyude Paul wrote: > This will allow us to add some locking for port->* members, in > particular the PDT and ->connector, which can't be done from > drm_dp_destroy_port() since we don't know what locks the caller might be > holding. Might be nice to mention that this is already done in the delayed destroy worker so readers don't need to go looking for it. Perhaps update this when you apply the patch. > > Changes since v2: > * Clarify commit message > > Cc: Juston Li > Cc: Imre Deak > Cc: Ville Syrj?l? > Cc: Harry Wentland > Cc: Daniel Vetter > Signed-off-by: Lyude Paul Reviewed-by: Sean Paul > --- > drivers/gpu/drm/drm_dp_mst_topology.c | 40 +++++++++++---------------- > 1 file changed, 16 insertions(+), 24 deletions(-) > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c > index f5f1d8b50fb6..af3189df28aa 100644 > --- a/drivers/gpu/drm/drm_dp_mst_topology.c > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c > @@ -1511,31 +1511,22 @@ static void drm_dp_destroy_port(struct kref *kref) > container_of(kref, struct drm_dp_mst_port, topology_kref); > struct drm_dp_mst_topology_mgr *mgr = port->mgr; > > - if (!port->input) { > - kfree(port->cached_edid); > + /* There's nothing that needs locking to destroy an input port yet */ > + if (port->input) { > + drm_dp_mst_put_port_malloc(port); > + return; > + } > > - /* > - * The only time we don't have a connector > - * on an output port is if the connector init > - * fails. > - */ > - if (port->connector) { > - /* we can't destroy the connector here, as > - * we might be holding the mode_config.mutex > - * from an EDID retrieval */ > + kfree(port->cached_edid); > > - mutex_lock(&mgr->delayed_destroy_lock); > - list_add(&port->next, &mgr->destroy_port_list); > - mutex_unlock(&mgr->delayed_destroy_lock); > - schedule_work(&mgr->delayed_destroy_work); > - return; > - } > - /* no need to clean up vcpi > - * as if we have no connector we never setup a vcpi */ > - drm_dp_port_teardown_pdt(port, port->pdt); > - port->pdt = DP_PEER_DEVICE_NONE; > - } > - drm_dp_mst_put_port_malloc(port); > + /* > + * we can't destroy the connector here, as we might be holding the > + * mode_config.mutex from an EDID retrieval > + */ > + mutex_lock(&mgr->delayed_destroy_lock); > + list_add(&port->next, &mgr->destroy_port_list); > + mutex_unlock(&mgr->delayed_destroy_lock); > + schedule_work(&mgr->delayed_destroy_work); > } > > /** > @@ -3998,7 +3989,8 @@ static void drm_dp_tx_work(struct work_struct *work) > static inline void > drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port) > { > - port->mgr->cbs->destroy_connector(port->mgr, port->connector); > + if (port->connector) > + port->mgr->cbs->destroy_connector(port->mgr, port->connector); > > drm_dp_port_teardown_pdt(port, port->pdt); > port->pdt = DP_PEER_DEVICE_NONE; > -- > 2.21.0 > -- Sean Paul, Software Engineer, Google / Chromium OS