From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: francois.dugast@intel.com, thomas.hellstrom@linux.intel.com,
himal.prasad.ghimiray@intel.com
Subject: [PATCH 1/2] drm/gpusvm: Force unmapping on error in drm_gpusvm_get_pages
Date: Fri, 30 Jan 2026 11:49:27 -0800 [thread overview]
Message-ID: <20260130194928.3255613-2-matthew.brost@intel.com> (raw)
In-Reply-To: <20260130194928.3255613-1-matthew.brost@intel.com>
drm_gpusvm_get_pages() only sets the local flags prior to committing the
pages. If an error occurs mid-mapping, has_dma_mapping will be clear,
causing the unmap function to skip unmapping pages that were
successfully mapped before the error. Fix this by forcibly setting
has_dma_mapping in the error path to ensure all previously mapped pages
are properly unmapped.
Fixes: 99624bdff867 ("drm/gpusvm: Add support for GPU Shared Virtual Memory")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/drm_gpusvm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index aa9a0b60e727..d733599ceb9a 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -1572,6 +1572,7 @@ int drm_gpusvm_get_pages(struct drm_gpusvm *gpusvm,
return 0;
err_unmap:
+ svm_pages->flags.has_dma_mapping = true;
__drm_gpusvm_unmap_pages(gpusvm, svm_pages, num_dma_mapped);
drm_gpusvm_notifier_unlock(gpusvm);
err_free:
--
2.34.1
next prev parent reply other threads:[~2026-01-30 19:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 19:49 [PATCH 0/2] Small GPUSVM fixes Matthew Brost
2026-01-30 19:49 ` Matthew Brost [this message]
2026-02-02 12:17 ` [PATCH 1/2] drm/gpusvm: Force unmapping on error in drm_gpusvm_get_pages Francois Dugast
2026-01-30 19:49 ` [PATCH 2/2] drm/gpusvm: Allow device pages to be mapped in mixed mappings after system pages Matthew Brost
2026-02-02 12:36 ` Francois Dugast
2026-01-30 19:55 ` ✗ CI.checkpatch: warning for Small GPUSVM fixes Patchwork
2026-01-30 19:57 ` ✓ CI.KUnit: success " Patchwork
2026-01-30 20:30 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-03 6:15 ` ✗ CI.checkpatch: warning for Small GPUSVM fixes (rev2) Patchwork
2026-02-03 6:16 ` ✓ CI.KUnit: success " Patchwork
2026-02-03 6:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-03 19:33 ` ✓ Xe.CI.FULL: " 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=20260130194928.3255613-2-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--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