From: Dan Carpenter <dan.carpenter@oracle.com>
To: pei.zhang@intel.com
Cc: intel-gfx@lists.freedesktop.org, igvt-g-dev@ml01.01.org
Subject: [bug report] drm/i915/gvt: fix deadlock in workload_thread
Date: Thu, 24 Nov 2016 01:17:06 +0300 [thread overview]
Message-ID: <20161123135504.GA3304@mwanda> (raw)
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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2016-11-23 22:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 22:17 Dan Carpenter [this message]
2016-11-24 2:40 ` [igvt-g-dev] [bug report] drm/i915/gvt: fix deadlock in workload_thread Zhenyu Wang
2016-11-24 7:09 ` Zhang, Pei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161123135504.GA3304@mwanda \
--to=dan.carpenter@oracle.com \
--cc=igvt-g-dev@ml01.01.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=pei.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox