Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3848434rdh; Fri, 29 Sep 2023 04:25:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0to+Ngki1B8C93F2H6lfbOjWkXdJi54TGyCsdMQcyWxkrDP6tWVACNL7OWkL2aCwsqO7Q X-Received: by 2002:a05:6e02:2190:b0:348:f4c1:4817 with SMTP id j16-20020a056e02219000b00348f4c14817mr4326351ila.6.1695986752517; Fri, 29 Sep 2023 04:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695986752; cv=none; d=google.com; s=arc-20160816; b=JAzqeUp73hg+fcE3twFzU2O3d9Y+bzJ7rytkLuSh1emdP7JWfTEND2hNwhHkQLBSWU 2WBLkeoqOf/0cWDnTK6371FFzFSctIK5dyyV7OTcl2aK+C51CmmDfD+xzgPOFG9hzjeX jDWxqhHCZ+vWz+gVfUhkjkMcBuRBq+Ff6spUhE2fz2ZkYXZ9oG4AHWz+6CN8X4uR0IjZ 0A4zKWpZ33C8nRA6Nc1LAjiUNX+ZpR3ThLspUCCQkQld8aE8LWsOuX/INNcPW6PnQ7/x pPu1RSYZINJkhgLXB/DVj5M0c7ZN2NirU6yGGsBUnoTr02jWNfQ160HDg9ehD+VdRifP 7kBQ== 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 :message-id:date:references:organization:in-reply-to:subject:cc:to :from:dkim-signature; bh=4m5axKU2jOtSTIUzvDCrjw1VZm/VWLDZRcTXIGo5EgI=; fh=OpUJ2uzPOc+iDNYiNbPTG2xAL/P1NE24T5lIkWKgRDY=; b=R0e2p/syak+KeeHTaUKmWcpNXdhLX6+Vmaw1RYKafHtd/iyJ7ORvFbniWBaLG4PuaL 6+s8gUDXsGLa3n9YOqqWOsXutGjVB5tsr4aXAKZJWRPxiFl7rw7pFxEYsQ8GM8hXdYkQ 1scs9saqgHSRzm6IniHR0Fge0K466S30nTOSVP6qZcflEwZZeTh9AD0TpaxS0VZS19NA FN5iu4/9Qm/lVLwV4UPbQdoqXpInBV7CqDNgM24XNVsofpZ2D3SWtVmnx1hgsLnwNHtj eGaYnqUnUYxBHJIkQdMyN0+abeaEw4Bvwg4f8k71M1y6q+IBovfaDZ9klAsruDJ9pTkU QD7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EQe2Nu+y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k67-20020a633d46000000b0057c2f614756si19637831pga.212.2023.09.29.04.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 04:25:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EQe2Nu+y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 7885E836C00A; Fri, 29 Sep 2023 01:23:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232818AbjI2IXg (ORCPT + 99 others); Fri, 29 Sep 2023 04:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbjI2IXe (ORCPT ); Fri, 29 Sep 2023 04:23:34 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E9F41BF for ; Fri, 29 Sep 2023 01:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695975811; x=1727511811; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=/WzEip24W8k3g6aleomP/ErXZzyKZQdSum96OHqR2qA=; b=EQe2Nu+yBvbL3Ng4iJwbTfFs/WNv7SsE2OBUiiHlj8R5MMNMm6mfmZRR s7czduTe06VaiMjl09HknQmj+H8wBhV/yMOAzIha1rZrOLupuHaRX/9uZ /l+DJIdJ8g1lHQPffe02DE3RF0GW6isQWXhEEzt9wYpjCcwqtzLkZd9zf VEjaGiFKyUjgcLCziXYR4OHc6MsfpLP2dQhHwGCjZO5I4IyPyTWr3kI8x q5CsKlZ2kZmhYcSqVWABkb1o62MmGuoSQe3l4MK1NVYYciZYoLwa1Ykte Cmj6LVx55KpAEJB2291bXjWo+iqpKgsA+yToUfIcSzZh3HQOtTjG+MFiY A==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="385071319" X-IronPort-AV: E=Sophos;i="6.03,186,1694761200"; d="scan'208";a="385071319" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 00:53:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="873585164" X-IronPort-AV: E=Sophos;i="6.03,186,1694761200"; d="scan'208";a="873585164" Received: from danielba-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.53.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 00:53:51 -0700 From: Jani Nikula To: Ramya SR , Alex Deucher , "imre.deak@intel.com" Cc: Lyude Paul , Jeff Layton , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Wayne Lin , Alex Deucher , "Ramya SR (QUIC)" Subject: RE: [PATCH v1] drm/dp/mst: fix missing modeset unlock for MST port detect In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1694753689-29782-1-git-send-email-quic_rsr@quicinc.com> <19ce2cd9abfd3bdf3ea91f9bceb43206e4740c2e.camel@redhat.com> Date: Fri, 29 Sep 2023 10:53:48 +0300 Message-ID: <87wmw9ifeb.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 29 Sep 2023 01:23:57 -0700 (PDT) On Fri, 29 Sep 2023, Ramya SR wrote: > Hi All , > > Please review the reply comment. Please read the responses you do get [1]. Please stop top-posting. Please fix your mail client. BR, Jani. [1] https://lore.kernel.org/r/877coak8o3.fsf@intel.com > > Regards, > Ramya SR > > -----Original Message----- > From: Ramya SR=20 > Sent: Thursday, September 28, 2023 7:55 AM > To: 'Alex Deucher' ; 'imre.deak@intel.com' > Cc: 'Lyude Paul' ; 'Jani Nikula' ; 'Jeff Layton' ; 'linux-kernel@vger.kernel.org' ; 'dri-devel@lists.freedesktop.org' ; 'Wayne Lin' ; 'Alex Deucher' ; Ramya SR (QUIC) > Subject: RE: [PATCH v1] drm/dp/mst: fix missing modeset unlock for MST po= rt detect > > Reminder. Please review the reply comment. > > Thanks and Regards, > Ramya SR > > -----Original Message----- > From: Ramya SR=20 > Sent: Tuesday, September 26, 2023 4:12 PM > To: Alex Deucher ; imre.deak@intel.com > Cc: Lyude Paul ; Jani Nikula ; J= eff Layton ; linux-kernel@vger.kernel.org; dri-devel@li= sts.freedesktop.org; Wayne Lin ; Alex Deucher ; Ramya SR (QUIC) > Subject: RE: [PATCH v1] drm/dp/mst: fix missing modeset unlock for MST po= rt detect > > > > -----Original Message----- > From: Alex Deucher > Sent: Monday, September 25, 2023 8:27 PM > To: imre.deak@intel.com > Cc: Lyude Paul ; Jani Nikula ; J= eff Layton ; linux-kernel@vger.kernel.org; dri-devel@li= sts.freedesktop.org; Wayne Lin ; Alex Deucher ; Ramya SR (QUIC) > Subject: Re: [PATCH v1] drm/dp/mst: fix missing modeset unlock for MST po= rt detect > > WARNING: This email originated from outside of Qualcomm. Please be wary o= f any links or attachments, and do not enable macros. > > On Fri, Sep 22, 2023 at 3:22=E2=80=AFPM Imre Deak w= rote: >> >> On Fri, Sep 22, 2023 at 03:02:23PM -0400, Lyude Paul wrote: >> > >> > Oh! wow thank you for catching this: >> > >> > Reviewed-by: Lyude Paul >> > >> > I will go and push this to drm-misc-next in just a moment >> > >> > On Fri, 2023-09-15 at 10:24 +0530, Ramya SR wrote: >> > > Modeset mutex unlock is missing in drm_dp_mst_detect_port function. >> > > This will lead to deadlock if calling the function multiple times=20 >> > > in an atomic operation, for example, getting imultiple MST ports=20 >> > > status for a DP MST bonding scenario. >> > > >> > > Signed-off-by: Ramya SR >> > > --- >> > > drivers/gpu/drm/display/drm_dp_mst_topology.c | 4 +++- >> > > 1 file changed, 3 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c >> > > b/drivers/gpu/drm/display/drm_dp_mst_topology.c >> > > index ed96cfc..d6512c4 100644 >> > > --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c >> > > +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c >> > > @@ -4154,7 +4154,7 @@ drm_dp_mst_detect_port(struct drm_connector=20 >> > > *connector, >> > > >> > > ret =3D drm_modeset_lock(&mgr->base.lock, ctx); >> > > if (ret) >> > > - goto out; >> > > + goto fail; >> > > >> > > ret =3D connector_status_disconnected; >> > > >> > > @@ -4181,6 +4181,8 @@ drm_dp_mst_detect_port(struct drm_connector *c= onnector, >> > > break; >> > > } >> > > out: >> > > + drm_modeset_unlock(&mgr->base.lock); >> >> Isn't this supposed to be unlocked only by >> drm_helper_probe_detect_ctx() / drm_helper_probe_detect() ? > > Maybe adding a comment to that effect would be helpful for the future. > > Alex > >>this is different lock, above function mentioned is locking/unlocking the= global connection_mutex, that is required always locked during the atomic = >check/commit. Here we are talking about MST topology manager mutex "mgr->b= ase.lock". > >>For normal non-bond MST, it's ok, the calling sequence for detecting=20 >>MST connector status is dp_mst_connector_detect=20 >>->mst->mst_fw_cbs->detect_port_ctx =3D dp_mst_detect_port=20 >>->drm_dp_mst_detect_port (where mgr->base.lock is locked) > >> Then for the bond MST case, to figure out if the sibling connectors=20 >> are also connected, so that the bonding is possible, we need detect=20 >> two or more connectors >in single dp_mst_connector_detect call > >>dp_mst_connector_detect ->mst->mst_fw_cbs->detect_port_ctx =3D=20 >>dp_mst_detect_port ->drm_dp_mst_detect_port (where mgr->base.lock is=20 >>locked) dp_mst_find_sibling_connector=20 >>->mst->mst_fw_cbs->detect_port_ctx =3D dp_mst_detect_port=20 >>->drm_dp_mst_detect_port (blocked by mgr->base.lock) > >> >> > > +fail: >> > > drm_dp_mst_topology_put_port(port); >> > > return ret; >> > > } >> > >> > -- >> > Cheers, >> > Lyude Paul (she/her) >> > Software Engineer at Red Hat >> > --=20 Jani Nikula, Intel