Hi Janusz,
> On completion of i915_vma_pin_ww(), a synchronous variant of
> dma_fence_work_commit() is called. When pinning a VMA to GGTT address
> space on a Cherry View family processor, or on a Broxton generation SoC
> with VTD enabled, i.e., when stop_machine() is then called from
> intel_ggtt_bind_vma(), that can potentially lead to lock inversion among
> reservation_ww and cpu_hotplug locks.
>
[...]
> Call asynchronous variant of dma_fence_work_commit() in that case.
>
> Fixes: 7d1c2618eac59 ("drm/i915: Take reservation lock around i915_vma_pin.")
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14985
> Signed-off-by: Janusz Krzysztofik <[email protected]>
> ---
> drivers/gpu/drm/i915/i915_vma.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 25e97031d76e4..20deb01c0e5fe 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -1595,8 +1595,14 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct
> i915_gem_ww_ctx *ww,
> err_vma_res:
> i915_vma_resource_free(vma_res);
> err_fence:
> - if (work)
> - dma_fence_work_commit_imm(&work->base);
> + if (work) {
> + /* don't risk lockdep splat against stop_machine() */
> + if (i915_vma_is_ggtt(vma) &&
> + intel_vm_no_concurrent_access_wa(vma->vm->i915))
> + dma_fence_work_commit(&work->base);
> + else
> + dma_fence_work_commit_imm(&work->base);
> + }
> err_rpm:
> intel_runtime_pm_put(&vma->vm->i915->runtime_pm, wakeref);
>
> --
> 2.51.0
>
Reviewed-by: Krzysztof Karas <[email protected]>
--
Best Regards,
Krzysztof