From: Dan Carpenter <dan.carpenter@oracle.com>
To: chris@chris-wilson.co.uk
Cc: intel-gfx@lists.freedesktop.org
Subject: [bug report] drm/i915/selftests: Exercise context switching in parallel
Date: Fri, 11 Oct 2019 14:42:09 +0300 [thread overview]
Message-ID: <20191011114209.GA29460@mwanda> (raw)
Hello Chris Wilson,
This is a semi-automatic email about new static checker warnings.
The patch 50d16d44cce4: "drm/i915/selftests: Exercise context
switching in parallel" from Sep 30, 2019, leads to the following
Smatch complaint:
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:349 live_parallel_switch()
error: we previously assumed 'data' could be null (see line 263)
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
257 }
258
259 engines = i915_gem_context_lock_engines(ctx);
260 count = engines->num_engines;
261
262 data = kcalloc(count, sizeof(*data), GFP_KERNEL);
263 if (!data) {
264 i915_gem_context_unlock_engines(ctx);
265 err = -ENOMEM;
266 goto out;
^^^^^^^^
goto out is always a sign of troubled times ahead...
267 }
268
269 m = 0; /* Use the first context as our template for the engines */
270 for_each_gem_engine(ce, engines, it) {
271 err = intel_context_pin(ce);
272 if (err) {
273 i915_gem_context_unlock_engines(ctx);
274 goto out;
275 }
276 data[m++].ce[0] = intel_context_get(ce);
277 }
278 i915_gem_context_unlock_engines(ctx);
279
280 /* Clone the same set of engines into the other contexts */
281 for (n = 1; n < ARRAY_SIZE(data->ce); n++) {
282 ctx = live_context(i915, file);
283 if (IS_ERR(ctx)) {
284 err = PTR_ERR(ctx);
285 goto out;
286 }
287
288 for (m = 0; m < count; m++) {
289 if (!data[m].ce[0])
290 continue;
291
292 ce = intel_context_create(ctx, data[m].ce[0]->engine);
293 if (IS_ERR(ce))
294 goto out;
295
296 err = intel_context_pin(ce);
297 if (err) {
298 intel_context_put(ce);
299 goto out;
300 }
301
302 data[m].ce[n] = ce;
303 }
304 }
305
306 for (fn = func; !err && *fn; fn++) {
307 struct igt_live_test t;
308 int n;
309
310 err = igt_live_test_begin(&t, i915, __func__, "");
311 if (err)
312 break;
313
314 for (n = 0; n < count; n++) {
315 if (!data[n].ce[0])
316 continue;
317
318 data[n].tsk = kthread_run(*fn, &data[n],
319 "igt/parallel:%s",
320 data[n].ce[0]->engine->name);
321 if (IS_ERR(data[n].tsk)) {
322 err = PTR_ERR(data[n].tsk);
323 break;
324 }
325 get_task_struct(data[n].tsk);
326 }
327
328 for (n = 0; n < count; n++) {
329 int status;
330
331 if (IS_ERR_OR_NULL(data[n].tsk))
332 continue;
333
334 status = kthread_stop(data[n].tsk);
335 if (status && !err)
336 err = status;
337
338 put_task_struct(data[n].tsk);
339 data[n].tsk = NULL;
340 }
341
342 if (igt_live_test_end(&t))
343 err = -EIO;
344 }
345
346 out:
347 for (n = 0; n < count; n++) {
348 for (m = 0; m < ARRAY_SIZE(data->ce); m++) {
349 if (!data[n].ce[m])
^^^^^^^^
Toasted.
350 continue;
351
regards,
dan carpenter
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2019-10-11 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 11:42 Dan Carpenter [this message]
2019-10-11 11:58 ` [bug report] drm/i915/selftests: Exercise context switching in parallel Chris Wilson
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=20191011114209.GA29460@mwanda \
--to=dan.carpenter@oracle.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.