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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7E223C54E58 for ; Tue, 12 Mar 2024 13:09:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9873112E09; Tue, 12 Mar 2024 13:09:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="XHxZlxDY"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69A7C112E0C for ; Tue, 12 Mar 2024 13:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=StjC2vYSMMtZevQTB+aDJBWNx2X2BTnIUrUn6XgVG64=; b=XHxZlxDYoIk6HG5gxxGJyyEBCy ft9laPX5zJX11MzgZhV9LIGZe2xmOerZLgaeVRj4e95Vn1X6LoISwrGGaA3doOsplb4pAtBks0wuQ F/N/oLhnMYJBNmgtFv4PYZyjrGhP2xZmOtSFNmzDtCLJa/6/+vMhdk0xCiDvmE/csURcspgBjXaS2 kpBR4dZva+27pDthdbdoOiLP8k2B9VMFG8MbrYmApB3n1TZnKI7VRUaZ9jwvc3xL/OgARAdxI1LBq vJqKYVdlaPx04sFm0W4QR+PSpfMHsoNkaKbFXK1kDrJ43dtDQtQ3pVAE7fofnUNaHS4/eGnWC9MnL tbANlzvA==; Received: from [84.65.0.132] (helo=[192.168.0.101]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1rk1se-009KGM-S9; Tue, 12 Mar 2024 14:09:20 +0100 Message-ID: Date: Tue, 12 Mar 2024 13:09:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/5] drm/gem: Add a mountpoint parameter to drm_gem_object_init() Content-Language: en-GB To: =?UTF-8?Q?Christian_K=C3=B6nig?= , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Melissa Wen , Iago Toral , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, kernel-dev@igalia.com, Russell King , Lucas Stach , Christian Gmeiner , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Patrik Jakobsson , Sui Jingfeng , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Karol Herbst , Lyude Paul , Danilo Krummrich , Tomi Valkeinen , Gerd Hoffmann , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Andy Yan , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Huang Rui , Oleksandr Andrushchenko , Karolina Stolarek , Andi Shyti References: <20240311100959.205545-1-mcanal@igalia.com> <20240311100959.205545-3-mcanal@igalia.com> <30a7f20b-1f2c-41cb-b193-03429c160b63@igalia.com> <3a5d07c0-120f-47f9-a35a-31f3bfcc9330@amd.com> <07885e3b-ee7b-456b-9fad-17d9009a4cb7@igalia.com> <69576e6d-9704-42b9-905f-289f9f9017b9@amd.com> From: Tvrtko Ursulin In-Reply-To: <69576e6d-9704-42b9-905f-289f9f9017b9@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 12/03/2024 10:37, Christian König wrote: > Am 12.03.24 um 11:31 schrieb Tvrtko Ursulin: >> >> On 12/03/2024 10:23, Christian König wrote: >>> Am 12.03.24 um 10:30 schrieb Tvrtko Ursulin: >>>> >>>> On 12/03/2024 08:59, Christian König wrote: >>>>> Am 12.03.24 um 09:51 schrieb Tvrtko Ursulin: >>>>>> >>>>>> Hi Maira, >>>>>> >>>>>> On 11/03/2024 10:05, Maíra Canal wrote: >>>>>>> For some applications, such as using huge pages, we might want to >>>>>>> have a >>>>>>> different mountpoint, for which we pass in mount flags that >>>>>>> better match >>>>>>> our usecase. >>>>>>> >>>>>>> Therefore, add a new parameter to drm_gem_object_init() that >>>>>>> allow us to >>>>>>> define the tmpfs mountpoint where the GEM object will be created. If >>>>>>> this parameter is NULL, then we fallback to shmem_file_setup(). >>>>>> >>>>>> One strategy for reducing churn, and so the number of drivers this >>>>>> patch touches, could be to add a lower level drm_gem_object_init() >>>>>> (which takes vfsmount, call it __drm_gem_object_init(), or >>>>>> drm__gem_object_init_mnt(), and make drm_gem_object_init() call >>>>>> that one with a NULL argument. >>>>> >>>>> I would even go a step further into the other direction. The shmem >>>>> backed GEM object is just some special handling as far as I can see. >>>>> >>>>> So I would rather suggest to rename all drm_gem_* function which >>>>> only deal with the shmem backed GEM object into drm_gem_shmem_*. >>>> >>>> That makes sense although it would be very churny. I at least would >>>> be on the fence regarding the cost vs benefit. >>> >>> Yeah, it should clearly not be part of this patch here. >>> >>>> >>>>> Also the explanation why a different mount point helps with >>>>> something isn't very satisfying. >>>> >>>> Not satisfying as you think it is not detailed enough to say driver >>>> wants to use huge pages for performance? Or not satisying as you >>>> question why huge pages would help? >>> >>> That huge pages are beneficial is clear to me, but I'm missing the >>> connection why a different mount point helps with using huge pages. >> >> Ah right, same as in i915, one needs to mount a tmpfs instance passing >> huge=within_size or huge=always option. Default is 'never', see man 5 >> tmpfs. > > Thanks for the explanation, I wasn't aware of that. > > Mhm, shouldn't we always use huge pages? Is there a reason for a DRM > device to not use huge pages with the shmem backend? AFAIU, according to b901bb89324a ("drm/i915/gemfs: enable THP"), back then the understanding was within_size may overallocate, meaning there would be some space wastage, until the memory pressure makes the thp code split the trailing huge page. I haven't checked if that still applies. Other than that I don't know if some drivers/platforms could have problems if they have some limitations or hardcoded assumptions when they iterate the sg list. Te Cc is plenty large so perhaps someone else will have additional information. :) Regards, Tvrtko > > I mean it would make this patch here even smaller. > > Regards, > Christian. > >> >> >> Regards, >> >> Tvrtko >