On 6/12/2026 10:38 PM, Huang, Honglei wrote:
+int
+amdgpu_svm_attr_check_vm_bo(struct amdgpu_svm_attr_tree *attr_tree,
+                unsigned long start_page,
+                unsigned long last_page,
+                unsigned long *bo_start, unsigned long *bo_last)
+{
+    struct amdgpu_svm *svm = attr_tree->svm;
+    struct amdgpu_vm *vm = svm->vm;
+    struct interval_tree_node *node;
+    int r;
+
+    r = amdgpu_bo_reserve(vm->root.bo, false);
+    if (r)
+        return r;
+
+    node = interval_tree_iter_first(&vm->va, start_page, last_page);
+    if (node) {
+        AMDGPU_SVM_ERR("SVM range [0x%lx 0x%lx] overlaps with BO mapping [0x%lx 0x%lx]\n",
+                   start_page, last_page, node->start, node->last);

Yeah that approach is a clear NAK.

We must enforce that based on the range I think.

How about mirror what xe does, but on amdgpu_vm. xe puts SVM ranges into the same drm_gpuvm va tree as BO mappings, tagged with
XE_VMA_FLAG_CPU_ADDR_MIRROR, so overlap is enforced by drm_gpuvm at
insert time.

vm->va is already an interval tree of amdgpu_bo_va_mapping with
amdgpu_vm_bo_map() doing the overlap check on insert.

But it needs some modifications in amdgpu vm, so what is the next step?
What is the feasabile design in you side?

I removed the amdgpu_svm_attr_check_vm_bo, it is a defensive code, so it did not generate any regression, kfd test /rocr /HIP test result are all same with previous.

Can I put this check into TODO list? We may need to figure out a solid design, and it seems like needs some modifications in amdgpu VM?

Regards,
Honglei


Reply via email to