[PATCH i-g-t] tests/intel/xe_mmap: sanity check partial munmap

Matthew Auld matthew.auld at intel.com
Thu Dec 7 15:25:46 UTC 2023


Make sure we have some basic coverage for partial munmap, since this can
lead to multiple vm_close calls per mmap, and therefore anything we do
in vm_close should be mirrored in vm_open, otherwise we should expect
explosions.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Badal Nilawar <badal.nilawar at intel.com>
---
 tests/intel/xe_mmap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/intel/xe_mmap.c b/tests/intel/xe_mmap.c
index 63fdf46a8..8faacdb5c 100644
--- a/tests/intel/xe_mmap.c
+++ b/tests/intel/xe_mmap.c
@@ -57,7 +57,12 @@ test_mmap(int fd, uint32_t placement, uint32_t flags)
 
 	map = xe_bo_map(fd, bo, bo_size);
 	strcpy(map, "Write some data to the BO!");
+	munmap(map, bo_size);
 
+	/* Also try partial munmap */
+	map = xe_bo_map(fd, bo, bo_size);
+	munmap(map, bo_size/2);
+	strcpy(map + bo_size/2, "More data to the BO!");
 	munmap(map, bo_size);
 
 	gem_close(fd, bo);
-- 
2.43.0



More information about the igt-dev mailing list