Another attempt to fix two bind races
Subsystems (2)
Matthew Brost
maintainercover Another attempt to fix two bind races
The first was patch originally authored by Thomas in the following series [1].
The second patch is better version of [2] in which bind-engines-independent worka.
Tested with [3].
A follow up will clean up the maple_tree in a better way.
Matt
[1] https://patchwork.freedesktop.org/series/120031/
[2] https://patchwork.freedesktop.org/patch/544876/?series=120031&rev=1
[3] https://patchwork.freedesktop.org/series/120120/
Matthew Brost (1):
drm/xe: Make bind engines safe
Thomas Hellström (1):
drm/xe: Make page-table updates using the default engine
drivers/gpu/drm/xe/xe_migrate.c | 79 +++++++++++++++++++++++-- drivers/gpu/drm/xe/xe_sched_job_types.h | 7 +++ drivers/gpu/drm/xe/xe_vm.c | 18 ++++++ drivers/gpu/drm/xe/xe_vm_types.h | 6 ++ 4 files changed, 105 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
Matthew Brost
maintainerPATCH 1/2 drm/xe: Make page-table updates using the default engine
From: Thomas Hellström <[email protected]>
If the default engine m->eng was used, there is no check for idle and a cpu page-table update may thus happen in parallel with a gpu one. Don't allow CPU page-table updates with the default engine until the engine is idle.
--- drivers/gpu/drm/xe/xe_migrate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_migrate.c +3 -2
@@ -1160,9 +1160,10 @@ xe_migrate_update_pgtables(struct xe_migrate *m,int err =0 ;bool usm = !eng && xe->info.supports_usm;bool first_munmap_rebind = vma && vma->first_munmap_rebind; +struct xe_engine *eng_override = !eng ? m->eng : eng;/* Use the CPU if no in syncs and engine is idle */ -if (no_in_syncs (syncs, num_syncs) && (!eng ||xe_engine_is_idle (eng))) { +if (no_in_syncs (syncs, num_syncs) &&xe_engine_is_idle (eng_override)) { fence = xe_migrate_update_pgtables_cpu(m, vm, bo, updates, num_updates, first_munmap_rebind,
@@ -1259,7 +1260,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,if (!eng)mutex_lock (&m->job_mutex); - job =xe_bb_create_migration_job (eng ?: m->eng, bb, + job =xe_bb_create_migration_job (eng_override, bb,xe_migrate_batch_base (m, usm), update_idx);if (IS_ERR (job)) {
Signature · 1 line
2.34.1
Matthew Brost
maintainerPATCH 2/2 drm/xe: Make bind engines safe
In reply to Matthew BrostWe currently have a race between bind engines which can result in corrupted page tables leading to faults.
A simple example:
bind A 0x0000-0x1000, engine A, has unsatisfied in-fence bind B 0x1000-0x2000, engine B, no in-fences exec A uses 0x1000-0x2000
Bind B will pass bind A and exec A will fault. This occurs as bind A programs the root of the page table in a bind job which is held up by an in-fence. Bind B in this case just programs a leaf entry of the structure.
To fix this introduce a per VM maple tree to track cross engine conflicts. In the above example bind A would insert an dependency in the maple tree with a key of 0x0-0x7fffffffff, bind B would find that dependency and its bind job would scheduled behind the unsatisfied in-fence and bind A's job.
--- drivers/gpu/drm/xe/xe_migrate.c | 76 +++++++++++++++++++++++-- drivers/gpu/drm/xe/xe_sched_job_types.h | 7 +++ drivers/gpu/drm/xe/xe_vm.c | 18 ++++++ drivers/gpu/drm/xe/xe_vm_types.h | 6 ++ 4 files changed, 103 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_migrate.c +72 -4
@@ -1109,6 +1109,14 @@ static bool no_in_syncs(struct xe_sync_entry *syncs, u32 num_syncs)return true; } +static void remove_dep_job (struct maple_tree *mtree, +struct xe_sched_job *dep_job) +{ +mtree_erase (mtree, dep_job->bind_args.index); +dma_fence_put (dep_job->fence); +xe_sched_job_put (dep_job); +} +/** * xe_migrate_update_pgtables() - Pipelined page-table update * @m: The migrate context.
@@ -1150,8 +1158,8 @@ xe_migrate_update_pgtables(struct xe_migrate *m,struct xe_tile *tile = m->tile;struct xe_gt *gt = tile->primary_gt;struct xe_device *xe =tile_to_xe (tile); -struct xe_sched_job *job; -struct dma_fence *fence; +struct xe_sched_job *job, *dep_job; +struct dma_fence *fence, *dep_fence;struct drm_suballoc *sa_bo =NULL ;struct xe_vma *vma = pt_update->vma;struct xe_bb *bb;
@@ -1161,9 +1169,31 @@ xe_migrate_update_pgtables(struct xe_migrate *m,bool usm = !eng && xe->info.supports_usm;bool first_munmap_rebind = vma && vma->first_munmap_rebind;struct xe_engine *eng_override = !eng ? m->eng : eng; +int level =0 ; +bool found_dep = false; +unsigned long index, last; + +/* Find inter-engine deps */ +for (i =0 ; i < num_updates; i++) { +const struct xe_vm_pgtable_update *update = &updates[i]; + +if (update->pt->level > level) + level = update->pt->level; + } + index =ALIGN_DOWN (xe_vma_start (vma),0x1ull <<xe_pt_shift (level)); + last =ALIGN (xe_vma_end (vma),0x1ull <<xe_pt_shift (level)) -1 ; +mt_for_each (&vm->mtree[tile->id], dep_job, index, last) { + dep_fence = dep_job->fence; + +if (dma_fence_is_signaled (dep_fence)) +remove_dep_job (&vm->mtree[tile->id], dep_job); +else if (eng_override != dep_job->engine) + found_dep = true; + }/* Use the CPU if no in syncs and engine is idle */ -if (no_in_syncs (syncs, num_syncs) &&xe_engine_is_idle (eng_override)) { +if (no_in_syncs (syncs, num_syncs) &&xe_engine_is_idle (eng_override) && + !found_dep) { fence = xe_migrate_update_pgtables_cpu(m, vm, bo, updates, num_updates, first_munmap_rebind,
@@ -1293,11 +1323,47 @@ xe_migrate_update_pgtables(struct xe_migrate *m,if (err) goto err_job; +/* Add inter-engine dep */ + index =ALIGN_DOWN (xe_vma_start (vma),0x1ull <<xe_pt_shift (level)); + last =ALIGN (xe_vma_end (vma),0x1ull <<xe_pt_shift (level)) -1 ; + job->bind_args.index = index; + job->bind_args.last = last; +mt_for_each (&vm->mtree[tile->id], dep_job, index, last) { + dep_fence = dep_job->fence; + +if (dma_fence_is_signaled (dep_fence)) { +remove_dep_job (&vm->mtree[tile->id], dep_job); + }else { +if (eng_override != dep_job->engine) { +dma_fence_get (dep_fence); + err =drm_sched_job_add_dependency (&job->drm, + dep_fence); +if (err) + goto err_job; + } + +if (dep_job->bind_args.index < job->bind_args.index) + job->bind_args.index = dep_job->bind_args.index; +if (dep_job->bind_args.last > job->bind_args.last) + job->bind_args.last = dep_job->bind_args.last; + +remove_dep_job (&vm->mtree[tile->id], dep_job); + } + } + err =mtree_insert_range (&vm->mtree[tile->id], job->bind_args.index, + job->bind_args.last, job,GFP_KERNEL ); +if (err) + goto err_job; + +dma_fence_get (job->fence); +xe_sched_job_get (job); +if (ops->pre_commit) { err = ops->pre_commit (pt_update);if (err) - goto err_job; + goto err_mtree; } +xe_sched_job_arm (job); fence =dma_fence_get (&job->drm.s_fence->finished);xe_sched_job_push (job);
@@ -1310,6 +1376,8 @@ xe_migrate_update_pgtables(struct xe_migrate *m,return fence; +err_mtree: +remove_dep_job (&vm->mtree[tile->id], job); err_job:xe_sched_job_put (job); err_bb:
drivers/gpu/drm/xe/xe_sched_job_types.h +7 -0
@@ -37,6 +37,13 @@ struct xe_sched_job {/** @value: write back value */ u64 value; } user_fence; +/** @bind_args: if a bind job, the bind arguments */ +struct { +/** @index: index of job a bind job stored in a mtree */ +unsigned long index; +/** @last: last of job a bind job stored in a mtree */ +unsigned long last; + } bind_args;/** @migrate_flush_flags: Additional flush flags for migration jobs */ u32 migrate_flush_flags;/** @batch_addr: batch buffer address of job */
drivers/gpu/drm/xe/xe_vm.c +18 -0
@@ -1233,6 +1233,8 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags) tile->id != XE_VM_FLAG_GT_ID(flags))continue ; +mt_init (&vm->mtree[id]); + vm->pt_root[id] =xe_pt_create (vm, tile, xe->info.vm_max_level);if (IS_ERR (vm->pt_root[id])) { err =PTR_ERR (vm->pt_root[id]);
@@ -1402,6 +1404,21 @@ void xe_vm_close_and_put(struct xe_vm *vm) }down_write (&vm->lock); + +for_each_tile (tile, xe, id) { +struct xe_sched_job *job; +unsigned long index =0 , max =ULONG_MAX ; + +if (!vm->pt_root[id]) +continue ; + +mt_for_each (&vm->mtree[id], job, index, max) { +mtree_erase (&vm->mtree[tile->id], job->bind_args.index); +dma_fence_put (job->fence); +xe_sched_job_put (job); + } + } +xe_vm_lock (vm, &ww,0 , false);while (vm->vmas.rb_node) {struct xe_vma *vma =to_xe_vma (vm->vmas.rb_node);
@@ -1507,6 +1524,7 @@ static void vm_destroy_work_func(struct work_struct *w)xe_vm_lock (vm, &ww,0 , false);for_each_tile (tile, xe, id) {if (vm->pt_root[id]) { +mtree_destroy (&vm->mtree[id]);xe_pt_destroy (vm->pt_root[id], vm->flags,NULL ); vm->pt_root[id] =NULL ; }
drivers/gpu/drm/xe/xe_vm_types.h +6 -0
@@ -8,6 +8,7 @@#include <linux/dma-resv.h> #include <linux/kref.h> +#include <linux/maple_tree.h> #include <linux/mmu_notifier.h> #include <linux/scatterlist.h>
@@ -160,6 +161,11 @@ struct xe_vm {struct kref refcount; +/** +* @mtree: the &maple_tree to track of conflicts between bind engines +*/ +struct maple_tree mtree[XE_MAX_TILES_PER_DEVICE ]; +/* engine used for (un)binding vma's */ struct xe_engine *eng[XE_MAX_TILES_PER_DEVICE ];
Signature · 1 line
2.34.1
Thomas Hellström
maintainerRe: [Intel-xe] [PATCH 2/2] drm/xe: Make bind engines safe
Quoted 8 lines · Matthew Brost
We currently have a race between bind engines which can result in corrupted page tables leading to faults.
A simple example:
bind A 0x0000-0x1000, engine A, has unsatisfied in-fence bind B 0x1000-0x2000, engine B, no in-fences exec A uses 0x1000-0x2000
Don't we have an unbind race as well?
exec A uses 0x1000-0x2000
unbind A unbinds 0x1000-0x2000 behind an exec in-fence. unbind B unbinds 0x0000-0x1000
Boom.
Quoted 63 lines
Bind B will pass bind A and exec A will fault. This occurs as bind A programs the root of the page table in a bind job which is held up by an
in-fence. Bind B in this case just programs a leaf entry of the structure.To fix this introduce a per VM maple tree to track cross engine conflicts. In the above example bind A would insert an dependency in the
maple tree with a key of 0x0-0x7fffffffff, bind B would find that dependency and its bind job would scheduled behind the unsatisfied in-fence and bind A's job.Cc Thomas Hellström <[email protected]>Signed-off-by Matthew Brost <[email protected]>---
drivers/gpu/drm/xe/xe_migrate.c | 76
+++++++++++++++++++++++--
drivers/gpu/drm/xe/xe_sched_job_types.h | 7 +++ drivers/gpu/drm/xe/xe_vm.c | 18 ++++++ drivers/gpu/drm/xe/xe_vm_types.h | 6 ++4 files changed, 103 insertions(+), 4 deletions(-)drivers/gpu/drm/xe/xe_migrate.c +0
-0@@ -1109,6 +1109,14 @@ static bool no_in_syncs(struct xe_sync_entry *syncs, u32 num_syncs) return true; }drivers/gpu/drm/xe/xe_migrate.c +8
-0+static void remove_dep_job (struct maple_tree *mtree, + struct xe_sched_job *dep_job) +{ + mtree_erase(mtree, dep_job->bind_args.index); + dma_fence_put(dep_job->fence); + xe_sched_job_put(dep_job); +} +/**
*xe_migrate_update_pgtables()- Pipelined page-table update
* @m: The migrate context.drivers/gpu/drm/xe/xe_migrate.c +2
-2@@ -1150,8 +1158,8 @@ xe_migrate_update_pgtables(struct xe_migrate *m, struct xe_tile *tile = m->tile; struct xe_gt *gt = tile->primary_gt; struct xe_device *xe = tile_to_xe(tile); - struct xe_sched_job *job; - struct dma_fence *fence; + struct xe_sched_job *job, *dep_job; + struct dma_fence *fence, *dep_fence; struct drm_suballoc *sa_bo = NULL; struct xe_vma *vma = pt_update->vma;struct
xe_bb*bb;drivers/gpu/drm/xe/xe_migrate.c +2
-0@@ -1161,9 +1169,31 @@ xe_migrate_update_pgtables(struct xe_migrate *m, bool usm = !eng && xe->info.supports_usm; bool first_munmap_rebind = vma && vma->first_munmap_rebind; struct xe_engine *eng_override = !eng ? m->eng : eng; + int level = 0; + bool found_dep = false;
drivers/gpu/drm/xe/xe_migrate.c xe_migrate_update_pgtables(struct xe_migrate · line 1184
Quoted 10 lines
drivers/gpu/drm/xe/xe_migrate.c +9
-0+ unsigned long index, last; + + /* Find inter-engine deps */ + for (i = 0; i < num_updates; i++) { + const struct xe_vm_pgtable_update *update = &updates[i]; + + if (update->pt->level > level) + level = update->pt->level; + }
This looks sub-optimal. What if index should be aligned down to level 2 and last aligned up to level 1?
drivers/gpu/drm/xe/xe_migrate.c xe_migrate_update_pgtables(struct xe_migrate · line 1185
Quoted 1 line
drivers/gpu/drm/xe/xe_migrate.c +1
-0+ index = ALIGN_DOWN(xe_vma_start(vma), 0x1ull <<
Doesn't build here.
drivers/gpu/drm/xe/xe_migrate.c xe_migrate_update_pgtables(struct xe_migrate · line 1189
Quoted 4 lines
drivers/gpu/drm/xe/xe_migrate.c +2
-0xe_pt_shift(level)); + last = ALIGN(xe_vma_end(vma), 0x1ull << xe_pt_shift(level)) -1 ; + mt_for_each(&vm->mtree[tile->id], dep_job, index, last) {
Did this really pass the migrate selftest?
Quoted 50 lines
drivers/gpu/drm/xe/xe_migrate.c +7
-0+ dep_fence = dep_job->fence; + + if (dma_fence_is_signaled(dep_fence)) + remove_dep_job(&vm->mtree[tile->id], dep_job); + else if (eng_override != dep_job->engine) + found_dep = true; + }
/* Use the CPU if no in syncs and engine is idle */ - if (no_in_syncs(syncs, num_syncs)&&xe_engine_is_idle(eng_override)) {
+ if (no_in_syncs(syncs, num_syncs)&&xe_engine_is_idle(eng_override)&&
+ !found_dep) {
fence = xe_migrate_update_pgtables_cpu(m, vm, bo, updates,
num_updates,first_munmap_rebind,drivers/gpu/drm/xe/xe_migrate.c +0
-0@@ -1293,11 +1323,47 @@ xe_migrate_update_pgtables(struct xe_migrate *m, if (err) goto err_job;
+ /* Add inter-engine dep */
+ index =ALIGN_DOWN(xe_vma_start(vma), 0x1ull << xe_pt_shift(level));
+ last =ALIGN(xe_vma_end(vma), 0x1ull << xe_pt_shift(level))- 1;
+ job->bind_args.index = index;
+ job->bind_args.last = last;
+ mt_for_each(&vm->mtree[tile->id],dep_job, index, last) { + dep_fence =dep_job->fence;
+
+ if (dma_fence_is_signaled(dep_fence)) {
+ remove_dep_job(&vm->mtree[tile->id],dep_job);
+ } else {
+ if (eng_override!=dep_job->engine) { + dma_fence_get(dep_fence); + err = drm_sched_job_add_dependency(&job->drm,
+dep_fence);
+ if (err)
+ gotoerr_job;
+ }
+
+ if (dep_job->bind_args.index< job-
Quoted 8 lines
Quoted 1 line
bind_args.index)
+ job->bind_args.index = dep_job-
Quoted 1 line
bind_args.index;
+ if (
dep_job->bind_args.last> job-Quoted 1 line
bind_args.last)
+ job->bind_args.last = dep_job-
Quoted 1 line
bind_args.last;
+
This makes it possible to use an mtree but may carry unneeded dependencies forward long after the bind in question have signaled. Why not use an interval tree? Sure, you'd need to instantiate a new one to get the needed 64-bit VA ranges, but you could then separate it out as a utility with a range and a fence to avoid open-coding it all here and add vm-specific fields to the sched job.
Quoted 42 lines
+ remove_dep_job(&vm->mtree[tile->id],
dep_job);
+ }
+ }
+ err = mtree_insert_range(&vm->mtree[tile->id], job-Quoted 1 line
bind_args.index,
+
job->bind_args.last, job,GFP_KERNEL);
+ if (err)
+ gotoerr_job;drivers/gpu/drm/xe/xe_migrate.c +4
-0+ + dma_fence_get(job->fence); + xe_sched_job_get(job); +if (
ops->pre_commit) {
err =ops->pre_commit(pt_update); if (err)
- gotoerr_job;
+ gotoerr_mtree;
}
+
xe_sched_job_arm(job);
fence =dma_fence_get(&job->drm.s_fence->finished);xe_sched_job_push(job);drivers/gpu/drm/xe/xe_migrate.c +0
-0@@ -1310,6 +1376,8 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
return fence;
+err_mtree:
+ remove_dep_job(&vm->mtree[tile->id], job);err_job:
xe_sched_job_put(job);
err_bb:drivers/gpu/drm/xe/xe_sched_job_types.h +0
-0@@ -37,6 +37,13 @@ struct xe_sched_job { /** @value: write back value */ u64 value;
drivers/gpu/drm/xe/xe_sched_job_types.h struct xe_sched_job { · line 48
Quoted 10 lines
drivers/gpu/drm/xe/xe_sched_job_types.h +7
-0} user_fence; + /** @bind_args: if a bind job, the bind arguments */ + struct { + /** @index: index of job a bind job stored in a mtree */ + unsigned long index; + /** @last: last of job a bind job stored in a mtree */ + unsigned long last; + } bind_args;
What lock protects these?
Quoted 67 lines
drivers/gpu/drm/xe/xe_sched_job_types.h +0
-0/** @migrate_flush_flags: Additional flush flags formigration jobs */
u32migrate_flush_flags;
/** @batch_addr: batch buffer address of job */drivers/gpu/drm/xe/xe_vm.c +0
-0@@ -1233,6 +1233,8 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags) tile->id != XE_VM_FLAG_GT_ID(flags)) continue;
+ mt_init(&vm->mtree[id]);
+
vm->pt_root[id] = xe_pt_create(vm, tile, xe-Quoted 1 line
info.vm_max_level);
if (
IS_ERR(vm->pt_root[id])) { err =PTR_ERR(vm->pt_root[id]);drivers/gpu/drm/xe/xe_vm.c +0
-0@@ -1402,6 +1404,21 @@ void xe_vm_close_and_put(struct xe_vm *vm) }
down_write(&vm->lock);drivers/gpu/drm/xe/xe_vm.c +10
-0+ + for_each_tile(tile, xe, id) { + struct xe_sched_job *job; + unsigned long index = 0, max = ULONG_MAX; + + if (!vm->pt_root[id]) + continue; + + mt_for_each(&vm->mtree[id], job, index, max) { + mtree_erase(&vm->mtree[tile->id], job-Quoted 1 line
bind_args.index);
+ dma_fence_put(job->fence);
+ xe_sched_job_put(job);
+ }
+ }
+
xe_vm_lock(vm, &ww, 0, false);
while (vm->vmas.rb_node) {
structxe_vma*vma =to_xe_vma(vm->vmas.rb_node);drivers/gpu/drm/xe/xe_vm.c +1
-0@@ -1507,6 +1524,7 @@ static void vm_destroy_work_func(struct work_struct *w) xe_vm_lock(vm, &ww, 0, false); for_each_tile(tile, xe, id) { if (vm->pt_root[id]) { + mtree_destroy(&vm->mtree[id]); xe_pt_destroy(vm->pt_root[id], vm->flags, NULL);vm->pt_root[id] = NULL;
}drivers/gpu/drm/xe/xe_vm_types.h +0
-0@@ -8,6 +8,7 @@
#include <linux/dma-resv.h>
#include <linux/kref.h>
+#include <linux/maple_tree.h>
#include <linux/mmu_notifier.h>
#include <linux/scatterlist.h>drivers/gpu/drm/xe/xe_vm_types.h +0
-0@@ -160,6 +161,11 @@ struct xe_vm {
Quoted 8 lines
struct kref refcount;
+ /**
+ * @mtree: the&maple_treeto track of conflicts between bind engines
+ */
+ structmaple_treemtree[XE_MAX_TILES_PER_DEVICE]; +
And similarly what protects the mtree? Please document.
Quoted 3 lines
/* engine used for (un)binding vma's */ struct
xe_engine*eng[XE_MAX_TILES_PER_DEVICE];
As a general question, why do you choose to bleed dependency tracking that should be known only to the vm code into the migrate code and the sched job code and then open-code it all in the migrate code? That xe_migrate_update_pgtables() was already hard to follow, that's why I used pre_commit() for separation in the first patch, passing xe_sched_job around for dependency adding only.
Also I think it should be beneficial to separate out the range-fence tracking to something like the below to avoid leaking vm stuff into xe_sched_job.
/Thomas
Patchwork
CI[Intel-xe] ✓ CI.Patch_applied: success for Another attempt to fix two bind races
In reply to Matthew Brost== Series Details ==
== Series Details ==
Series: Another attempt to fix two bind races
URL : https://patchwork.freedesktop.org/series/120121/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 53bd6056f drm/xe/display: Append dma_buf fences to framebuffer fences === git am output follows ===
Applying: drm/xe: Make page-table updates using the default engine
Applying: drm/xe: Make bind engines safe
Patchwork
CI[Intel-xe] ✓ CI.checkpatch: success for Another attempt to fix two bind races
In reply to Matthew Brost== Series Details ==
== Series Details ==
Series: Another attempt to fix two bind races
URL : https://patchwork.freedesktop.org/series/120121/
State : success
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master c7d32770e3cd31d9fc134ce41f329b10aa33ee15
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 3c5c9b5d2a325f1177c6db1b6a2079fc99619b7f
Author: Matthew Brost <[email protected]> Date: Sun Jul 2 15:17:10 2023 -0700
drm/xe: Make bind engines safe
We currently have a race between bind engines which can result in corrupted page tables leading to faults.
A simple example:
bind A 0x0000-0x1000, engine A, has unsatisfied in-fence bind B 0x1000-0x2000, engine B, no in-fences exec A uses 0x1000-0x2000
Bind B will pass bind A and exec A will fault. This occurs as bind A programs the root of the page table in a bind job which is held up by an in-fence. Bind B in this case just programs a leaf entry of the structure.
To fix this introduce a per VM maple tree to track cross engine conflicts. In the above example bind A would insert an dependency in the maple tree with a key of 0x0-0x7fffffffff, bind B would find that dependency and its bind job would scheduled behind the unsatisfied in-fence and bind A's job.
+ /mt/dim checkpatch 53bd6056f6ec9a4f6c341d4f24122ede47a43de9 drm-intel a10aebd21 drm/xe: Make page-table updates using the default engine 3c5c9b5d2 drm/xe: Make bind engines safe
Patchwork
CI[Intel-xe] ✗ CI.KUnit: failure for Another attempt to fix two bind races
In reply to Matthew Brost== Series Details ==
== Series Details ==
Series: Another attempt to fix two bind races
URL : https://patchwork.freedesktop.org/series/120121/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig Traceback (most recent call last):
File "/kernel/tools/testing/kunit/kunit.py", line 24, in <module>
import kunit_kernel
File "/kernel/tools/testing/kunit/kunit_kernel.py", line 42, in <module>
class LinuxSourceTreeOperations:
File "/kernel/tools/testing/kunit/kunit_kernel.py", line 95, in LinuxSourceTreeOperations
def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]:
TypeError: 'type' object is not subscriptable
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel