From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9822C433F5 for ; Mon, 13 Dec 2021 17:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=luCESy+YwXrN+3gjYOde/VHG0Qu/8mkD90kH85Wg6T0=; b=lfW0zvbhafjfyCENoizNrozOPJ zquaI8+X1ygBHru87Kt85YKGKCP245Jjg6R8RpZf33HpaFdefxF1dUnxB/IFZguaCIdoJgLN0DAhA CbVqKMVnVIIlL6pbrhN54pg51RgmpNAYxyq40X2RTAKEqnuY2C4DI7b6CPB2eQsYfncec2ow4moT7 0oeepUHjtygGwMxTVyQn11vXHrm4rTorr11qWwSgvt1F1rVdV/FPzykialAOhwsjADixoPHzRn+Rx DaP4RPhHKrBlbm4wWT8b1d/BCTGQNoEk3AtRAI1nF+fFu97lmzTiXBt/mD8Bv7DnlP462dZAVTCNm i/gEkARA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwoid-00AlCq-Lr; Mon, 13 Dec 2021 17:02:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwoiY-00AlBP-Si for linux-arm-kernel@lists.infradead.org; Mon, 13 Dec 2021 17:02:28 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3294B5C01A6; Mon, 13 Dec 2021 12:02:26 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 13 Dec 2021 12:02:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=CccPXC1lwp4mKHgQAYzhGHZDySN KWUomCmAc3m5LP18=; b=Fpnyvc9Wb8NPoOZbIi0ZVlySFmMIkEMZEs1HkAkLhD3 KE7mCrmlOTWkU+Ubovs8AUSxKpc3X1fJfHeRTN6Zxvotj7nVv5ZF5NTIsRMyRBMl rsCA3H5F/ej7m7SFcjj75BBrp9YalXmP4wBY6RlinyQ8UTwDx6wkfaJ0QnAAbxUf KN8Qlw56h58NYRO4y0nIZVR87ulx4/togtLSA0gjpBZp9btBggxTk4zweWQ2cOwg 9maGaOwVV1qM/j5nl46yyp+lh5pKEctuYdPtdSjPAoOzYBMsQzFKaZ2EZ3xYgupa RAhH4Day3O7SiS+BIh8C+fyl97gz9W32u4MozBXsTYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=CccPXC 1lwp4mKHgQAYzhGHZDySNKWUomCmAc3m5LP18=; b=oHm9K3ISLLyehJBeAmcY6O +2U9GyoX39MA8LU8pSQ7LgLhky9Cey/HpS05NTvXKbZ8uo3Qh+5WqntsItOpbEuh iKucAJDsHjgECGUlnPvlt0Vj4p/6/ojIUXE3ub5VaW32WPlvA4yHcRcDfvOh5sV9 sW7jxCrahmnHJZHCMQkPfQRZSQGIMiaWkwcx4+VCy90j8S40BmFOYZTAvXbgVz36 5eRO2B6uuaOSMWXW8N5hksST1ywfB+AIKItlnBdt3Z7LjXZgCtqhfPlFrTos9xTd 6pOL/jEpPAGSB9MGGB3asj5cQ7JDPqIfOY6Ub9PU4fU8+yJP+d+m9ce+lF7p1Fwg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpeelkeeghefhuddtleejgfeljeffheffgfeijefhgfeufefhtdevteegheeiheeg udenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Dec 2021 12:02:24 -0500 (EST) Date: Mon, 13 Dec 2021 18:02:23 +0100 From: Maxime Ripard To: Jagan Teki Cc: Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: Re: [PATCH v6 1/6] drm: sun4i: dsi: Drop DRM bind race with bridge attach Message-ID: <20211213170223.fx5656vjk3fwizbg@houat> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> <20211210111711.2072660-2-jagan@amarulasolutions.com> MIME-Version: 1.0 In-Reply-To: <20211210111711.2072660-2-jagan@amarulasolutions.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_090227_266450_3926B704 X-CRM114-Status: GOOD ( 29.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============3320956722296879525==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3320956722296879525== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dtklktu6pvfdrrth" Content-Disposition: inline --dtklktu6pvfdrrth Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 10, 2021 at 04:47:06PM +0530, Jagan Teki wrote: > Existing host driver will keep looking for DRM pointer in > sun6i_dsi_attach and defers even if the particular DSI device > is found for the first time. Meanwhile it triggers the bind > callback and gets the DRM pointer and then continues the > sun6i_dsi_attach. >=20 > This makes a deadlock situation if sun6i_dsi_attach is trying > to find the bridge. I'm not sure what you mean by deadlock here, there's no lock involved? > If interface bridge is trying to call host attach, then host > sun6i_dsi_attach is trying to find bridge and defers the > interface bridge even if it found the bridge as bind callback > does not complete at the movement. So, this sun6i_dsi_attach > defers interface bridge and triggers the bind callback and > tries to attach the bridge with a bridge pointer which is not > available at the moment. > > Eventually these callbacks are triggered recursively, as > sun6i_dsi_attach defers interface bridge and bind callback > defers sun6i_dsi_attach due to invalid bridge ponter. ^ pointer >=20 > This patch prevents this situation by probing all DSI devices > on the pipeline first and then triggers the bind callback by > dropping exing DRM binding logic. ^ existing I guess? >=20 > Signed-off-by: Jagan Teki > --- > Changes for v6: > - none > Changes for v5: > - new patch >=20 > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +--------- > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 - > 2 files changed, 1 insertion(+), 10 deletions(-) >=20 > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun= 4i/sun6i_mipi_dsi.c > index 527c7b2474da..4bdcce8f1d84 100644 > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > @@ -967,14 +967,10 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *h= ost, > =20 > if (IS_ERR(panel)) > return PTR_ERR(panel); > - if (!dsi->drm || !dsi->drm->registered) > - return -EPROBE_DEFER; > =20 > dsi->panel =3D panel; > dsi->device =3D device; > =20 > - drm_kms_helper_hotplug_event(dsi->drm); > - > dev_info(host->dev, "Attached device %s\n", device->name); > =20 > return 0; > @@ -988,8 +984,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *hos= t, > dsi->panel =3D NULL; > dsi->device =3D NULL; > =20 > - drm_kms_helper_hotplug_event(dsi->drm); > - > return 0; > } > =20 > @@ -1077,8 +1071,6 @@ static int sun6i_dsi_bind(struct device *dev, struc= t device *master, > =20 > drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); > =20 > - dsi->drm =3D drm; > - > return 0; > =20 > err_cleanup_connector: > @@ -1091,7 +1083,7 @@ static void sun6i_dsi_unbind(struct device *dev, st= ruct device *master, > { > struct sun6i_dsi *dsi =3D dev_get_drvdata(dev); > =20 > - dsi->drm =3D NULL; > + drm_encoder_cleanup(&dsi->encoder); > } > =20 > static const struct component_ops sun6i_dsi_ops =3D { > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun= 4i/sun6i_mipi_dsi.h > index c863900ae3b4..61e88ea6044d 100644 > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h > @@ -29,7 +29,6 @@ struct sun6i_dsi { > =20 > struct device *dev; > struct mipi_dsi_device *device; > - struct drm_device *drm; > struct drm_panel *panel; > }; > =20 > --=20 > 2.25.1 >=20 --dtklktu6pvfdrrth Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYbd8nwAKCRDj7w1vZxhR xa2IAQDKg0/jEUlNH114Yz/+szPnC2WdF8T7lNAqer55RzPvUQD/XZLqpvLMfc6u GWbUX8S7T+OhhF5suB8Gif6UIHettQA= =qTVv -----END PGP SIGNATURE----- --dtklktu6pvfdrrth-- --===============3320956722296879525== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3320956722296879525==--