public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: "Huang, Honglei1" <honghuan@amd.com>,
	Alexander.Deucher@amd.com, Felix.Kuehling@amd.com,
	Oak.Zeng@amd.com, Jenny-Jing.Liu@amd.com, Philip.Yang@amd.com,
	Xiaogang.Chen@amd.com, Ray.Huang@amd.com, Lingshan.Zhu@amd.com,
	Junhua.Shen@amd.com, rodrigo.vivi@intel.com,
	thomas.hellstrom@linux.intel.com, dakr@kernel.org,
	aliceryhl@google.com, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFC/POC PATCH 01/12] drm/amdgpu: add SVM UAPI definitions
Date: Tue, 21 Apr 2026 09:13:10 +0200	[thread overview]
Message-ID: <0db79594-c302-4576-a87c-ccab1c3ce326@amd.com> (raw)
In-Reply-To: <aecds3CWc99E1p6q@gsse-cloud1.jf.intel.com>

On 4/21/26 08:48, Matthew Brost wrote:
> On Tue, Apr 21, 2026 at 08:19:54AM +0200, Christian König wrote:
>> On 4/21/26 07:08, Matthew Brost wrote:
>>> On Mon, Apr 20, 2026 at 08:07:38PM +0200, Christian König wrote:
>>>> On 4/20/26 18:06, Matthew Brost wrote:
>>>>> On Mon, Apr 20, 2026 at 05:37:43PM +0200, Christian König wrote:
>>>>>> On 4/20/26 15:30, Huang, Honglei1 wrote:
>>>>>>> On 4/20/2026 8:15 PM, Christian König wrote:
>> ...
>>>> Either you set the information per-device and then each device only gets the information if it needs to migrate the page to it's own local memory or you have global information.
>>>>
>>>> So why does a device fd needs to know about remote pgmap?
>>>>
>>>
>>> Simplest example:
>>>
>>> Devices A and B. The user sets the preferred placement to Device A.
>>> Device B faults first, and Device B moves memory to Device A via remote
>>> pull and can access locally via P2P, scale-up, etc. Avoid a double
>>> bounce once Device A faults.
>>
>> So you basically tell the device as soon as you want to access this VA please push the underlying memory away to a different device?
>>
> 
> Yes. GPU SVM supports remote pulls.
> 
>> I didn't thought that would be a valid use case. As far as I can see the only thing you avoid is updating your page tables on the faulting device twice.
>>
> 
> TBH, I’m unsure if this will happen in practice, but it also seems
> entirely possible. Computers are asynchronous, have random thread
> stalls, etc., so out-of-order from expected access isn’t far-fetched.
> 
> No on 'updating your page tables twice' being only bad thing.
> 
> In my example, let’s say Device B moves memory to itself initially. Then
> Device A faults and tries to move the memory to itself.  
> 
> Bad things:
>  - Two copies (one from sys->Device B, then Device B -> A)
>  - Device B faults again after move to Device A - this stalls B's
>    execution pipeline

Yeah, I mean you can always shoot yourself into the foot if you give different devices contradicting information what to do on access.

But I think for this case you would tell device A to leave the buffer where it is and device B to migrate it locally on access.

So the worst thing which could happen is that device A accesses first, updates it page tables, then device B accesses, page tables of A get invalidated, and page migrated to device B. So at maximum you have one extra page table validation/invalidation.

When you tell both device A and B to migrate to local device memory the page will of course start to play ping/pong between the two devices on access.

The feature doesn't sound that useful, but on the other hand I guess drm_svm has already solved the pgmap lifetime issues resulting from that. So why not?

Thanks,
Christian.

> 
> Matt
> 
>> Thanks for the explanation, that was absolutely not obvious. Going to discuss that with the team on the next meeting.
>>
>> Christian.
>>
>>>
>>> Matt


  reply	other threads:[~2026-04-21  7:13 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 12:07 [RFC V2 00/12] drm/amdgpu: SVM implementation based on drm_gpusvm Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 01/12] drm/amdgpu: add SVM UAPI definitions Honglei Huang
2026-04-20 12:15   ` Christian König
2026-04-20 13:30     ` Huang, Honglei1
2026-04-20 15:37       ` Christian König
2026-04-20 16:06         ` Matthew Brost
2026-04-20 16:28           ` Thomas Hellström
2026-04-20 18:07           ` Christian König
2026-04-21  5:08             ` Matthew Brost
2026-04-21  6:19               ` Christian König
2026-04-21  6:48                 ` Matthew Brost
2026-04-21  7:13                   ` Christian König [this message]
2026-04-21  9:52           ` Huang, Honglei1
2026-04-23  6:21         ` Huang, Honglei1
2026-04-23 10:39           ` Christian König
2026-04-23 11:06             ` Huang, Honglei1
2026-04-23 20:02               ` Matthew Brost
2026-04-24 10:20                 ` Huang, Honglei1
2026-04-24 10:12               ` Huang, Honglei1
2026-04-27 21:05                 ` Felix Kuehling
2026-04-28  2:24                   ` Huang, Honglei1
2026-04-28  6:49                   ` Christian König
2026-04-28  7:00                     ` Huang, Honglei1
2026-04-21  3:37     ` Kuehling, Felix
2026-04-21  6:39       ` Christian König
2026-04-20 12:07 ` [RFC/POC PATCH 02/12] drm/amdgpu: add SVM data structures and header Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 03/12] drm/amdgpu: add SVM attribute data structures Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 04/12] drm/amdgpu: implement SVM attribute tree operations Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 05/12] drm/amdgpu: implement SVM attribute set Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 06/12] drm/amdgpu: add SVM range data structures Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 07/12] drm/amdgpu: implement SVM range PTE flags and GPU mapping Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 08/12] drm/amdgpu: implement SVM range notifier and invalidation Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 09/12] drm/amdgpu: implement SVM range workers Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 10/12] drm/amdgpu: implement SVM core initialization and fini Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 11/12] drm/amdgpu: implement SVM ioctl and fault handler Honglei Huang
2026-04-20 12:07 ` [RFC/POC PATCH 12/12] drm/amdgpu: wire up SVM build system " Honglei Huang
  -- strict thread matches above, loose matches on Subject: below --
2026-03-17 11:29 [RFC/POC PATCH 00/12] POC SVM implementation in AMDGPU based on drm_gpusvm Honglei Huang
2026-03-17 11:29 ` [RFC/POC PATCH 01/12] drm/amdgpu: add SVM UAPI definitions Honglei Huang

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=0db79594-c302-4576-a87c-ccab1c3ce326@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Jenny-Jing.Liu@amd.com \
    --cc=Junhua.Shen@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=aliceryhl@google.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=honghuan@amd.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.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