[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230928141945.36dd44df@collabora.com>
Date: Thu, 28 Sep 2023 14:19:45 +0200
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Danilo Krummrich <dakr@...hat.com>
Cc: airlied@...il.com, daniel@...ll.ch, matthew.brost@...el.com,
thomas.hellstrom@...ux.intel.com, sarah.walker@...tec.com,
donald.robson@...tec.com, christian.koenig@....com,
faith.ekstrand@...labora.com, dri-devel@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH drm-misc-next v4 6/8] drm/gpuvm: add drm_gpuvm_flags to
drm_gpuvm
On Wed, 27 Sep 2023 18:52:55 +0200
Danilo Krummrich <dakr@...hat.com> wrote:
> On 9/22/23 13:58, Boris Brezillon wrote:
> > On Wed, 20 Sep 2023 16:42:39 +0200
> > Danilo Krummrich <dakr@...hat.com> 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.
Powered by blists - more mailing lists