Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3183952rdh; Thu, 28 Sep 2023 05:20:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGphfxcFx5NM8mgCMcPe6P9geW/96j0DaVm0T6R6DAzRIztv+/NSRfCEVCALtdxV6nmy4pa X-Received: by 2002:a05:6358:52cf:b0:13c:ee28:2323 with SMTP id z15-20020a05635852cf00b0013cee282323mr1237181rwz.16.1695903608814; Thu, 28 Sep 2023 05:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695903608; cv=none; d=google.com; s=arc-20160816; b=gagLaPgES01l4H8bcwLNma41CCvlHx9YE7JboBCli4LkCFl/QQKhx5FbGZJ30e7eSE iL9zqVUb0XVbrocP6LB6l+JkFyD2MerH/QzsAmaYfBjcrTHD/0qux9I5cXVxq5NwiFSD ya3DufSi5gWp/4wEKCRJDkjuPR15b6Ee1mcWh97d/SXQmOqVYSJVxFkduxeTXwSr7GDR mY+IJRDBb4Z0z31o1K6W3fGZImiEiu2DbjEYxc1ghgjefyzK0/pxVxFfJuG9adEla591 1ANeU4OwtSXpJVcIkweZv6O3J/1yHnyHPdWy2mj9nMlFXmTtq/AVWReasBmbYNTJQ3aP NByg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Kmp+K6sNfYtz1KGTjyqDOZ1sOg0lzfXnYHiRj8vBvoQ=; fh=stmSkAvucvK5TkBdnwJhqOsIY+3LxKSNU/hD0a8xyRw=; b=FJcJOZOQAc29MuGaQpifrgiAYvOMHWXtBDtnlMLtDgoqD4W2p8Dhf7gFYxBNecpgDL DWyhx9Loh4UYbjKR1qpMGDvVtj3ijosH25L52Qwu7pBy21CR2VX60Xc/XsNAKKuBCWIP Jd1ZwxwcxYg6C1fSKSq21bKUZARDHzvnltMZqzZ2crqJOy5NWqmaVqTZDv3ibUvoSNFG 7Gk363i822QoiPxbLh0z94DAZWUPNiGmxx2uvkDW0xn43hVMRhEazNWsiEtM1f4GuEVm yn+yRaQ5xi2GlyBI2Jiwc4VtIa79q3xyz8RO0eyizhJzojICOT7CH6MqivWUXcvvZg8R rKNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nKI1xG+7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id cp11-20020a056a00348b00b0068fbd15c036si18435954pfb.286.2023.09.28.05.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 05:20:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nKI1xG+7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1EE2E83271C2; Thu, 28 Sep 2023 05:20:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbjI1MTz (ORCPT + 99 others); Thu, 28 Sep 2023 08:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbjI1MTz (ORCPT ); Thu, 28 Sep 2023 08:19:55 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87536193 for ; Thu, 28 Sep 2023 05:19:50 -0700 (PDT) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by madras.collabora.co.uk (Postfix) with ESMTPSA id 091AA6607258; Thu, 28 Sep 2023 13:19:48 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695903588; bh=FlxWm0KO/95SNT5YlRUVZt9iSvcyPyiN3E49R6C5oI0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nKI1xG+7fRFRRrjVsNsL1PE/UgVNPargbDyDTpeYOhqaQx0gqX9SdykZWHBgp/bmo wTu3SYPUp8sOGb/v6J9FuQNa5MGjgOzDvFawZ7TJi2u6YTI94CFx253rMlMWhYQgZg aQxYLZn+IoMCt3RW3iHMvJcRa7+sAeTCfRPFHf59Lh9vzB6R5i00GO7HnW0VCcmeEg ffuDvXoU6I+oKslkmWXpM7lh16u03wIcGeLMrVcD7IphfBJ1ivCg/Xb8l0c1n4jdFf CcGcOnTkY42oPENN84NdDb8vuHlhshqoa+hkCk94Rl+f7XmhS6oXgoseaQYNuh9UfC iIHF721Nnt/8w== Date: Thu, 28 Sep 2023 14:19:45 +0200 From: Boris Brezillon To: Danilo Krummrich Cc: airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com, thomas.hellstrom@linux.intel.com, sarah.walker@imgtec.com, donald.robson@imgtec.com, christian.koenig@amd.com, faith.ekstrand@collabora.com, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH drm-misc-next v4 6/8] drm/gpuvm: add drm_gpuvm_flags to drm_gpuvm Message-ID: <20230928141945.36dd44df@collabora.com> In-Reply-To: <810dc476-8ead-19e6-23fc-0f9cf35ba2b2@redhat.com> References: <20230920144343.64830-1-dakr@redhat.com> <20230920144343.64830-7-dakr@redhat.com> <20230922135842.242c865d@collabora.com> <810dc476-8ead-19e6-23fc-0f9cf35ba2b2@redhat.com> Organization: Collabora X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 05:20:06 -0700 (PDT) On Wed, 27 Sep 2023 18:52:55 +0200 Danilo Krummrich wrote: > On 9/22/23 13:58, Boris Brezillon wrote: > > On Wed, 20 Sep 2023 16:42:39 +0200 > > Danilo Krummrich wrote: > > > >> +/** > >> + * enum drm_gpuvm_flags - flags for struct drm_gpuvm > >> + */ > >> +enum drm_gpuvm_flags { > >> + /** > >> + * @DRM_GPUVM_USERBITS: user defined bits > >> + */ > >> + DRM_GPUVM_USERBITS = (1 << 0), > > > > Nit: I tried declaring driver-specific flags, and I find this > > counter-intuitive. You basically end up with something like: > > > > enum my_gpuvm_flags { > > MY_FLAG_X = DRM_GPUVM_USERBITS, > > MY_FLAG_Y = DRM_GPUVM_USERBITS << 1, > > }; > > > > instead of the usual > > > > enum my_gpuvm_flags { > > MY_FLAG_X = BIT(0), > > MY_FLAG_Y = BIT(1), > > }; > > > > pattern. > > Right, same as with dma_fence flags. > > > > > Another issue I see coming is if we end up adding more core flags and > > drivers start falling short of bits for their own flags. This makes me > > wonder if we shouldn't kill this notion of USER flags and let drivers > > store their flags in some dedicated field, given they're likely to > > derive drm_gpuvm and drm_gpuva with their own object anyway. > > The only reason I have this in the code is that Xe asked for this with > drm_gpuva_flags. Hence, for consistency reasons I added it for drm_gpuvm_flags > too. Yeah, my comment stands for both drm_gpuva_flags and drm_gpuvm_flags actually. > > Drivers can still have their own flag fields if needed, otherwise I guess it > doesn't really hurt to keep DRM_GPUVM_USERBITS in case someone wants to use it. Sure, it doesn't hurt, but given drivers are inheriting from this object anyway, I thought it'd be simpler/more future proof to let them have their flags in a separate field. It's not like we care about saving 4 bytes in such a big object. Might be a bit different for drm_gpuva given the amount of live mappings one VM might have, but even there, I suspect the current drm_gpuva size is going to hurt if we have millions of 4k mappings, so, four more bytes won't make a huge difference... Anyway, I don't think that's a blocker, I just thought I'd mention it, that's all.