[Intel-gfx] [bug report] drm/i915/gvt: fix deadlock in workload_thread
Dan Carpenter
dan.carpenter at oracle.com
Wed Nov 23 22:17:06 UTC 2016
Hello Pei Zhang,
The patch 90d27a1b180e: "drm/i915/gvt: fix deadlock in
workload_thread" from Nov 14, 2016, leads to the following static
checker warning:
drivers/gpu/drm/i915/gvt/scheduler.c:217 dispatch_workload()
warn: inconsistent returns 'mutex:&dev_priv->drm.struct_mutex'.
drivers/gpu/drm/i915/gvt/scheduler.c
161 static int dispatch_workload(struct intel_vgpu_workload *workload)
162 {
163 int ring_id = workload->ring_id;
164 struct i915_gem_context *shadow_ctx = workload->vgpu->shadow_ctx;
165 struct drm_i915_private *dev_priv = workload->vgpu->gvt->dev_priv;
166 struct drm_i915_gem_request *rq;
167 int ret;
168
169 gvt_dbg_sched("ring id %d prepare to dispatch workload %p\n",
170 ring_id, workload);
171
172 shadow_ctx->desc_template = workload->ctx_desc.addressing_mode <<
173 GEN8_CTX_ADDRESSING_MODE_SHIFT;
174
175 mutex_lock(&dev_priv->drm.struct_mutex);
176
177 rq = i915_gem_request_alloc(dev_priv->engine[ring_id], shadow_ctx);
178 if (IS_ERR(rq)) {
179 gvt_err("fail to allocate gem request\n");
180 workload->status = PTR_ERR(rq);
181 return workload->status;
We're holding the lock here, which is obviously a bug. But also should
we goto out? I always thought that functions with an "out" label were
future proof?
182 }
183
184 gvt_dbg_sched("ring id %d get i915 gem request %p\n", ring_id, rq);
185
186 workload->req = i915_gem_request_get(rq);
187
188 ret = intel_gvt_scan_and_shadow_workload(workload);
189 if (ret)
190 goto out;
191
192 ret = intel_gvt_scan_and_shadow_wa_ctx(&workload->wa_ctx);
193 if (ret)
194 goto out;
195
regards,
dan carpenter
More information about the Intel-gfx
mailing list