From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Shuicheng Lin <shuicheng.lin@intel.com>, Ilia Levi <ilia.levi@intel.com>
Subject: [PATCH v4 4/8] drm/xe/mmio_gem: Revoke drm_vma_node on xe_mmio_gem destroy
Date: Tue, 8 Sep 2026 14:50:00 +0100 [thread overview]
Message-ID: <20260908134955.1344429-14-matthew.auld@intel.com> (raw)
In-Reply-To: <20260908134955.1344429-10-matthew.auld@intel.com>
From: Shuicheng Lin <shuicheng.lin@intel.com>
xe_mmio_gem_create() calls drm_vma_node_allow() but nothing ever calls
drm_vma_node_revoke(). The drm_vma_offset_file rb-tree entry allocated
by drm_vma_node_allow() is not freed by drm_gem_object_release(), so
it is leaked on every create/destroy cycle.
Add a struct drm_file * parameter to xe_mmio_gem_destroy() and call
drm_vma_node_revoke() from there, mirroring the drm_vma_node_allow()
call in xe_mmio_gem_create().
Fixes: 1ffcf8b8ae8a ("drm/xe: Support for mmap-ing mmio regions")
Suggested-by: Ilia Levi <ilia.levi@intel.com>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Ilia Levi <ilia.levi@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
drivers/gpu/drm/xe/xe_mmio_gem.c | 4 +++-
drivers/gpu/drm/xe/xe_mmio_gem.h | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_mmio_gem.c b/drivers/gpu/drm/xe/xe_mmio_gem.c
index 3b6d04efe81a..3c42d8358c7d 100644
--- a/drivers/gpu/drm/xe/xe_mmio_gem.c
+++ b/drivers/gpu/drm/xe/xe_mmio_gem.c
@@ -138,14 +138,16 @@ static void xe_mmio_gem_free(struct drm_gem_object *base)
/**
* xe_mmio_gem_destroy - Destroy the GEM object that exposes an MMIO region
* @gem: the GEM object to destroy
+ * @file: DRM file descriptor previously passed to xe_mmio_gem_create()
*
* This function releases resources associated with the GEM object created by
* xe_mmio_gem_create().
*
* See: "Exposing MMIO regions to userspace"
*/
-void xe_mmio_gem_destroy(struct xe_mmio_gem *gem)
+void xe_mmio_gem_destroy(struct xe_mmio_gem *gem, struct drm_file *file)
{
+ drm_vma_node_revoke(&gem->base.vma_node, file);
xe_mmio_gem_free(&gem->base);
}
diff --git a/drivers/gpu/drm/xe/xe_mmio_gem.h b/drivers/gpu/drm/xe/xe_mmio_gem.h
index 4b76d5586ebb..80d7795f07c8 100644
--- a/drivers/gpu/drm/xe/xe_mmio_gem.h
+++ b/drivers/gpu/drm/xe/xe_mmio_gem.h
@@ -15,6 +15,6 @@ struct xe_mmio_gem;
struct xe_mmio_gem *xe_mmio_gem_create(struct xe_device *xe, struct drm_file *file,
phys_addr_t phys_addr, size_t size);
u64 xe_mmio_gem_mmap_offset(struct xe_mmio_gem *gem);
-void xe_mmio_gem_destroy(struct xe_mmio_gem *gem);
+void xe_mmio_gem_destroy(struct xe_mmio_gem *gem, struct drm_file *file);
#endif /* _XE_MMIO_GEM_H_ */
--
2.55.0
next prev parent reply other threads:[~2026-09-08 13:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 13:49 [PATCH v4 0/8] drm/xe/mmio_gem: fix fault handler and destroy path Matthew Auld
2026-09-08 13:49 ` [PATCH v4 1/8] drm/xe/mmio_gem: forbid VMA split Matthew Auld
2026-09-08 13:49 ` [PATCH v4 2/8] drm/xe/mmio_gem: use write-back mapping for dummy page Matthew Auld
2026-09-08 13:49 ` [PATCH v4 3/8] drm/xe/mmio_gem: simplify fault handler loop Matthew Auld
2026-09-08 13:50 ` Matthew Auld [this message]
2026-09-08 13:50 ` [PATCH v4 5/8] drm/xe/mmio_gem: cache the dummy page per object Matthew Auld
2026-09-08 13:50 ` [PATCH v4 6/8] drm/xe/mmio_gem: fix destroy flow Matthew Auld
2026-09-08 13:50 ` [PATCH v4 7/8] drm/xe/mmio_gem: reject VM_EXEC and drop VM_DONTCOPY Matthew Auld
2026-09-08 14:57 ` Thomas Hellström
2026-09-08 13:50 ` [PATCH v4 8/8] drm/xe: convert PCI barrier mmap to use xe_mmio_gem Matthew Auld
2026-09-08 14:09 ` sashiko-bot
2026-09-08 14:21 ` Matthew Auld
2026-09-08 15:07 ` Thomas Hellström
2026-09-08 14:48 ` ✓ CI.KUnit: success for drm/xe/mmio_gem: fix fault handler and destroy path (rev4) Patchwork
2026-09-08 15:25 ` ✓ Xe.CI.BAT: " 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=20260908134955.1344429-14-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=ilia.levi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=shuicheng.lin@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