* [PATCH 0/2] Fix a couple drm_pagemap issues with multi-GPU @ 2026-01-07 18:27 Matthew Brost 2026-01-07 18:27 ` [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem Matthew Brost 2026-01-07 18:27 ` [PATCH 2/2] drm/pagemap: Disable device-to-device migration Matthew Brost 0 siblings, 2 replies; 5+ messages in thread From: Matthew Brost @ 2026-01-07 18:27 UTC (permalink / raw) To: intel-xe, dri-devel; +Cc: himal.prasad.ghimiray, francois.dugast A couple of fixes, 2nd one is temporary W/A to stable CI until a proper fix can be found. Matt Matthew Brost (2): drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem drm/pagemap: Disable device-to-device migration drivers/gpu/drm/drm_pagemap.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem 2026-01-07 18:27 [PATCH 0/2] Fix a couple drm_pagemap issues with multi-GPU Matthew Brost @ 2026-01-07 18:27 ` Matthew Brost 2026-01-07 20:40 ` Francois Dugast 2026-01-07 18:27 ` [PATCH 2/2] drm/pagemap: Disable device-to-device migration Matthew Brost 1 sibling, 1 reply; 5+ messages in thread From: Matthew Brost @ 2026-01-07 18:27 UTC (permalink / raw) To: intel-xe, dri-devel Cc: himal.prasad.ghimiray, francois.dugast, Thomas Hellström Avoid unlocking and putting device pages unless they were successfully locked, and do not calculate migrated_pages on error paths. Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Fixes: 75af93b3f5d0 ("drm/pagemap, drm/xe: Support destination migration over interconnect") Signed-off-by: Matthew Brost <matthew.brost@intel.com> --- drivers/gpu/drm/drm_pagemap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c index ba099aa7c52f..aa43a8475100 100644 --- a/drivers/gpu/drm/drm_pagemap.c +++ b/drivers/gpu/drm/drm_pagemap.c @@ -582,7 +582,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, err = ops->populate_devmem_pfn(devmem_allocation, npages, migrate.dst); if (err) - goto err_finalize; + goto err_aborted_migration; own_pages = 0; @@ -621,8 +621,10 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, err = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst, pages, pagemap_addr, &last, &cur, mdetails); - if (err) + if (err) { + npages = i + 1; goto err_finalize; + } } cur.start = npages; cur.ops = NULL; /* Force migration */ @@ -646,7 +648,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, err_aborted_migration: migrate_vma_pages(&migrate); - for (i = 0; i < npages;) { + for (i = 0; !err && i < npages;) { struct page *page = migrate_pfn_to_page(migrate.src[i]); unsigned long nr_pages = page ? NR_PAGES(folio_order(page_folio(page))) : 1; -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem 2026-01-07 18:27 ` [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem Matthew Brost @ 2026-01-07 20:40 ` Francois Dugast 0 siblings, 0 replies; 5+ messages in thread From: Francois Dugast @ 2026-01-07 20:40 UTC (permalink / raw) To: Matthew Brost Cc: intel-xe, dri-devel, himal.prasad.ghimiray, Thomas Hellström On Wed, Jan 07, 2026 at 10:27:15AM -0800, Matthew Brost wrote: > Avoid unlocking and putting device pages unless they were successfully > locked, and do not calculate migrated_pages on error paths. > > Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> > Fixes: 75af93b3f5d0 ("drm/pagemap, drm/xe: Support destination migration over interconnect") > Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Francois Dugast <francois.dugast@intel.com> > --- > drivers/gpu/drm/drm_pagemap.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c > index ba099aa7c52f..aa43a8475100 100644 > --- a/drivers/gpu/drm/drm_pagemap.c > +++ b/drivers/gpu/drm/drm_pagemap.c > @@ -582,7 +582,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, > > err = ops->populate_devmem_pfn(devmem_allocation, npages, migrate.dst); > if (err) > - goto err_finalize; > + goto err_aborted_migration; > > own_pages = 0; > > @@ -621,8 +621,10 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, > err = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst, > pages, pagemap_addr, &last, &cur, > mdetails); > - if (err) > + if (err) { > + npages = i + 1; > goto err_finalize; > + } > } > cur.start = npages; > cur.ops = NULL; /* Force migration */ > @@ -646,7 +648,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, > err_aborted_migration: > migrate_vma_pages(&migrate); > > - for (i = 0; i < npages;) { > + for (i = 0; !err && i < npages;) { > struct page *page = migrate_pfn_to_page(migrate.src[i]); > unsigned long nr_pages = page ? NR_PAGES(folio_order(page_folio(page))) : 1; > > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/pagemap: Disable device-to-device migration 2026-01-07 18:27 [PATCH 0/2] Fix a couple drm_pagemap issues with multi-GPU Matthew Brost 2026-01-07 18:27 ` [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem Matthew Brost @ 2026-01-07 18:27 ` Matthew Brost 2026-01-07 20:05 ` Francois Dugast 1 sibling, 1 reply; 5+ messages in thread From: Matthew Brost @ 2026-01-07 18:27 UTC (permalink / raw) To: intel-xe, dri-devel Cc: himal.prasad.ghimiray, francois.dugast, Thomas Hellström Device-to-device migration is causing xe_exec_system_allocator --r *race*no* to intermittently fail with engine resets and a kernel hang on a page lock. This should work but is clearly buggy somewhere. Disable device-to-device migration in the interim until the issue can be root-caused. The only downside of disabling device-to-device migration is that memory will bounce through system memory during migration. However, this path should be rare, as it only occurs when madvise attributes are changed or atomics are used. Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Fixes: ec265e1f1cfc ("drm/pagemap: Support source migration over interconnect") Signed-off-by: Matthew Brost <matthew.brost@intel.com> --- drivers/gpu/drm/drm_pagemap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c index aa43a8475100..03ee39a761a4 100644 --- a/drivers/gpu/drm/drm_pagemap.c +++ b/drivers/gpu/drm/drm_pagemap.c @@ -480,8 +480,18 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, .start = start, .end = end, .pgmap_owner = pagemap->owner, - .flags = MIGRATE_VMA_SELECT_SYSTEM | MIGRATE_VMA_SELECT_DEVICE_COHERENT | - MIGRATE_VMA_SELECT_DEVICE_PRIVATE, + /* + * FIXME: MIGRATE_VMA_SELECT_DEVICE_PRIVATE intermittently + * causes 'xe_exec_system_allocator --r *race*no*' to trigger aa + * engine reset and a hard hang due to getting stuck on a folio + * lock. This should work and needs to be root-caused. The only + * downside of not selecting MIGRATE_VMA_SELECT_DEVICE_PRIVATE + * is that device-to-device migrations won’t work; instead, + * memory will bounce through system memory. This path should be + * rare and only occur when the madvise attributes of memory are + * changed or atomics are being used. + */ + .flags = MIGRATE_VMA_SELECT_SYSTEM | MIGRATE_VMA_SELECT_DEVICE_COHERENT, }; unsigned long i, npages = npages_in_range(start, end); unsigned long own_pages = 0, migrated_pages = 0; -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] drm/pagemap: Disable device-to-device migration 2026-01-07 18:27 ` [PATCH 2/2] drm/pagemap: Disable device-to-device migration Matthew Brost @ 2026-01-07 20:05 ` Francois Dugast 0 siblings, 0 replies; 5+ messages in thread From: Francois Dugast @ 2026-01-07 20:05 UTC (permalink / raw) To: Matthew Brost Cc: intel-xe, dri-devel, himal.prasad.ghimiray, Thomas Hellström On Wed, Jan 07, 2026 at 10:27:16AM -0800, Matthew Brost wrote: > Device-to-device migration is causing xe_exec_system_allocator --r > *race*no* to intermittently fail with engine resets and a kernel hang on > a page lock. This should work but is clearly buggy somewhere. Disable > device-to-device migration in the interim until the issue can be > root-caused. > > The only downside of disabling device-to-device migration is that memory > will bounce through system memory during migration. However, this path > should be rare, as it only occurs when madvise attributes are changed or > atomics are used. > > Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> > Fixes: ec265e1f1cfc ("drm/pagemap: Support source migration over interconnect") > Signed-off-by: Matthew Brost <matthew.brost@intel.com> > --- > drivers/gpu/drm/drm_pagemap.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c > index aa43a8475100..03ee39a761a4 100644 > --- a/drivers/gpu/drm/drm_pagemap.c > +++ b/drivers/gpu/drm/drm_pagemap.c > @@ -480,8 +480,18 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, > .start = start, > .end = end, > .pgmap_owner = pagemap->owner, > - .flags = MIGRATE_VMA_SELECT_SYSTEM | MIGRATE_VMA_SELECT_DEVICE_COHERENT | > - MIGRATE_VMA_SELECT_DEVICE_PRIVATE, > + /* > + * FIXME: MIGRATE_VMA_SELECT_DEVICE_PRIVATE intermittently > + * causes 'xe_exec_system_allocator --r *race*no*' to trigger aa s/aa/an/ Reviewed-by: Francois Dugast <francois.dugast@intel.com> > + * engine reset and a hard hang due to getting stuck on a folio > + * lock. This should work and needs to be root-caused. The only > + * downside of not selecting MIGRATE_VMA_SELECT_DEVICE_PRIVATE > + * is that device-to-device migrations won’t work; instead, > + * memory will bounce through system memory. This path should be > + * rare and only occur when the madvise attributes of memory are > + * changed or atomics are being used. > + */ > + .flags = MIGRATE_VMA_SELECT_SYSTEM | MIGRATE_VMA_SELECT_DEVICE_COHERENT, > }; > unsigned long i, npages = npages_in_range(start, end); > unsigned long own_pages = 0, migrated_pages = 0; > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-07 20:40 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-01-07 18:27 [PATCH 0/2] Fix a couple drm_pagemap issues with multi-GPU Matthew Brost 2026-01-07 18:27 ` [PATCH 1/2] drm/pagemap Fix error paths in drm_pagemap_migrate_to_devmem Matthew Brost 2026-01-07 20:40 ` Francois Dugast 2026-01-07 18:27 ` [PATCH 2/2] drm/pagemap: Disable device-to-device migration Matthew Brost 2026-01-07 20:05 ` Francois Dugast
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox