Skip to content

Commit 2ce9093

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: mmu: Fix deadlock on remap ops
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 7307fdf commit 2ce9093

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/gpu/drm/asahi/mmu.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ struct StepContext {
231231
prev_va: Option<Pin<KBox<gpuvm::GpuVa<VmInner>>>>,
232232
next_va: Option<Pin<KBox<gpuvm::GpuVa<VmInner>>>>,
233233
vm_bo: Option<ARef<gpuvm::GpuVmBo<VmInner>>>,
234+
prev_vm_bo_1: Option<ARef<gpuvm::GpuVmBo<VmInner>>>,
235+
prev_vm_bo_2: Option<ARef<gpuvm::GpuVmBo<VmInner>>>,
234236
prot: u32,
235237
}
236238

@@ -412,6 +414,17 @@ impl gpuvm::DriverGpuVm for VmInner {
412414
}
413415
}
414416

417+
if ctx.prev_vm_bo_1.is_none() {
418+
assert!(ctx.prev_vm_bo_1.replace(vm_bo).is_none());
419+
} else if ctx.prev_vm_bo_2.is_none() {
420+
assert!(ctx.prev_vm_bo_2.replace(vm_bo).is_none());
421+
} else {
422+
dev_crit!(
423+
self.dev.as_ref(),
424+
"step_remap: too many remap ops, deadlock expected"
425+
);
426+
}
427+
415428
Ok(())
416429
}
417430
}

0 commit comments

Comments
 (0)