public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Danilo Krummrich <dakr@redhat.com>
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
Date: Thu, 28 Sep 2023 14:19:45 +0200	[thread overview]
Message-ID: <20230928141945.36dd44df@collabora.com> (raw)
In-Reply-To: <810dc476-8ead-19e6-23fc-0f9cf35ba2b2@redhat.com>

On Wed, 27 Sep 2023 18:52:55 +0200
Danilo Krummrich <dakr@redhat.com> wrote:

> On 9/22/23 13:58, Boris Brezillon wrote:
> > On Wed, 20 Sep 2023 16:42:39 +0200
> > Danilo Krummrich <dakr@redhat.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.

  reply	other threads:[~2023-09-28 12:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 14:42 [PATCH drm-misc-next v4 0/8] [RFC] DRM GPUVA Manager GPU-VM features Danilo Krummrich
2023-09-20 14:42 ` [PATCH drm-misc-next v4 1/8] drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm Danilo Krummrich
2023-09-21  6:48   ` Christian König
2023-09-25  0:42     ` Dave Airlie
2023-09-20 14:42 ` [PATCH drm-misc-next v4 2/8] drm/gpuvm: allow building as module Danilo Krummrich
2023-09-25  0:42   ` Dave Airlie
2023-09-20 14:42 ` [PATCH drm-misc-next v4 3/8] drm/nouveau: uvmm: rename 'umgr' to 'base' Danilo Krummrich
2023-09-25  0:43   ` Dave Airlie
2023-09-20 14:42 ` [PATCH drm-misc-next v4 4/8] drm/gpuvm: add common dma-resv per struct drm_gpuvm Danilo Krummrich
2023-09-21  7:39   ` Christian König
2023-09-21 13:34     ` Danilo Krummrich
2023-09-21 14:21       ` Christian König
2023-09-21 14:25       ` Boris Brezillon
2023-09-21 14:34         ` Christian König
2023-09-21 15:27           ` Boris Brezillon
2023-09-21 15:30           ` Danilo Krummrich
2023-09-21 14:38         ` Danilo Krummrich
2023-09-20 14:42 ` [PATCH drm-misc-next v4 5/8] drm/gpuvm: add an abstraction for a VM / BO combination Danilo Krummrich
2023-09-20 14:42 ` [PATCH drm-misc-next v4 6/8] drm/gpuvm: add drm_gpuvm_flags to drm_gpuvm Danilo Krummrich
2023-09-20 16:40   ` kernel test robot
2023-09-22 11:42   ` Boris Brezillon
2023-09-22 11:58   ` Boris Brezillon
2023-09-27 16:52     ` Danilo Krummrich
2023-09-28 12:19       ` Boris Brezillon [this message]
2023-09-20 14:42 ` [PATCH drm-misc-next v4 7/8] drm/gpuvm: generalize dma_resv/extobj handling and GEM validation Danilo Krummrich
2023-09-22 11:45   ` Boris Brezillon
2023-09-27 16:59     ` Danilo Krummrich
2023-09-20 14:42 ` [PATCH drm-misc-next v4 8/8] drm/nouveau: GPUVM dma-resv/extobj handling, " Danilo Krummrich
2023-09-28 12:09 ` [PATCH drm-misc-next v4 0/8] [RFC] DRM GPUVA Manager GPU-VM features Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230928141945.36dd44df@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=airlied@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=donald.robson@imgtec.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith.ekstrand@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=sarah.walker@imgtec.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox