Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4D13C433DB for ; Fri, 26 Feb 2021 20:33:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35D1F601FB for ; Fri, 26 Feb 2021 20:33:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35D1F601FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63AE86E0D4; Fri, 26 Feb 2021 20:33:18 +0000 (UTC) Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B2296E0D4 for ; Fri, 26 Feb 2021 20:33:16 +0000 (UTC) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 29B5B1C0B8A; Fri, 26 Feb 2021 21:33:13 +0100 (CET) Date: Fri, 26 Feb 2021 21:33:12 +0100 From: Pavel Machek To: Daniel Vetter Subject: Re: [PATCH v5] drm: Use USB controller's DMA mask when importing dmabufs Message-ID: <20210226203312.GA3379@duo.ucw.cz> References: <20210226092648.4584-1-tzimmermann@suse.de> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, gregkh@linuxfoundation.org, Christoph Hellwig , hdegoede@redhat.com, stern@rowland.harvard.edu, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Daniel Vetter , stable@vger.kernel.org, sean@poorly.run, christian.koenig@amd.com Content-Type: multipart/mixed; boundary="===============1161214712==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============1161214712== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > + struct device *dmadev; > > + struct drm_gem_object *obj; > > + > > + if (!dev_is_usb(dev->dev)) > > + return ERR_PTR(-ENODEV); > > + > > + dmadev =3D usb_intf_get_dma_device(to_usb_interface(dev->dev)); > > + if (drm_WARN_ONCE(dev, !dmadev, "buffer sharing not supported")) > > + return ERR_PTR(-ENODEV); > > + > > + obj =3D drm_gem_prime_import_dev(dev, dma_buf, dmadev); > > + > > + put_device(dmadev); >=20 > Just realized there's another can of worms here because dma_buf_attach > does not refcount the struct device. But the dma_buf can easily outlive > the underlying device, at least right now. >=20 > We should probably require that devices get rid of all their mappings in > their hotunplug code. >=20 > Ofc now that we pick some random other device struct this gets kinda > worse. >=20 > Anyway, also just another pre-existing condition that we should worry > about here. It's all still a very bad hack. This is actually regression fix if I understand this correctly. Bug means udl is unusable, so that's kind of bad. Should we revert the original commit causing this while this get sorted out? Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --FCuugMFkClbJLl1L Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYDlbCAAKCRAw5/Bqldv6 8j4pAJ4pMO1Nkx0d7xHie+0D2+0Scx6kHgCeOO4KKjPOZuK7ZRg1nTfB7wz7+Rc= =n8h1 -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L-- --===============1161214712== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1161214712==--