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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 AC08FC47255 for ; Mon, 11 May 2020 11:23:46 +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 8CB36206D3 for ; Mon, 11 May 2020 11:23:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CB36206D3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de 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 D386B6E437; Mon, 11 May 2020 11:23:45 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D3166E437; Mon, 11 May 2020 11:23:44 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5054DAD73; Mon, 11 May 2020 11:23:45 +0000 (UTC) Subject: Re: [PATCH 5/9] drm/udl: Don't call get/put_pages on imported dma-buf To: Daniel Vetter , DRI Development References: <20200511093554.211493-1-daniel.vetter@ffwll.ch> <20200511093554.211493-6-daniel.vetter@ffwll.ch> From: Thomas Zimmermann Autocrypt: addr=tzimmermann@suse.de; keydata= mQENBFs50uABCADEHPidWt974CaxBVbrIBwqcq/WURinJ3+2WlIrKWspiP83vfZKaXhFYsdg XH47fDVbPPj+d6tQrw5lPQCyqjwrCPYnq3WlIBnGPJ4/jreTL6V+qfKRDlGLWFjZcsrPJGE0 BeB5BbqP5erN1qylK9i3gPoQjXGhpBpQYwRrEyQyjuvk+Ev0K1Jc5tVDeJAuau3TGNgah4Yc hdHm3bkPjz9EErV85RwvImQ1dptvx6s7xzwXTgGAsaYZsL8WCwDaTuqFa1d1jjlaxg6+tZsB 9GluwvIhSezPgnEmimZDkGnZRRSFiGP8yjqTjjWuf0bSj5rUnTGiyLyRZRNGcXmu6hjlABEB AAG0J1Rob21hcyBaaW1tZXJtYW5uIDx0emltbWVybWFubkBzdXNlLmRlPokBVAQTAQgAPhYh BHIX+6yM6c9jRKFo5WgNwR1TC3ojBQJbOdLgAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMB Ah4BAheAAAoJEGgNwR1TC3ojR80H/jH+vYavwQ+TvO8ksXL9JQWc3IFSiGpuSVXLCdg62AmR irxW+qCwNncNQyb9rd30gzdectSkPWL3KSqEResBe24IbA5/jSkPweJasgXtfhuyoeCJ6PXo clQQGKIoFIAEv1s8l0ggPZswvCinegl1diyJXUXmdEJRTWYAtxn/atut1o6Giv6D2qmYbXN7 mneMC5MzlLaJKUtoH7U/IjVw1sx2qtxAZGKVm4RZxPnMCp9E1MAr5t4dP5gJCIiqsdrVqI6i KupZstMxstPU//azmz7ZWWxT0JzgJqZSvPYx/SATeexTYBP47YFyri4jnsty2ErS91E6H8os Bv6pnSn7eAq5AQ0EWznS4AEIAMYmP4M/V+T5RY5at/g7rUdNsLhWv1APYrh9RQefODYHrNRH UE9eosYbT6XMryR9hT8XlGOYRwKWwiQBoWSDiTMo/Xi29jUnn4BXfI2px2DTXwc22LKtLAgT RjP+qbU63Y0xnQN29UGDbYgyyK51DW3H0If2a3JNsheAAK+Xc9baj0LGIc8T9uiEWHBnCH+R dhgATnWWGKdDegUR5BkDfDg5O/FISymJBHx2Dyoklv5g4BzkgqTqwmaYzsl8UxZKvbaxq0zb ehDda8lvhFXodNFMAgTLJlLuDYOGLK2AwbrS3Sp0AEbkpdJBb44qVlGm5bApZouHeJ/+n+7r 12+lqdsAEQEAAYkBPAQYAQgAJhYhBHIX+6yM6c9jRKFo5WgNwR1TC3ojBQJbOdLgAhsMBQkD wmcAAAoJEGgNwR1TC3ojpfcIAInwP5OlcEKokTnHCiDTz4Ony4GnHRP2fXATQZCKxmu4AJY2 h9ifw9Nf2TjCZ6AMvC3thAN0rFDj55N9l4s1CpaDo4J+0fkrHuyNacnT206CeJV1E7NYntxU n+LSiRrOdywn6erjxRi9EYTVLCHcDhBEjKmFZfg4AM4GZMWX1lg0+eHbd5oL1as28WvvI/uI aMyV8RbyXot1r/8QLlWldU3NrTF5p7TMU2y3ZH2mf5suSKHAMtbE4jKJ8ZHFOo3GhLgjVrBW HE9JXO08xKkgD+w6v83+nomsEuf6C6LYrqY/tsZvyEX6zN8CtirPdPWu/VXNRYAl/lat7lSI 3H26qrE= Message-ID: Date: Mon, 11 May 2020 13:23:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200511093554.211493-6-daniel.vetter@ffwll.ch> 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: Sean Paul , Intel Graphics Development , Gerd Hoffmann , Dave Airlie , Alex Deucher , Daniel Vetter , Thomas Gleixner , Sam Ravnborg Content-Type: multipart/mixed; boundary="===============1871850096==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============1871850096== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XcYnzbdU2t5ljZCUOExFvIu9UhQSgzsPM" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XcYnzbdU2t5ljZCUOExFvIu9UhQSgzsPM Content-Type: multipart/mixed; boundary="IBvu5wACIyaWMOulhBzz6ySwVn2qsXCFr"; protected-headers="v1" From: Thomas Zimmermann To: Daniel Vetter , DRI Development Cc: Sam Ravnborg , Intel Graphics Development , Gerd Hoffmann , Daniel Vetter , Alex Deucher , Dave Airlie , Thomas Gleixner , Sean Paul , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= Message-ID: Subject: Re: [PATCH 5/9] drm/udl: Don't call get/put_pages on imported dma-buf References: <20200511093554.211493-1-daniel.vetter@ffwll.ch> <20200511093554.211493-6-daniel.vetter@ffwll.ch> In-Reply-To: <20200511093554.211493-6-daniel.vetter@ffwll.ch> --IBvu5wACIyaWMOulhBzz6ySwVn2qsXCFr Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Am 11.05.20 um 11:35 schrieb Daniel Vetter: > There's no direct harm, because for the shmem helpers these are noops > on imported buffers. The trouble is in the locks these take - I want > to change dma_buf_vmap locking, and so need to make sure that we only > ever take certain locks on one side of the dma-buf interface: Either > for exporters, or for importers. >=20 > Signed-off-by: Daniel Vetter > Cc: Dave Airlie > Cc: Sean Paul > Cc: Gerd Hoffmann > Cc: Thomas Zimmermann > Cc: Alex Deucher > Cc: Daniel Vetter > Cc: Thomas Gleixner > Cc: Sam Ravnborg > --- > drivers/gpu/drm/udl/udl_gem.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) >=20 > diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_ge= m.c > index b6e26f98aa0a..c68d3e265329 100644 > --- a/drivers/gpu/drm/udl/udl_gem.c > +++ b/drivers/gpu/drm/udl/udl_gem.c > @@ -46,29 +46,31 @@ static void *udl_gem_object_vmap(struct drm_gem_obj= ect *obj) It's still not clear to me why this function exists in the first place. It's the same code as the default implementation, except that it doesn't support cached mappings. I don't see why udl is special. I'd suggest to try to use the original shmem function and remove this one. Same for the mmap code. Best regards Thomas > if (shmem->vmap_use_count++ > 0) > goto out; > =20 > - ret =3D drm_gem_shmem_get_pages(shmem); > - if (ret) > - goto err_zero_use; > - > - if (obj->import_attach) > + if (obj->import_attach) { > shmem->vaddr =3D dma_buf_vmap(obj->import_attach->dmabuf); > - else > + } else { > + ret =3D drm_gem_shmem_get_pages(shmem); > + if (ret) > + goto err; > + > shmem->vaddr =3D vmap(shmem->pages, obj->size >> PAGE_SHIFT, > VM_MAP, PAGE_KERNEL); > =20 > + if (!shmem->vaddr) > + drm_gem_shmem_put_pages(shmem); > + } > + > if (!shmem->vaddr) { > DRM_DEBUG_KMS("Failed to vmap pages\n"); > ret =3D -ENOMEM; > - goto err_put_pages; > + goto err; > } > =20 > out: > mutex_unlock(&shmem->vmap_lock); > return shmem->vaddr; > =20 > -err_put_pages: > - drm_gem_shmem_put_pages(shmem); > -err_zero_use: > +err: > shmem->vmap_use_count =3D 0; > mutex_unlock(&shmem->vmap_lock); > return ERR_PTR(ret); >=20 --=20 Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany (HRB 36809, AG N=C3=BCrnberg) Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6rffer --IBvu5wACIyaWMOulhBzz6ySwVn2qsXCFr-- --XcYnzbdU2t5ljZCUOExFvIu9UhQSgzsPM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAl65NboACgkQaA3BHVML eiNARggAkSI2L/Mppte+wpGtVyiDpHM1i5ql+7bgugbtVmHEm+Ol2h+MBDAI6CLj XszK5gwBRIdIM0jHTQ3QAdoUAP3ikXlR5yweOxfB09csbyytgG59X6F4tm7qH8mm BkzuB4V5ysPHn/JtGWychI3Mjy8oSKAtTt3v0hnEvL2FIO6TdCiBJS26NpEfOSHS yxWOvyreGW+MM9IH9IwPanJ7gFXiUOyEZSKOAFOsW7Po6hs7vCs+XQeogoX8Tc0g G0+3csVBkKTU0MIU3uV9piJLXCnyo0xynbK+N7hsydsiE3GvAg4hKzFo8XTGuojR HsNH1RZwFD5ba/AXDSJTtCnz8o/3fA== =iRn8 -----END PGP SIGNATURE----- --XcYnzbdU2t5ljZCUOExFvIu9UhQSgzsPM-- --===============1871850096== 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 --===============1871850096==--