From: Matthew Brost <matthew.brost@intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Matthew Auld <matthew.auld@intel.com>,
Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Subject: Re: [PATCH 1/2] drm/xe/svm: Ensure data will be migrated to system if indicated by madvise.
Date: Wed, 8 Oct 2025 04:55:53 -0700 [thread overview]
Message-ID: <aOZRSSIpTVIXuYPi@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <aOZOMRbYFsJlaSSP@lstrano-desk.jf.intel.com>
On Wed, Oct 08, 2025 at 04:42:41AM -0700, Matthew Brost wrote:
> On Wed, Oct 08, 2025 at 01:10:49PM +0200, Thomas Hellström wrote:
> > If the location madvise() is set to
> > DRM_XE_PREFERRED_LOC_DEFAULT_SYSTEM, the drm_pagemap in the
> > SVM gpu fault handler will be set to NULL. However there is nothing
> > that explicitly migrates the data to system if it is already present
> > in device memory.
> >
> > In that case, set the device memory owner to NULL to ensure
> > data gets properly migrated to system on page-fault.
> >
> > Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_svm.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> > index 7e2db71ff34e..fd906eb03d71 100644
> > --- a/drivers/gpu/drm/xe/xe_svm.c
> > +++ b/drivers/gpu/drm/xe/xe_svm.c
> > @@ -1034,6 +1034,9 @@ static int __xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
> > if (err)
> > return err;
> >
> > + dpagemap = xe_vma_resolve_pagemap(vma, tile);
> > + if (!dpagemap && !ctx.devmem_only)
> > + ctx.device_private_page_owner = NULL;
>
> I think xe_svm_range_is_valid below can still make the page fault
> handler bail out if the memory is in valid in VRAM. That a really odd
> case but maybe it needs to be handled?
>
> What certainly needs to be handled in xe_svm_range_is_valid is if system
> is the preferred placement, the range has mappings, and is in system. If
> we get page fault storms on system memory address every fault will issue
> a rebind.
>
Correction - I misread the xe_svm_range_is_valid logic - the 2d case is
handled.
Patch looks good, the first case still exists but unsure if we really
need to handle that case.
Anyways:
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Matt
>
> > range = xe_svm_range_find_or_insert(vm, fault_addr, vma, &ctx);
> >
> > if (IS_ERR(range))
> > --
> > 2.51.0
> >
next prev parent reply other threads:[~2025-10-08 11:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 11:10 [PATCH 0/2] SVM migration fixes Thomas Hellström
2025-10-08 11:10 ` [PATCH 1/2] drm/xe/svm: Ensure data will be migrated to system if indicated by madvise Thomas Hellström
2025-10-08 11:42 ` Matthew Brost
2025-10-08 11:55 ` Matthew Brost [this message]
2025-10-08 16:32 ` Ghimiray, Himal Prasad
2025-10-08 11:10 ` [PATCH 2/2] drm/xe: Allow mixed mappings for userptr Thomas Hellström
2025-10-08 14:37 ` Matthew Auld
2025-10-08 11:18 ` ✓ CI.KUnit: success for SVM migration fixes Patchwork
2025-10-08 12:05 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-08 13:53 ` ✗ Xe.CI.Full: failure " 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=aOZRSSIpTVIXuYPi@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@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