All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Alistair Popple <apopple@nvidia.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	himal.prasad.ghimiray@intel.com, airlied@gmail.com,
	"Simona Vetter" <simona.vetter@ffwll.ch>,
	"Felix Kühling" <felix.kuehling@amd.com>,
	"Philip Yang" <philip.yang@amd.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Christian König" <christian.koenig@amd.com>,
	dakr@kernel.org, "Mrozek, Michal" <michal.mrozek@intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>
Subject: Re: [PATCH v5 0/3] drm/gpusvm, drm/pagemap, drm/xe: Restructure migration in preparation for multi-device
Date: Mon, 23 Jun 2025 11:54:36 +0200	[thread overview]
Message-ID: <4583eee781d5fb01bf4e4259b4fefd41095f43d4.camel@linux.intel.com> (raw)
In-Reply-To: <9c6e76eb893ec6076812e01f90724f0fba358c0e.camel@linux.intel.com>

Hi, Alistair,

On Thu, 2025-06-19 at 12:07 +0200, Thomas Hellström wrote:
> 
> Hi, Alistair, Thanks for having a look!

That patch series is ready to be merged. Do you have any outstanding
concerns?

Thanks,
Thomas



> 
> On Thu, 2025-06-19 at 14:52 +1000, Alistair Popple wrote:
> > On Wed, Jun 18, 2025 at 10:16:14PM +0200, Thomas Hellström wrote:
> > > This patchset modifies the migration part of drm_gpusvm to
> > > drm_pagemap and
> > > adds a populate_mm() op to drm_pagemap.
> > > 
> > > The idea is that the device that receives a pagefault determines
> > > if
> > > it wants to
> > > migrate content and to where. It then calls the populate_mm()
> > > method of relevant
> > > drm_pagemap.
> > > 
> > > This functionality was mostly already in place, but hard-coded
> > > for
> > > xe only without
> > > going through a pagemap op. Since we might be dealing with
> > > separate
> > > devices moving
> > > forward, it also now becomes the responsibilit of the
> > > populate_mm()
> > > op to
> > > grab any necessary local device runtime pm references and keep
> > > them
> > > held while
> > > its pages are present in an mm (struct mm_struct).
> > > 
> > > On thing to decide here is whether the populate_mm() callback
> > > should sit on a
> > > struct drm_pagemap for now while we sort multi-device usability
> > > out
> > > or whether
> > > we should add it (or something equivalent) to struct dev_pagemap.
> > 
> > I'm still looking at this series (sorry it took until v5 for me to
> > notice
> > it!) but my immediate reaction here is why do/would you need to add
> > anything
> > to struct dev_pagemap? The common approach here has been to embed
> > struct
> > dev_pagemap in some driver defined struct and use container_of to
> > go
> > from the
> > page to the driver (or in this case DRM) specific pagemap.
> > 
> > See for example dmirror_page_to_chunk() in the HMM self test or
> > nouveau_page_to_chunk(). Is there some reason something like that
> > would work
> > here?
> 
> Future patches will, as they are currently written, do something like
> this for embedding:
> 
> struct xe_pagemap {
> 	struct dev_pagemap pagemap;
> 	struct drm_pagemap dpagemap;
> };
> 
> So that the drm_pagemap can be obtained that way. The reason for that
> is to avoid diamond inheritance if the driver wanted to embed a
> pcie_p2p pagemap instead of a struct dev_pagemap. But if that becomes
> unlikely we could of course embed the dev_pagemap directly into the
> drm_pagemap.
> 
> 
> > 
> > Actually I notice the Xe driver currently does use this to point to
> > a
> > struct
> > xe_vram_region which contains drm_pagemap pointer. If I understand
> > correctly
> > we're trying to move a lot of the SVM functionality into a generic
> > DRM layer,
> > so would it make more sense to have dev_pgmap embeded in drm_pgmap
> > and have that
> > contain the pointer to any required driver-specific data?
> > 
> > Also FWIW I don't think zone_device_data is strictly required. It's
> > convenient,
> > but I suspect it only exists because it could be easily provided
> > within the
> > footprint of the existing struct page due to not using all the
> > fields
> > for
> > ZONE_DEVICE pages. I can imagine we might eventually remove it,
> > once
> > we no
> > longer need struct pages and move to folios/memdescs.
> 
> It looks like, correct me if I'm wrong, like the nouveau version has
> one dev_pagemap per bo. The code at hand here use multiple bos for
> the
> memory of a single pagemap so in essence the zone_device_data
> provides
> a pointer to the bo used for that particular page. If we lose the
> zone_device_data there is probably other ways we can do that
> backwards
> lookup, but it may become nasty.
> 
> So while I fully agree we should use some form of embedding of the
> dev_pagemap, and that could be the authoritative way to go from a
> page
> to a drm_pagemap, that is not really sufficient to go from a page to
> a
> bo.
> 
> But more on this in upcoming multi-device patches. This series is
> mostly about separating the drm_gpusvm (GPU mapping) and
> drm_pagemap(migration) functionality that is already i place.
> 
> But please let me know if there are any concerns with this.
> 
> Thanks,
> Thomas
> 
> 
> > 
> > > v2:
> > > - Rebase.
> > > v3:
> > > - Documentation updates (CI, Matt Brost)
> > > - Don't change TTM buffer object type for VRAM allocations (Matt
> > > Brost)
> > > v4:
> > > - Documentation Updates (Himal Ghimiray, Matt Brost)
> > > - Add an assert (Matt Brost)
> > > v5:
> > > - Rebase
> > > - Add R-Bs and SOBs.
> > > 
> > > Matthew Brost (1):
> > >   drm/gpusvm, drm/pagemap: Move migration functionality to
> > > drm_pagemap
> > > 
> > > Thomas Hellström (2):
> > >   drm/pagemap: Add a populate_mm op
> > >   drm/xe: Implement and use the drm_pagemap populate_mm op
> > > 
> > >  Documentation/gpu/rfc/gpusvm.rst     |  12 +-
> > >  drivers/gpu/drm/Makefile             |   6 +-
> > >  drivers/gpu/drm/drm_gpusvm.c         | 761 +--------------------
> > > --
> > > -
> > >  drivers/gpu/drm/drm_pagemap.c        | 838
> > > +++++++++++++++++++++++++++
> > >  drivers/gpu/drm/xe/Kconfig           |  10 +-
> > >  drivers/gpu/drm/xe/xe_bo_types.h     |   2 +-
> > >  drivers/gpu/drm/xe/xe_device_types.h |   2 +-
> > >  drivers/gpu/drm/xe/xe_svm.c          | 125 ++--
> > >  drivers/gpu/drm/xe/xe_svm.h          |  10 +-
> > >  drivers/gpu/drm/xe/xe_tile.h         |  11 +
> > >  drivers/gpu/drm/xe/xe_vm.c           |   2 +-
> > >  include/drm/drm_gpusvm.h             |  96 ---
> > >  include/drm/drm_pagemap.h            | 135 +++++
> > >  13 files changed, 1098 insertions(+), 912 deletions(-)
> > >  create mode 100644 drivers/gpu/drm/drm_pagemap.c
> > > 
> > > -- 
> > > 2.49.0
> > > 
> 


  reply	other threads:[~2025-06-23  9:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 20:16 [PATCH v5 0/3] drm/gpusvm, drm/pagemap, drm/xe: Restructure migration in preparation for multi-device Thomas Hellström
2025-06-18 20:16 ` [PATCH v5 1/3] drm/gpusvm, drm/pagemap: Move migration functionality to drm_pagemap Thomas Hellström
2025-06-18 20:16 ` [PATCH v5 2/3] drm/pagemap: Add a populate_mm op Thomas Hellström
2025-06-18 20:16 ` [PATCH v5 3/3] drm/xe: Implement and use the drm_pagemap " Thomas Hellström
2025-06-18 20:23 ` ✗ CI.checkpatch: warning for drm/gpusvm, drm/pagemap, drm/xe: Restructure migration in preparation for multi-device (rev5) Patchwork
2025-06-18 20:24 ` ✓ CI.KUnit: success " Patchwork
2025-06-18 21:01 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-19  4:52 ` [PATCH v5 0/3] drm/gpusvm, drm/pagemap, drm/xe: Restructure migration in preparation for multi-device Alistair Popple
2025-06-19 10:07   ` Thomas Hellström
2025-06-23  9:54     ` Thomas Hellström [this message]
2025-06-19 10:20 ` ✗ Xe.CI.Full: failure for drm/gpusvm, drm/pagemap, drm/xe: Restructure migration in preparation for multi-device (rev5) Patchwork

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=4583eee781d5fb01bf4e4259b4fefd41095f43d4.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=apopple@nvidia.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=michal.mrozek@intel.com \
    --cc=philip.yang@amd.com \
    --cc=simona.vetter@ffwll.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.