AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Junhua Shen <Junhua.Shen@amd.com>
To: <Alexander.Deucher@amd.com>, <Felix.Kuehling@amd.com>,
	<Christian.Koenig@amd.com>, <Oak.Zeng@amd.com>,
	<Jenny-Jing.Liu@amd.com>, <Philip.Yang@amd.com>,
	<Xiaogang.Chen@amd.com>, <Ray.Huang@amd.com>,
	<honglei1.huang@amd.com>, <Lingshan.Zhu@amd.com>
Cc: <amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	Junhua Shen <Junhua.Shen@amd.com>
Subject: [PATCH v3 0/5] drm/amdgpu: SVM VRAM migration via drm_pagemap
Date: Mon, 27 Apr 2026 18:05:17 +0800	[thread overview]
Message-ID: <20260427100522.7014-1-Junhua.Shen@amd.com> (raw)

This series adds VRAM migration support to the amdgpu SVM (Shared
Virtual Memory) subsystem, built on top of the drm_pagemap
infrastructure [1].

It enables transparent page migration between system RAM and device
VRAM using SDMA, driven by userspace SVM attribute hints (prefetch
location, access attributes) through the existing AMDGPU SVM ioctl
interface.

Limitations:

  - Single GPU only; multi-GPU migration is not addressed
  - No XNACK-on GPU fault-driven migration (XNACK-off ioctl
    path only)
  - No VRAM-to-VRAM (peer GPU) migration
  - No eviction fence / VRAM overcommit handling yet

Design highlights:
  - ZONE_DEVICE pages managed via devm_memremap_pages / drm_pagemap
  - SDMA-based migration with proper DMA fence synchronization
  - Migration decision layer that evaluates SVM attributes to
    determine when and where to migrate
  - Zero modifications to the KFD subsystem

Patch breakdown:
  1. Core VRAM migration infrastructure (ZONE_DEVICE, drm_pagemap_ops)
  2. SDMA migration callbacks (copy_to_ram / copy_to_dev)
  3. Migration decision layer (policy evaluation)
  4. SVM attribute extensions (prefetch force-trigger)
  5. Integration into SVM range map path + ZONE_DEVICE registration

Built on top of the drm_pagemap SVM series [1].

Changes since v2:
  - Moved amdgpu_pagemap entirely to amdgpu side, eliminating all KFD
    modifications
  - Split commits for better reviewability: separated infrastructure
    from SDMA callbacks, decision layer from integration
  - Merged ZONE_DEVICE registration hook into the integration patch

Changes since v1:
  - Dropped the eviction fence patch per Christian König's review
    (violates dma_fence contract)

[1] https://lore.kernel.org/all/20260317-drm-svm-v2-0-4bceef04e41e@amd.com/
v1: https://lore.kernel.org/all/20260410113146.146212-1-Junhua.Shen@amd.com/
v2: https://lore.kernel.org/all/20260413103031.181953-1-Junhua.Shen@amd.com/

Junhua Shen (5):
  drm/amdgpu: add VRAM migration infrastructure for drm_pagemap
  drm/amdgpu: implement drm_pagemap SDMA migration callbacks
  drm/amdgpu: introduce SVM range migration decision layer
  drm/amdgpu: add SVM attr prefetch/force-trigger functionality
  drm/amdgpu: integrate VRAM migration into SVM range map path

 drivers/gpu/drm/amd/amdgpu/Makefile           |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |   4 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_migrate.c   | 789 ++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_migrate.h   |  98 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c     |   4 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_svm.c       |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_svm_attr.c  |  34 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_svm_range.c | 136 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_svm_range.h |   5 +-
 .../drm/amd/amdgpu/amdgpu_svm_range_migrate.c | 140 ++++
 .../drm/amd/amdgpu/amdgpu_svm_range_migrate.h |  60 ++
 12 files changed, 1212 insertions(+), 76 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_migrate.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_migrate.h
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_svm_range_migrate.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_svm_range_migrate.h

-- 
2.34.1


             reply	other threads:[~2026-04-27 10:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 10:05 Junhua Shen [this message]
2026-04-27 10:05 ` [PATCH v3 1/5] drm/amdgpu: add VRAM migration infrastructure for drm_pagemap Junhua Shen
2026-04-27 10:05 ` [PATCH v3 2/5] drm/amdgpu: implement drm_pagemap SDMA migration callbacks Junhua Shen
2026-04-27 22:20   ` Felix Kuehling
2026-04-28  7:39     ` Junhua Shen
2026-04-27 10:05 ` [PATCH v3 3/5] drm/amdgpu: introduce SVM range migration decision layer Junhua Shen
2026-04-27 10:05 ` [PATCH v3 4/5] drm/amdgpu: add SVM attr prefetch/force-trigger functionality Junhua Shen
2026-04-27 10:05 ` [PATCH v3 5/5] drm/amdgpu: integrate VRAM migration into SVM range map path Junhua Shen

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=20260427100522.7014-1-Junhua.Shen@amd.com \
    --to=junhua.shen@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Jenny-Jing.Liu@amd.com \
    --cc=Lingshan.Zhu@amd.com \
    --cc=Oak.Zeng@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=Xiaogang.Chen@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=honglei1.huang@amd.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