[v2] drm/i915/gvt: ensure gpu is powered before do i915_gem_gtt_insert

Submitted by hang.yuan@linux.intel.com on Oct. 30, 2018, 5:12 a.m.

Details

Message ID 1540876343-9125-1-git-send-email-hang.yuan@linux.intel.com
State New
Series "drm/i915/gvt: ensure gpu is powered before do i915_gem_gtt_insert"
Headers show

Commit Message

hang.yuan@linux.intel.com Oct. 30, 2018, 5:12 a.m.
From: Hang Yuan <hang.yuan@linux.intel.com>

i915_gem_gtt_insert may evict some vmas and access HW if ggtt
vm space is not enough. So add mmio_hw_access_pre before invoke
i915_gem_gtt_insert to avoid call trace like below in vgpu create/
destroy test.

WARNING: CPU: 6 PID: 8720 at drivers/gpu/drm/i915/intel_drv.h:1768
assert_rpm_wakelock_held.part.2+0x27/0x30 [i915]
RPM wakelock ref not held during HW access

Call Trace:
  [<ffffffff99af3b22>] dump_stack+0x19/0x1b
  [<ffffffff9948e338>] __warn+0xd8/0x100
  [<ffffffff9948e3bf>] warn_slowpath_fmt+0x5f/0x80
  [<ffffffffc0d5cc32>] assert_rpm_wakelock_held.part.2+0x27/0x30 [i915]
  [<ffffffffc0c7ffcf>] intel_runtime_pm_get_noresume+0x6f/0x80 [i915]
  [<ffffffffc0ca614d>] i915_gem_request_alloc+0x2dd/0x3c0 [i915]
  [<ffffffffc0c9056e>] i915_gem_switch_to_kernel_context+0xae/0x1d0 [i915]
  [<ffffffffc0c91572>] ggtt_flush+0x12/0x30 [i915]
  [<ffffffffc0c917ef>] i915_gem_evict_something+0x25f/0x470 [i915]
  [<ffffffffc0c9b62c>] i915_gem_gtt_insert+0x15c/0x1c0 [i915]
  [<ffffffffc0d35837>] alloc_gm+0xa7/0x160 [i915]
  [<ffffffffc0d35d8d>] intel_vgpu_alloc_resource+0x1ad/0x410 [i915]
  [<ffffffffc0d4819c>] intel_gvt_create_vgpu+0x16c/0x260 [i915]
  [<ffffffffc055d980>] intel_vgpu_create+0x50/0x140 [kvmgt]
  [<ffffffffc04fc6fa>] mdev_device_create+0x1aa/0x2e0 [mdev]

v2: use mmio_hw_access_pre/post <Zhenyu>

Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
---
 drivers/gpu/drm/i915/gvt/aperture_gm.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/gvt/aperture_gm.c b/drivers/gpu/drm/i915/gvt/aperture_gm.c
index fe75402..359d37d 100644
--- a/drivers/gpu/drm/i915/gvt/aperture_gm.c
+++ b/drivers/gpu/drm/i915/gvt/aperture_gm.c
@@ -61,10 +61,12 @@  static int alloc_gm(struct intel_vgpu *vgpu, bool high_gm)
 	}
 
 	mutex_lock(&dev_priv->drm.struct_mutex);
+	mmio_hw_access_pre(dev_priv);
 	ret = i915_gem_gtt_insert(&dev_priv->ggtt.vm, node,
 				  size, I915_GTT_PAGE_SIZE,
 				  I915_COLOR_UNEVICTABLE,
 				  start, end, flags);
+	mmio_hw_access_post(dev_priv);
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 	if (ret)
 		gvt_err("fail to alloc %s gm space from host\n",

Comments

gvt@intel.com Oct. 30, 2018, 7:08 a.m.

Zhenyu Wang Nov. 12, 2018, 9 a.m.
On 2018.10.30 13:12:23 +0800, intel-gvt-dev-bounces@lists.freedesktop.org wrote:
> From: Hang Yuan <hang.yuan@linux.intel.com>
> 
> i915_gem_gtt_insert may evict some vmas and access HW if ggtt
> vm space is not enough. So add mmio_hw_access_pre before invoke
> i915_gem_gtt_insert to avoid call trace like below in vgpu create/
> destroy test.
> 
> WARNING: CPU: 6 PID: 8720 at drivers/gpu/drm/i915/intel_drv.h:1768
> assert_rpm_wakelock_held.part.2+0x27/0x30 [i915]
> RPM wakelock ref not held during HW access
> 
> Call Trace:
>   [<ffffffff99af3b22>] dump_stack+0x19/0x1b
>   [<ffffffff9948e338>] __warn+0xd8/0x100
>   [<ffffffff9948e3bf>] warn_slowpath_fmt+0x5f/0x80
>   [<ffffffffc0d5cc32>] assert_rpm_wakelock_held.part.2+0x27/0x30 [i915]
>   [<ffffffffc0c7ffcf>] intel_runtime_pm_get_noresume+0x6f/0x80 [i915]
>   [<ffffffffc0ca614d>] i915_gem_request_alloc+0x2dd/0x3c0 [i915]
>   [<ffffffffc0c9056e>] i915_gem_switch_to_kernel_context+0xae/0x1d0 [i915]
>   [<ffffffffc0c91572>] ggtt_flush+0x12/0x30 [i915]
>   [<ffffffffc0c917ef>] i915_gem_evict_something+0x25f/0x470 [i915]
>   [<ffffffffc0c9b62c>] i915_gem_gtt_insert+0x15c/0x1c0 [i915]
>   [<ffffffffc0d35837>] alloc_gm+0xa7/0x160 [i915]
>   [<ffffffffc0d35d8d>] intel_vgpu_alloc_resource+0x1ad/0x410 [i915]
>   [<ffffffffc0d4819c>] intel_gvt_create_vgpu+0x16c/0x260 [i915]
>   [<ffffffffc055d980>] intel_vgpu_create+0x50/0x140 [kvmgt]
>   [<ffffffffc04fc6fa>] mdev_device_create+0x1aa/0x2e0 [mdev]
> 
> v2: use mmio_hw_access_pre/post <Zhenyu>
> 
> Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
> ---

Applied this! Sorry for the delay.