tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 43 lines · Jia Yao
The pat-index-madvise-pat-idx-uc-single-vma subtest was intermittently failing with 'Timer expired' error when waiting for user fence.
Root cause:
When the PAT index is set to UC (Uncached), the batch buffer written by CPU may not be visible to GPU due to CPU cache not being flushed to memory. The GPU would then read stale or corrupted batch commands, causing the execution to hang and the user fence to never be signaled.Fix:
- Useigt_clflush_range()to explicitly flush the batch buffer from CPU cache to memory before GPU execution
- Initialize clflush support inigt_fixturewithigt_setup_clflush()This ensures that when using UC PAT index, the GPU can read the correct batch buffer data from memory.
jira reference: VLK-84224
Cc Alex Zuo<[email protected]>Cc Shuicheng Lin<[email protected]>Cc Xin Wang<[email protected]>Signed-off-by Jia Yao<[email protected]>--- tests/intel/xe_exec_system_allocator.c | 5 +++++ 1 file changed, 5 insertions(+)tests/intel/xe_exec_system_allocator.c +4
-0@@ -1692,6 +1692,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, prefetch_ns += (end - start); } +if (pat_value == intel_get_pat_idx_uc || + pat_value == intel_get_pat_idx_uc_comp) +igt_clflush_range (data[idx].batch,sizeof (data[idx].batch)); + sync[0 ].addr = exec_ufence ?to_user_pointer (exec_ufence) : addr + (char *)&data[idx].exec_sync - (char *)data;
tests/intel/xe_exec_system_allocator.c int igt_main() · line 2440
Quoted 4 lines
tests/intel/xe_exec_system_allocator.c +1
-0@@ -2433,6 +2437,7 @@ int igt_main() xe =xe_device_get (fd); va_bits = xe->va_bits;open_sync_file (); +igt_setup_clflush ();
igt_setup_clflush() is not required for other test cases, I suggest to only add the clflush check before the pat-index-madvise-pat-idx-uc-* tests.
tests/intel/xe_exec_system_allocator.c +0 -0
index 20282fe8a..43f1ed47e 100644
tests/intel/xe_exec_system_allocator.c +0 -0
@@ -2604,6 +2604,10 @@ int igt_main()
!xe_has_vram(fd)) {
igt_skip("Skipping compression-related PAT index\n"); }
+ if (strstr(s->name, "madvise-pat-idx-uc-")) {
+ igt_require_f(igt_setup_clflush(),
+ "CLFLUSH support required for UC PAT index test\n"); + }
xe_for_each_engine(fd, hwe)
test_exec(fd, hwe, 1, 1, SZ_4M, 0, 0, NULL, NULL, s->flags, s->fn); }
Quoted 3 lines
tests/intel/xe_exec_system_allocator.c +0
-0}for (const struct section *s = sections; s->name; s++) {
Patchwork
CI✗ Fi.CI.BUILD: failure for tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout
In reply to a message not in the archive== Series Details ==
== Series Details ==
Series: tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout
URL : https://patchwork.freedesktop.org/series/160723/
State : failure
== Summary ==
Applying: tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout Patch failed at 0001 tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
PATCH v2 1/1 tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout
In reply to a message not in the archiveThe pat-index-madvise-pat-idx-uc-single-vma subtest was intermittently failing with 'Timer expired' error when waiting for user fence.
Root cause:
When the PAT index is set to UC (Uncached), the batch buffer written by CPU may not be visible to GPU due to CPU cache not being flushed to memory. The GPU would then read stale or corrupted batch commands, causing the execution to hang and the user fence to never be signaled.
Fix:
- Use igt_clflush_range() to explicitly flush the batch buffer from CPU cache to memory before GPU execution
- Initialize clflush support in igt_fixture with igt_setup_clflush()
v2 (Xin Wang):
- Move igt_setup_clflush() from igt_fixture to just before xe_for_each_engine loop for UC PAT index subtests. This ensures clflush is only initialized when actually needed, and allows proper skip if clflush is not supported on the platform.
This ensures that when using UC PAT index, the GPU can read the correct batch buffer data from memory.
--- tests/intel/xe_exec_system_allocator.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tests/intel/xe_exec_system_allocator.c +9 -0
@@ -1692,6 +1692,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, prefetch_ns += (end - start); } +if (pat_value == intel_get_pat_idx_uc || + pat_value == intel_get_pat_idx_uc_comp) +igt_clflush_range (data[idx].batch,sizeof (data[idx].batch)); + sync[0 ].addr = exec_ufence ?to_user_pointer (exec_ufence) : addr + (char *)&data[idx].exec_sync - (char *)data;
@@ -2633,6 +2637,11 @@ int igt_main() !xe_has_vram(fd)) {igt_skip ("Skipping compression-related PAT index\n" ); } +if (strstr (s->name,"madvise-pat-idx-uc-" )) { +igt_require_f (igt_setup_clflush (), +"CLFLUSH support required for UC PAT index test\n" ); + } +xe_for_each_engine (fd, hwe)test_exec (fd, hwe,1 ,1 ,SZ_4M ,0 ,0 ,NULL ,NULL , s->flags, s->fn); }
Signature · 1 line
2.43.0
Quoted 5 lines · Jia Yao
The pat-index-madvise-pat-idx-uc-single-vma subtest was intermittently failing with 'Timer expired' error when waiting for user fence.
Root cause:
When the PAT index is set to UC (Uncached), the batch buffer written
Uncached on the GPU is not necessarily an issue, since it can be coherent, depending on the exact PAT index. I assume you mean the coh_mode here, which is coh_none?
Quoted 3 lines
by CPU may not be visible to GPU due to CPU cache not being flushed to memory. The GPU would then read stale or corrupted batch commands, causing the execution to hang and the user fence to never be signaled.
At a glance that sounds more like KMD bug and potential security issue. For normal buffers we disallow CPU cached memory and incoherent GPU access via the KMD. Otherwise the user can potentially bypass sensitive CPU page zeroing (potentially cache dirty on CPU) as done by core kernel when you ask for GFP_ZERO, for example.
Also I assume this issue is for IGPU? Do you have some more info?
Quoted 50 lines
Fix:
- Useigt_clflush_range()to explicitly flush the batch buffer from CPU cache to memory before GPU execution
- Initialize clflush support inigt_fixturewithigt_setup_clflush()v2 (Xin Wang):
- Moveigt_setup_clflush()fromigt_fixtureto just beforexe_for_each_engineloop for UC PAT index subtests. This ensures clflush is only initialized when actually needed, and allows proper skip if clflush is not supported on the platform.This ensures that when using UC PAT index, the GPU can read the correct batch buffer data from memory.
Cc Alex Zuo <[email protected]>Cc Shuicheng Lin <[email protected]>Cc Xin Wang <[email protected]>Signed-off-by Jia Yao <[email protected]>--- tests/intel/xe_exec_system_allocator.c | 9 +++++++++ 1 file changed, 9 insertions(+)tests/intel/xe_exec_system_allocator.c +9
-0@@ -1692,6 +1692,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, prefetch_ns += (end - start); } +if (pat_value == intel_get_pat_idx_uc || + pat_value == intel_get_pat_idx_uc_comp) +igt_clflush_range (data[idx].batch,sizeof (data[idx].batch)); + sync[0 ].addr = exec_ufence ?to_user_pointer (exec_ufence) : addr + (char *)&data[idx].exec_sync - (char *)data;@@ -2633,6 +2637,11 @@ int igt_main() !xe_has_vram(fd)) {igt_skip ("Skipping compression-related PAT index\n" ); } +if (strstr (s->name,"madvise-pat-idx-uc-" )) { +igt_require_f (igt_setup_clflush (), +"CLFLUSH support required for UC PAT index test\n" ); + } +xe_for_each_engine (fd, hwe)test_exec (fd, hwe,1 ,1 ,SZ_4M ,0 ,0 ,NULL ,NULL , s->flags, s->fn); }
Thanks Matthew.
@[email protected]
Please drop this patch. I have switched to a different implementation. A new version will be sent later.
-----Original Message-----
From: Auld, Matthew <[email protected]>
Sent: Wednesday, January 28, 2026 8:48 AM
To: Yao, Jia <[email protected]>; [email protected]
Cc: Zuo, Alex <[email protected]>; Lin, Shuicheng <[email protected]>; Wang, X <[email protected]>
Subject: Re: [PATCH v2] tests/intel/xe_exec_system_allocator: Fix UC PAT index test timeout
Quoted 5 lines · Jia Yao
The pat-index-madvise-pat-idx-uc-single-vma subtest was intermittently failing with 'Timer expired' error when waiting for user fence.
Root cause:
When the PAT index is set to UC (Uncached), the batch buffer written
Uncached on the GPU is not necessarily an issue, since it can be coherent, depending on the exact PAT index. I assume you mean the coh_mode here, which is coh_none?
Quoted 3 lines
by CPU may not be visible to GPU due to CPU cache not being flushed to memory. The GPU would then read stale or corrupted batch commands, causing the execution to hang and the user fence to never be signaled.
At a glance that sounds more like KMD bug and potential security issue.
For normal buffers we disallow CPU cached memory and incoherent GPU access via the KMD. Otherwise the user can potentially bypass sensitive CPU page zeroing (potentially cache dirty on CPU) as done by core kernel when you ask for GFP_ZERO, for example.
Also I assume this issue is for IGPU? Do you have some more info?
Quoted 51 lines
Fix:
- Useigt_clflush_range()to explicitly flush the batch buffer from CPU cache to memory before GPU execution
- Initialize clflush support inigt_fixturewithigt_setup_clflush()v2 (Xin Wang):
- Moveigt_setup_clflush()fromigt_fixtureto just beforexe_for_each_engineloop for UC PAT index subtests. This ensures clflush is only initialized when actually needed, and allows proper skip if clflush is not supported on the platform.This ensures that when using UC PAT index, the GPU can read the correct batch buffer data from memory.
Cc Alex Zuo <[email protected]>Cc Shuicheng Lin <[email protected]>Cc Xin Wang <[email protected]>Signed-off-by Jia Yao <[email protected]>--- tests/intel/xe_exec_system_allocator.c | 9 +++++++++ 1 file changed, 9 insertions(+)tests/intel/xe_exec_system_allocator.c +9
-0@@ -1692,6 +1692,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, prefetch_ns += (end - start); } +if (pat_value == intel_get_pat_idx_uc || + pat_value == intel_get_pat_idx_uc_comp) +igt_clflush_range (data[idx].batch,sizeof (data[idx].batch)); + sync[0 ].addr = exec_ufence ?to_user_pointer (exec_ufence) : addr + (char *)&data[idx].exec_sync - (char *)data;@@ -2633,6 +2637,11 @@ int igt_main() !xe_has_vram(fd)) {igt_skip ("Skipping compression-related PAT index\n" ); } +if (strstr (s->name,"madvise-pat-idx-uc-" )) { +igt_require_f (igt_setup_clflush (), +"CLFLUSH support required for UC PAT index test\n" ); + } +xe_for_each_engine (fd, hwe)test_exec (fd, hwe,1 ,1 ,SZ_4M ,0 ,0 ,NULL ,NULL , s->flags, s->fn); }