[PATCH] drm/i915/gvt: Add runtime_pm_get/put around gvt_switch_mmio at vgpu destroy

Zhang, Xiong Y xiong.y.zhang at intel.com
Fri Feb 2 01:38:59 UTC 2018


> On 2018.02.02 06:55:22 +0800, Xiong Zhang wrote:
> > If user continuously create vgpu, boot guest, shoutdown guest and
> > destroy vgpu from remote, the following calltrace exists in dmesg
> sometimes:
> > [ 6412.954721] RPM wakelock ref not held during HW access [
> > 6412.954795] WARNING: CPU: 7 PID: 11941 at
> > linux/drivers/gpu/drm/i915/intel_drv.h:1800
> intel_uncore_forcewake_get.part.7+0x96/0xa0 [i915] [ 6412.954915] Call
> Trace:
> > [ 6412.954951] intel_uncore_forcewake_get+0x18/0x20 [i915] [
> > 6412.954989] intel_gvt_switch_mmio+0x8e/0x770 [i915] [ 6412.954996] ?
> > __slab_free+0x14d/0x2c0 [ 6412.955001] ? __slab_free+0x14d/0x2c0 [
> > 6412.955006] ? __slab_free+0x14d/0x2c0 [ 6412.955041]
> > intel_vgpu_stop_schedule+0x92/0xd0 [i915] [ 6412.955073]
> > intel_gvt_deactivate_vgpu+0x48/0x60 [i915] [ 6412.955078]
> > __intel_vgpu_release+0x55/0x260 [kvmgt]
> >
> > when this happens, gvt_switch_mmio is called at vgpu destroy, host
> > i915 is idle and doesn't hold RPM wakelock, IGD is in powersave mode,
> > but gvt_switch_mmio require igd power on to access register, so
> > intel_runtime_pm_get should be added to make sure igd power on before
> > gvt_switch_mmio at vgpu destroy.
> >
> > Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/sched_policy.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c
> > b/drivers/gpu/drm/i915/gvt/sched_policy.c
> > index cc1ce36..a714064 100644
> > --- a/drivers/gpu/drm/i915/gvt/sched_policy.c
> > +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
> > @@ -416,8 +416,10 @@ void intel_vgpu_stop_schedule(struct intel_vgpu
> *vgpu)
> >  	spin_lock_bh(&scheduler->mmio_context_lock);
> >  	for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) {
> >  		if (scheduler->engine_owner[ring_id] == vgpu) {
> > +			intel_runtime_pm_get(vgpu->gvt->dev_priv);
> >  			intel_gvt_switch_mmio(vgpu, NULL, ring_id);
> >  			scheduler->engine_owner[ring_id] = NULL;
> > +			intel_runtime_pm_put(vgpu->gvt->dev_priv);
> >  		}
> 
> Could we do that in switch mmio as always required?
[Zhang, Xiong Y] This patch just fix corner case. At the beginning I'm afraid the performance drop when we move this into switch mmio. After checking code, intel_runtime_pm_get/put only do inc/dec refcount in normal workload submission, so the performance impact is minor. 
I will submit the v2 patch which move runtime_get/put into switch_mmio.

thanks
> 
> >  	}
> >  	spin_unlock_bh(&scheduler->mmio_context_lock);
> > --
> > 2.7.4
> >
> > _______________________________________________
> > intel-gvt-dev mailing list
> > intel-gvt-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
> 
> --
> Open Source Technology Center, Intel ltd.
> 
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827


More information about the intel-gvt-dev mailing list