drm/i915: Track ggtt fence reservations under its own mutex
We can reduce the locking for fence registers from the dev->struct_mutex to a local mutex. We could introduce a mutex for the sole purpose of tracking the fence acquisition, except there is a little bit of overlap with the fault tracking, so use the i915_ggtt.mutex as it covers both. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190822060914.2671-1-chris@chris-wilson.co.uk
This commit is contained in:
@@ -172,14 +172,14 @@ static void free_vgpu_fence(struct intel_vgpu *vgpu)
|
||||
|
||||
intel_runtime_pm_get(&dev_priv->runtime_pm);
|
||||
|
||||
mutex_lock(&dev_priv->drm.struct_mutex);
|
||||
mutex_lock(&dev_priv->ggtt.vm.mutex);
|
||||
_clear_vgpu_fence(vgpu);
|
||||
for (i = 0; i < vgpu_fence_sz(vgpu); i++) {
|
||||
reg = vgpu->fence.regs[i];
|
||||
i915_unreserve_fence(reg);
|
||||
vgpu->fence.regs[i] = NULL;
|
||||
}
|
||||
mutex_unlock(&dev_priv->drm.struct_mutex);
|
||||
mutex_unlock(&dev_priv->ggtt.vm.mutex);
|
||||
|
||||
intel_runtime_pm_put_unchecked(&dev_priv->runtime_pm);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ static int alloc_vgpu_fence(struct intel_vgpu *vgpu)
|
||||
intel_runtime_pm_get(rpm);
|
||||
|
||||
/* Request fences from host */
|
||||
mutex_lock(&dev_priv->drm.struct_mutex);
|
||||
mutex_lock(&dev_priv->ggtt.vm.mutex);
|
||||
|
||||
for (i = 0; i < vgpu_fence_sz(vgpu); i++) {
|
||||
reg = i915_reserve_fence(dev_priv);
|
||||
@@ -207,7 +207,7 @@ static int alloc_vgpu_fence(struct intel_vgpu *vgpu)
|
||||
|
||||
_clear_vgpu_fence(vgpu);
|
||||
|
||||
mutex_unlock(&dev_priv->drm.struct_mutex);
|
||||
mutex_unlock(&dev_priv->ggtt.vm.mutex);
|
||||
intel_runtime_pm_put_unchecked(rpm);
|
||||
return 0;
|
||||
out_free_fence:
|
||||
@@ -220,7 +220,7 @@ out_free_fence:
|
||||
i915_unreserve_fence(reg);
|
||||
vgpu->fence.regs[i] = NULL;
|
||||
}
|
||||
mutex_unlock(&dev_priv->drm.struct_mutex);
|
||||
mutex_unlock(&dev_priv->ggtt.vm.mutex);
|
||||
intel_runtime_pm_put_unchecked(rpm);
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
Reference in New Issue
Block a user