[PATCH] tests/intel/xe_vm: Update mmap hammer sections to prefetch next page

Matthew Brost matthew.brost at intel.com
Tue Apr 30 22:16:44 UTC 2024


Adjust mmap hammer sections to prefetch next page by moving BB to within
PAGE_SIZE /8 of page boundary. This is prefetch next page on all
platforms, even ones with a smaller prefetch size.

Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
 tests/intel/xe_vm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index de2b1a8136..77cf1f7e67 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -1623,10 +1623,11 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		t.fd = fd;
 		t.vm = vm;
 #define PAGE_SIZE	4096
-		t.addr = addr + PAGE_SIZE / 2;
+#define HAMMER_OFFSET	(PAGE_SIZE - (PAGE_SIZE / 32))
+		t.addr = addr + HAMMER_OFFSET;
 		t.eci = eci;
 		t.exit = &exit;
-		t.map = map0 + PAGE_SIZE / 2;
+		t.map = map0 + HAMMER_OFFSET;
 		t.barrier = &barrier;
 		pthread_barrier_init(&barrier, NULL, 2);
 		pthread_create(&t.thread, 0, hammer_thread, &t);
@@ -1685,7 +1686,7 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert_eq(data->data, 0xc0ffee);
 	}
 	if (flags & MAP_FLAG_HAMMER_FIRST_PAGE) {
-		memset(map0, 0, PAGE_SIZE / 2);
+		memset(map0, 0, HAMMER_OFFSET);
 		memset(map0 + PAGE_SIZE, 0, bo_size - PAGE_SIZE);
 	} else {
 		memset(map0, 0, bo_size);
-- 
2.34.1



More information about the igt-dev mailing list