Skip to contentSkip to conversation

xe_exec_compute_mode: Add malloc-ufence test

PATCH In review Matthew Brost 4 participants 5 messages Feb 27, 2024 – Mar 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xe_exec_compute_mode: Add malloc-ufence test

The get user page ufence path is not triggered by the test as ufence memory is a mapped BO. To trigger this path use a malloc'd address.

---
 tests/intel/xe_exec_compute_mode.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
tests/intel/xe_exec_compute_mode.c +20 -8
index 7dad715093..c0cddbc02b 100644
@@ -31,6 +31,7 @@
 #define BIND_EXECQUEUE		(0x1 << 4)
 #define VM_FOR_BO			(0x1 << 5)
 #define EXEC_QUEUE_EARLY	(0x1 << 6)
+#define MALLOC_USER_FENCE		(0x1 <<7)
 
 /**
  * SUBTEST: twice-%s
@@ -48,6 +49,7 @@
  * arg[1]:
  *
  * @basic:				basic
+ * @malloc-ufence:			malloc user fence
  * @preempt-fence-early:		preempt fence early
  * @userptr:				userptr
  * @rebind:				rebind
@@ -110,6 +112,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		uint64_t exec_sync;
 		uint32_t data;
 	} *data;
+	uint64_t *vm_sync;
 	int i, j, b;
 	int map_fd = -1;
 	int64_t fence_timeout;
@@ -149,6 +152,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	}
 	memset(data, 0, bo_size);
 
+	if (flags & MALLOC_USER_FENCE)
+		vm_sync = malloc(sizeof(*vm_sync));
+	else
+		vm_sync = &data[0].vm_sync;
+	igt_assert(vm_sync);
+
 	for (i = 0; !(flags & EXEC_QUEUE_EARLY) && i < n_exec_queues; i++) {
 		exec_queues[i] = xe_exec_queue_create(fd, vm, eci, 0);
 		if (flags & BIND_EXECQUEUE)
@@ -158,7 +167,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			bind_exec_queues[i] = 0;
 	};
 
-	sync[0].addr = to_user_pointer(&data[0].vm_sync);
+	sync[0].addr = to_user_pointer(vm_sync);
 	if (bo)
 		xe_vm_bind_async(fd, vm, bind_exec_queues[0], bo, 0, addr,
 				 bo_size, sync, 1);
@@ -171,9 +180,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 	fence_timeout = igt_run_in_simulation() ? HUNDRED_SEC : ONE_SEC;
 
-	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+	xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], fence_timeout);
-	data[0].vm_sync = 0;
+	*vm_sync = 0;
 
 	for (i = 0; i < n_execs; i++) {
 		uint64_t batch_offset = (char *)&data[i].batch - (char *)data;
@@ -202,7 +211,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_vm_unbind_async(fd, vm, bind_exec_queues[e], 0,
 					   addr, bo_size, NULL, 0);
 
-			sync[0].addr = to_user_pointer(&data[0].vm_sync);
+			sync[0].addr = to_user_pointer(vm_sync);
 			addr += bo_size;
 			if (bo)
 				xe_vm_bind_async(fd, vm, bind_exec_queues[e], bo,
@@ -213,9 +222,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 							 to_user_pointer(data),
 							 addr, bo_size, sync,
 							 1);
-			xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+			xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 				       bind_exec_queues[e], fence_timeout);
-			data[0].vm_sync = 0;
+			*vm_sync = 0;
 		}
 
 		if (flags & INVALIDATE && i + 1 != n_execs) {
@@ -264,10 +273,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	if (flags & INVALIDATE)
 		usleep(250000);
 
-	sync[0].addr = to_user_pointer(&data[0].vm_sync);
+	sync[0].addr = to_user_pointer(vm_sync);
 	xe_vm_unbind_async(fd, vm, bind_exec_queues[0], 0, addr, bo_size,
 			   sync, 1);
-	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+	xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], fence_timeout);
 
 	for (i = j; i < n_execs; i++)
@@ -288,6 +297,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	xe_vm_destroy(fd, vm);
 	if (map_fd != -1)
 		close(map_fd);
+	if (flags & MALLOC_USER_FENCE)
+		free(vm_sync);
 }
 
 /**
@@ -408,6 +419,7 @@ igt_main
 		unsigned int flags;
 	} sections[] = {
 		{ "basic", 0 },
+		{ "malloc-ufence", MALLOC_USER_FENCE },
 		{ "preempt-fence-early", VM_FOR_BO | EXEC_QUEUE_EARLY },
 		{ "userptr", USERPTR },
 		{ "rebind", REBIND },
Signature · 1 line
2.34.1
#1 lore raw

✗ Fi.CI.BUILD: failure for xe_exec_compute_mode: Add malloc-ufence test

== Series Details ==

== Series Details ==

Series: xe_exec_compute_mode: Add malloc-ufence test
URL : https://patchwork.freedesktop.org/series/130417/
State : failure

== Summary ==

IGT patchset build failed on latest successful build 17f897a81868fb35c6a7033a8b07256659742248 tests/amdgpu: refactor the ABM test to use the new sysfs interface

Tail of build.log:
Warning: igt@sysfs_heartbeat_interval@long Category documentation is missing
Warning: igt@sysfs_heartbeat_interval@long Sub-category documentation is missing
Warning: igt@sysfs_heartbeat_interval@long Functionality documentation is missing
Warning: igt@sysfs_heartbeat_interval@mixed Category documentation is missing
Warning: igt@sysfs_heartbeat_interval@mixed Sub-category documentation is missing
Warning: igt@sysfs_heartbeat_interval@mixed Functionality documentation is missing
Warning: igt@sysfs_heartbeat_interval@nopreempt Category documentation is missing
Warning: igt@sysfs_heartbeat_interval@nopreempt Sub-category documentation is missing
Warning: igt@sysfs_heartbeat_interval@nopreempt Functionality documentation is missing
Warning: igt@sysfs_heartbeat_interval@off Category documentation is missing
Warning: igt@sysfs_heartbeat_interval@off Sub-category documentation is missing
Warning: igt@sysfs_heartbeat_interval@off Functionality documentation is missing
Warning: igt@sysfs_heartbeat_interval@precise Category documentation is missing
Warning: igt@sysfs_heartbeat_interval@precise Sub-category documentation is missing
Warning: igt@sysfs_heartbeat_interval@precise Functionality documentation is missing
Warning: igt@sysfs_preempt_timeout@idempotent Category documentation is missing
Warning: igt@sysfs_preempt_timeout@idempotent Sub-category documentation is missing
Warning: igt@sysfs_preempt_timeout@idempotent Functionality documentation is missing
Warning: igt@sysfs_preempt_timeout@invalid Category documentation is missing
Warning: igt@sysfs_preempt_timeout@invalid Sub-category documentation is missing
Warning: igt@sysfs_preempt_timeout@invalid Functionality documentation is missing
Warning: igt@sysfs_preempt_timeout@off Category documentation is missing
Warning: igt@sysfs_preempt_timeout@off Sub-category documentation is missing
Warning: igt@sysfs_preempt_timeout@off Functionality documentation is missing
Warning: igt@sysfs_preempt_timeout@timeout Category documentation is missing
Warning: igt@sysfs_preempt_timeout@timeout Sub-category documentation is missing
Warning: igt@sysfs_preempt_timeout@timeout Functionality documentation is missing
Warning: igt@sysfs_timeslice_duration@duration Category documentation is missing
Warning: igt@sysfs_timeslice_duration@duration Sub-category documentation is missing
Warning: igt@sysfs_timeslice_duration@duration Functionality documentation is missing
Warning: igt@sysfs_timeslice_duration@idempotent Category documentation is missing
Warning: igt@sysfs_timeslice_duration@idempotent Sub-category documentation is missing
Warning: igt@sysfs_timeslice_duration@idempotent Functionality documentation is missing
Warning: igt@sysfs_timeslice_duration@invalid Category documentation is missing
Warning: igt@sysfs_timeslice_duration@invalid Sub-category documentation is missing
Warning: igt@sysfs_timeslice_duration@invalid Functionality documentation is missing
Warning: igt@sysfs_timeslice_duration@off Category documentation is missing
Warning: igt@sysfs_timeslice_duration@off Sub-category documentation is missing
Warning: igt@sysfs_timeslice_duration@off Functionality documentation is missing
Warning: igt@sysfs_timeslice_duration@timeout Category documentation is missing
Warning: igt@sysfs_timeslice_duration@timeout Sub-category documentation is missing
Warning: igt@sysfs_timeslice_duration@timeout Functionality documentation is missing
Warning: igt@vgem_basic@bad-fence Sub-category documentation is missing
Warning: igt@vgem_basic@bad-flag Sub-category documentation is missing
Warning: igt@vgem_basic@bad-handle Sub-category documentation is missing
Warning: igt@vgem_basic@bad-pad Sub-category documentation is missing
Warning: igt@vgem_basic@busy-fence Sub-category documentation is missing [1662/1667] Generating kms_tests.rst with a custom command.
[1663/1667] Generating intel-ci-tests with a custom command.
ninja: build stopped: subcommand failed.

#2 lore raw

✗ GitLab.Pipeline: warning for xe_exec_compute_mode: Add malloc-ufence test

In reply to Matthew Brost
== Series Details ==

== Series Details ==

Series: xe_exec_compute_mode: Add malloc-ufence test
URL : https://patchwork.freedesktop.org/series/130417/
State : warning

== Summary ==

Pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/1113673 for the overview.

build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/55537007):
[1782/1787] Compiling C object 'runner/527aa9f@@runner_test@exe/runner_tests.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/819] Generating version.h with a custom command.
[2/8] Linking target runner/runner_test.
[3/8] Linking target assembler/intel-gen4asm.
[4/8] Generating kms_tests.html with a custom command.
[5/8] Generating i915_tests.html with a custom command.
[6/8] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/builds/gfx-ci/igt-ci-tags/scripts/igt_doc.py --config /builds/gfx-ci/igt-ci-tags/tests/intel/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /builds/gfx-ci/igt-ci-tags/build
Warning: Missing documentation for igt@xe_exec_compute_mode@many-execqueues-malloc-ufence
Please refer: docs/test_documentation.md for more details
ninja: build stopped: subcommand failed.
section_end:1709002503:step_script
section_start:1709002503:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1709002503:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/55537002):
[1789/1793] Compiling C object 'runner/527aa9f@@runner_test@exe/runner_tests.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/821] Generating version.h with a custom command.
[2/7] Linking target runner/runner_test.
[3/7] Generating kms_tests.html with a custom command.
[4/7] Generating i915_tests.html with a custom command.
[5/7] Generating intel-ci-tests with a custom command.
[6/7] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/builds/gfx-ci/igt-ci-tags/scripts/igt_doc.py --config /builds/gfx-ci/igt-ci-tags/tests/intel/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /builds/gfx-ci/igt-ci-tags/build
Warning: Missing documentation for igt@xe_exec_compute_mode@many-execqueues-malloc-ufence
Please refer: docs/test_documentation.md for more details
ninja: build stopped: subcommand failed.
section_end:1709002545:step_script
section_start:1709002545:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1709002545:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/55537006):
[1789/1793] Generating kms_tests.rst with a custom command.
[1790/1793] Generating intel-ci-tests with a custom command.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/821] Generating version.h with a custom command.
[2/6] Generating intel-ci-tests with a custom command.
[3/6] Generating i915_tests.html with a custom command.
[4/6] Generating kms_tests.html with a custom command.
[5/6] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/builds/gfx-ci/igt-ci-tags/scripts/igt_doc.py --config /builds/gfx-ci/igt-ci-tags/tests/intel/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /builds/gfx-ci/igt-ci-tags/build
Warning: Missing documentation for igt@xe_exec_compute_mode@many-execqueues-malloc-ufence
Please refer: docs/test_documentation.md for more details
ninja: build stopped: subcommand failed.
section_end:1709002562:step_script
section_start:1709002562:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1709002563:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-no-libdrm-nouveau has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/55537005):
[1623/1627] Compiling C object 'runner/527aa9f@@runner_test@exe/runner_tests.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/771] Generating version.h with a custom command.
[2/7] Linking target runner/runner_test.
[3/7] Generating kms_tests.html with a custom command.
[4/7] Generating i915_tests.html with a custom command.
[5/7] Generating intel-ci-tests with a custom command.
[6/7] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/builds/gfx-ci/igt-ci-tags/scripts/igt_doc.py --config /builds/gfx-ci/igt-ci-tags/tests/intel/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /builds/gfx-ci/igt-ci-tags/build
Warning: Missing documentation for igt@xe_exec_compute_mode@many-execqueues-malloc-ufence
Please refer: docs/test_documentation.md for more details
ninja: build stopped: subcommand failed.
section_end:1709002505:step_script
section_start:1709002505:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1709002505:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/55537003):
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/821] Generating version.h with a custom command.
[2/8] Linking target runner/runner_test.
[3/8] Linking target assembler/intel-gen4asm.
[4/8] Generating i915_tests.html with a custom command.
[5/8] Generating kms_tests.html with a custom command.
[6/8] Generating intel-ci-tests with a custom command.
[7/8] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/builds/gfx-ci/igt-ci-tags/scripts/igt_doc.py --config /builds/gfx-ci/igt-ci-tags/tests/intel/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /builds/gfx-ci/igt-ci-tags/build
Warning: Missing documentation for igt@xe_exec_compute_mode@many-execqueues-malloc-ufence
Please refer: docs/test_documentation.md for more details
ninja: build stopped: subcommand failed.
section_end:1709002544:step_script
section_start:1709002544:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1709002545:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/55537004):
[1789/1793] Compiling C object 'runner/runner@@runner_test@exe/runner_tests.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/821] Generating version.h with a custom command.
[2/7] Linking target runner/runner_test.
[3/7] Generating kms_tests.html with a custom command.
[4/7] Generating i915_tests.html with a custom command.
[5/7] Generating intel-ci-tests with a custom command.
[6/7] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/builds/gfx-ci/igt-ci-tags/scripts/igt_doc.py --config /builds/gfx-ci/igt-ci-tags/tests/intel/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --igt-build-path /builds/gfx-ci/igt-ci-tags/build
Warning: Missing documentation for igt@xe_exec_compute_mode@many-execqueues-malloc-ufence
Please refer: docs/test_documentation.md for more details
ninja: build stopped: subcommand failed.
section_end:1709002542:step_script
section_start:1709002542:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1709002543:cleanup_file_variables
ERROR: Job failed: exit code 1

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/1113673

Reviewed-by on v1 1/1
#3 lore raw
In reply to Matthew Brost
Quoted 142 lines

-----Original Message-----
From: igt-dev <[email protected]> On Behalf Of Matthew Brost
Sent: Tuesday, February 27, 2024 8:10 AM
To: [email protected]
Cc: Brost, Matthew <[email protected]>
Subject: [PATCH] xe_exec_compute_mode: Add malloc-ufence test

The get user page ufence path is not triggered by the test as ufence memory is a mapped BO. To trigger this path use a malloc'd address.

---
 tests/intel/xe_exec_compute_mode.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
tests/intel/xe_exec_compute_mode.c +3 -0
index 7dad715093..c0cddbc02b 100644
@@ -31,6 +31,7 @@
 #define BIND_EXECQUEUE		(0x1 << 4)
 #define VM_FOR_BO			(0x1 << 5)
 #define EXEC_QUEUE_EARLY	(0x1 << 6)
+#define MALLOC_USER_FENCE		(0x1 <<7)
 
 /**
  * SUBTEST: twice-%s
@@ -48,6 +49,7 @@
  * arg[1]:
  *
  * @basic:				basic
+ * @malloc-ufence:			malloc user fence
  * @preempt-fence-early:		preempt fence early
  * @userptr:				userptr
  * @rebind:				rebind
@@ -110,6 +112,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance
 *eci,
 		uint64_t exec_sync;
 		uint32_t data;
 	} *data;
+	uint64_t *vm_sync;
 	int i, j, b;
 	int map_fd = -1;
tests/intel/xe_exec_compute_mode.c +6 -0
 	int64_t fence_timeout;
@@ -149,6 +152,12 @@ test_exec(int fd, struct
 drm_xe_engine_class_instance *eci,
 	}
 	memset(data, 0, bo_size);
 
+	if (flags & MALLOC_USER_FENCE)
+		vm_sync = malloc(sizeof(*vm_sync));
+	else
+		vm_sync = &data[0].vm_sync;
+	igt_assert(vm_sync);
+
 	for (i = 0; !(flags & EXEC_QUEUE_EARLY) && i < n_exec_queues; i++) {
 		exec_queues[i] = xe_exec_queue_create(fd, vm, eci, 0);
tests/intel/xe_exec_compute_mode.c +1 -1
 		if (flags & BIND_EXECQUEUE)
@@ -158,7 +167,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance
 *eci,
 			bind_exec_queues[i] = 0;
 	};
 
-	sync[0].addr = to_user_pointer(&data[0].vm_sync);
+	sync[0].addr = to_user_pointer(vm_sync);
 	if (bo)
 		xe_vm_bind_async(fd, vm, bind_exec_queues[0], bo, 0, addr,
tests/intel/xe_exec_compute_mode.c +2 -2
 				 bo_size, sync, 1);
@@ -171,9 +180,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance
 *eci,
 
 	fence_timeout = igt_run_in_simulation() ? HUNDRED_SEC : ONE_SEC;
 
-	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+	xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], fence_timeout);
-	data[0].vm_sync = 0;
+	*vm_sync = 0;
 
 	for (i = 0; i < n_execs; i++) {
tests/intel/xe_exec_compute_mode.c +1 -1
 		uint64_t batch_offset = (char *)&data[i].batch - (char *)data;
@@ -202,7 +211,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance
 *eci,
 			xe_vm_unbind_async(fd, vm, bind_exec_queues[e],
 0,
 					   addr, bo_size, NULL, 0);
 
-			sync[0].addr = to_user_pointer(&data[0].vm_sync);
+			sync[0].addr = to_user_pointer(vm_sync);
 			addr += bo_size;
tests/intel/xe_exec_compute_mode.c +0 -0
 			if (bo)
 				xe_vm_bind_async(fd, vm,

bind_exec_queues[e], bo, @@ -213,9 +222,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,

to_user_pointer(data),

tests/intel/xe_exec_compute_mode.c +0 -1
 							 addr, bo_size, sync,
 							 1);
-			xe_wait_ufence(fd, &data[0].vm_sync,

USER_FENCE_VALUE,

tests/intel/xe_exec_compute_mode.c +7 -3
+			xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 				       bind_exec_queues[e], fence_timeout);
-			data[0].vm_sync = 0;
+			*vm_sync = 0;
 		}
 
 		if (flags & INVALIDATE && i + 1 != n_execs) { @@ -264,10
+273,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	if (flags & INVALIDATE)
 		usleep(250000);
 
-	sync[0].addr = to_user_pointer(&data[0].vm_sync);
+	sync[0].addr = to_user_pointer(vm_sync);
 	xe_vm_unbind_async(fd, vm, bind_exec_queues[0], 0, addr, bo_size,
 			   sync, 1);
-	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+	xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], fence_timeout);
 
 	for (i = j; i < n_execs; i++)
@@ -288,6 +297,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance
 *eci,
 	xe_vm_destroy(fd, vm);
 	if (map_fd != -1)
 		close(map_fd);
+	if (flags & MALLOC_USER_FENCE)
+		free(vm_sync);
 }
 

/**

tests/intel/xe_exec_compute_mode.c +1 -0
@@ -408,6 +419,7 @@ igt_main
 		unsigned int flags;
 	} sections[] = {
 		{ "basic", 0 },
+		{ "malloc-ufence", MALLOC_USER_FENCE },
 		{ "preempt-fence-early", VM_FOR_BO | EXEC_QUEUE_EARLY
 },
 		{ "userptr", USERPTR },
Quoted 3 lines

{ "rebind", REBIND },
--
2.34.1

Change LGTM

Can you check the build once before it looks like some failure is there. --Priyanka

#4 lore raw
In reply to Matthew Brost

Hi Matthew,

Quoted 13 lines · Matthew Brost

The get user page ufence path is not triggered by the test as ufence memory is a mapped BO. To trigger this path use a malloc'd address.

---
 tests/intel/xe_exec_compute_mode.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
tests/intel/xe_exec_compute_mode.c +0 -0
index 7dad715093..c0cddbc02b 100644

tests/intel/xe_exec_compute_mode.c line 34

Quoted 4 lines
tests/intel/xe_exec_compute_mode.c +1 -0
@@ -31,6 +31,7 @@
 #define BIND_EXECQUEUE		(0x1 << 4)
 #define VM_FOR_BO			(0x1 << 5)
 #define EXEC_QUEUE_EARLY	(0x1 << 6)
+#define MALLOC_USER_FENCE		(0x1 <<7)

------------------------------------------ ^
Put space before 7:
#define MALLOC_USER_FENCE (0x1 << 7)

tests/intel/xe_exec_compute_mode.c line 52

Quoted 8 lines
tests/intel/xe_exec_compute_mode.c +1 -0
 /**
  * SUBTEST: twice-%s
@@ -48,6 +49,7 @@
  * arg[1]:
  *
  * @basic:				basic
+ * @malloc-ufence:			malloc user fence

You need this also for many-execqueues subtest below.

Regards,
Kamil

Quoted 99 lines
tests/intel/xe_exec_compute_mode.c +18 -8
  * @preempt-fence-early:		preempt fence early
  * @userptr:				userptr
  * @rebind:				rebind
@@ -110,6 +112,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		uint64_t exec_sync;
 		uint32_t data;
 	} *data;
+	uint64_t *vm_sync;
 	int i, j, b;
 	int map_fd = -1;
 	int64_t fence_timeout;
@@ -149,6 +152,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	}
 	memset(data, 0, bo_size);
 
+	if (flags & MALLOC_USER_FENCE)
+		vm_sync = malloc(sizeof(*vm_sync));
+	else
+		vm_sync = &data[0].vm_sync;
+	igt_assert(vm_sync);
+
 	for (i = 0; !(flags & EXEC_QUEUE_EARLY) && i < n_exec_queues; i++) {
 		exec_queues[i] = xe_exec_queue_create(fd, vm, eci, 0);
 		if (flags & BIND_EXECQUEUE)
@@ -158,7 +167,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			bind_exec_queues[i] = 0;
 	};
 
-	sync[0].addr = to_user_pointer(&data[0].vm_sync);
+	sync[0].addr = to_user_pointer(vm_sync);
 	if (bo)
 		xe_vm_bind_async(fd, vm, bind_exec_queues[0], bo, 0, addr,
 				 bo_size, sync, 1);
@@ -171,9 +180,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 	fence_timeout = igt_run_in_simulation() ? HUNDRED_SEC : ONE_SEC;
 
-	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+	xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], fence_timeout);
-	data[0].vm_sync = 0;
+	*vm_sync = 0;
 
 	for (i = 0; i < n_execs; i++) {
 		uint64_t batch_offset = (char *)&data[i].batch - (char *)data;
@@ -202,7 +211,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_vm_unbind_async(fd, vm, bind_exec_queues[e], 0,
 					   addr, bo_size, NULL, 0);
 
-			sync[0].addr = to_user_pointer(&data[0].vm_sync);
+			sync[0].addr = to_user_pointer(vm_sync);
 			addr += bo_size;
 			if (bo)
 				xe_vm_bind_async(fd, vm, bind_exec_queues[e], bo,
@@ -213,9 +222,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 							 to_user_pointer(data),
 							 addr, bo_size, sync,
 							 1);
-			xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+			xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 				       bind_exec_queues[e], fence_timeout);
-			data[0].vm_sync = 0;
+			*vm_sync = 0;
 		}
 
 		if (flags & INVALIDATE && i + 1 != n_execs) {
@@ -264,10 +273,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	if (flags & INVALIDATE)
 		usleep(250000);
 
-	sync[0].addr = to_user_pointer(&data[0].vm_sync);
+	sync[0].addr = to_user_pointer(vm_sync);
 	xe_vm_unbind_async(fd, vm, bind_exec_queues[0], 0, addr, bo_size,
 			   sync, 1);
-	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
+	xe_wait_ufence(fd, vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], fence_timeout);
 
 	for (i = j; i < n_execs; i++)
@@ -288,6 +297,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	xe_vm_destroy(fd, vm);
 	if (map_fd != -1)
 		close(map_fd);
+	if (flags & MALLOC_USER_FENCE)
+		free(vm_sync);
 }
 
 /**
@@ -408,6 +419,7 @@ igt_main
 		unsigned int flags;
 	} sections[] = {
 		{ "basic", 0 },
+		{ "malloc-ufence", MALLOC_USER_FENCE },
 		{ "preempt-fence-early", VM_FOR_BO | EXEC_QUEUE_EARLY },
 		{ "userptr", USERPTR },
 		{ "rebind", REBIND },
Signature · 1 line
2.34.1