]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/xe/madvise: Block imported and exported dma-bufs
authorArvind Yadav <arvind.yadav@intel.com>
Thu, 26 Mar 2026 13:08:33 +0000 (18:38 +0530)
committerMatthew Brost <matthew.brost@intel.com>
Fri, 27 Mar 2026 02:59:53 +0000 (19:59 -0700)
commit63cf199c0c3274fc0efde11cd854632b64b1113a
treecb2b5361598b7d7202001591da86887ef4031bb4
parent5bfb7e6a7fc0056a974ce13a81c95602a2cae859
drm/xe/madvise: Block imported and exported dma-bufs

Prevent marking imported or exported dma-bufs as purgeable.
External devices may be accessing these buffers without our
knowledge, making purging unsafe.

Check drm_gem_is_imported() for buffers created by other
drivers and obj->dma_buf for buffers exported to other
drivers. Silently skip these BOs during madvise processing.

This follows drm_gem_shmem's purgeable implementation and
prevents data corruption from purging actively-used shared
buffers.

Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260326130843.3545241-8-arvind.yadav@intel.com
drivers/gpu/drm/xe/xe_vm_madvise.c