drivers/gpu/drm/i915/selftests/i915_gem_request.c:344: error: 'request' may be used uninitialized in this function

From: kbuild test robot
Date: Sun Aug 06 2017 - 05:40:39 EST


Hi Jan,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0fdd951c9bef93637d5af036851e7a5632fbd6c3
commit: 7e6091209f7f73e2a81943020793b5ad26d645c6 x86/build: Permit building with old make versions
date: 2 months ago
config: x86_64-randconfig-v0-08061633 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
git checkout 7e6091209f7f73e2a81943020793b5ad26d645c6
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All errors (new ones prefixed by >>):

cc1: warnings being treated as errors
In file included from drivers/gpu/drm/i915/i915_gem_request.c:1219:
drivers/gpu/drm/i915/selftests/i915_gem_request.c: In function 'live_nop_request':
>> drivers/gpu/drm/i915/selftests/i915_gem_request.c:344: error: 'request' may be used uninitialized in this function

vim +/request +344 drivers/gpu/drm/i915/selftests/i915_gem_request.c

b348090d Chris Wilson 2017-02-13 326
b348090d Chris Wilson 2017-02-13 327 static int live_nop_request(void *arg)
b348090d Chris Wilson 2017-02-13 328 {
b348090d Chris Wilson 2017-02-13 329 struct drm_i915_private *i915 = arg;
b348090d Chris Wilson 2017-02-13 330 struct intel_engine_cs *engine;
b348090d Chris Wilson 2017-02-13 331 struct live_test t;
b348090d Chris Wilson 2017-02-13 332 unsigned int id;
b348090d Chris Wilson 2017-02-13 333 int err;
b348090d Chris Wilson 2017-02-13 334
b348090d Chris Wilson 2017-02-13 335 /* Submit various sized batches of empty requests, to each engine
b348090d Chris Wilson 2017-02-13 336 * (individually), and wait for the batch to complete. We can check
b348090d Chris Wilson 2017-02-13 337 * the overhead of submitting requests to the hardware.
b348090d Chris Wilson 2017-02-13 338 */
b348090d Chris Wilson 2017-02-13 339
b348090d Chris Wilson 2017-02-13 340 mutex_lock(&i915->drm.struct_mutex);
b348090d Chris Wilson 2017-02-13 341
b348090d Chris Wilson 2017-02-13 342 for_each_engine(engine, i915, id) {
b348090d Chris Wilson 2017-02-13 343 IGT_TIMEOUT(end_time);
b348090d Chris Wilson 2017-02-13 @344 struct drm_i915_gem_request *request;
b348090d Chris Wilson 2017-02-13 345 unsigned long n, prime;
b348090d Chris Wilson 2017-02-13 346 ktime_t times[2] = {};
b348090d Chris Wilson 2017-02-13 347
b348090d Chris Wilson 2017-02-13 348 err = begin_live_test(&t, i915, __func__, engine->name);
b348090d Chris Wilson 2017-02-13 349 if (err)
b348090d Chris Wilson 2017-02-13 350 goto out_unlock;
b348090d Chris Wilson 2017-02-13 351
b348090d Chris Wilson 2017-02-13 352 for_each_prime_number_from(prime, 1, 8192) {
b348090d Chris Wilson 2017-02-13 353 times[1] = ktime_get_raw();
b348090d Chris Wilson 2017-02-13 354
b348090d Chris Wilson 2017-02-13 355 for (n = 0; n < prime; n++) {
b348090d Chris Wilson 2017-02-13 356 request = i915_gem_request_alloc(engine,
b348090d Chris Wilson 2017-02-13 357 i915->kernel_context);
b348090d Chris Wilson 2017-02-13 358 if (IS_ERR(request)) {
b348090d Chris Wilson 2017-02-13 359 err = PTR_ERR(request);
b348090d Chris Wilson 2017-02-13 360 goto out_unlock;
b348090d Chris Wilson 2017-02-13 361 }
b348090d Chris Wilson 2017-02-13 362
b348090d Chris Wilson 2017-02-13 363 /* This space is left intentionally blank.
b348090d Chris Wilson 2017-02-13 364 *
b348090d Chris Wilson 2017-02-13 365 * We do not actually want to perform any
b348090d Chris Wilson 2017-02-13 366 * action with this request, we just want
b348090d Chris Wilson 2017-02-13 367 * to measure the latency in allocation
b348090d Chris Wilson 2017-02-13 368 * and submission of our breadcrumbs -
b348090d Chris Wilson 2017-02-13 369 * ensuring that the bare request is sufficient
b348090d Chris Wilson 2017-02-13 370 * for the system to work (i.e. proper HEAD
b348090d Chris Wilson 2017-02-13 371 * tracking of the rings, interrupt handling,
b348090d Chris Wilson 2017-02-13 372 * etc). It also gives us the lowest bounds
b348090d Chris Wilson 2017-02-13 373 * for latency.
b348090d Chris Wilson 2017-02-13 374 */
b348090d Chris Wilson 2017-02-13 375
b348090d Chris Wilson 2017-02-13 376 i915_add_request(request);
b348090d Chris Wilson 2017-02-13 377 }
b348090d Chris Wilson 2017-02-13 378 i915_wait_request(request,
b348090d Chris Wilson 2017-02-13 379 I915_WAIT_LOCKED,
b348090d Chris Wilson 2017-02-13 380 MAX_SCHEDULE_TIMEOUT);
b348090d Chris Wilson 2017-02-13 381
b348090d Chris Wilson 2017-02-13 382 times[1] = ktime_sub(ktime_get_raw(), times[1]);
b348090d Chris Wilson 2017-02-13 383 if (prime == 1)
b348090d Chris Wilson 2017-02-13 384 times[0] = times[1];
b348090d Chris Wilson 2017-02-13 385
b348090d Chris Wilson 2017-02-13 386 if (__igt_timeout(end_time, NULL))
b348090d Chris Wilson 2017-02-13 387 break;
b348090d Chris Wilson 2017-02-13 388 }
b348090d Chris Wilson 2017-02-13 389
b348090d Chris Wilson 2017-02-13 390 err = end_live_test(&t);
b348090d Chris Wilson 2017-02-13 391 if (err)
b348090d Chris Wilson 2017-02-13 392 goto out_unlock;
b348090d Chris Wilson 2017-02-13 393
b348090d Chris Wilson 2017-02-13 394 pr_info("Request latencies on %s: 1 = %lluns, %lu = %lluns\n",
b348090d Chris Wilson 2017-02-13 395 engine->name,
b348090d Chris Wilson 2017-02-13 396 ktime_to_ns(times[0]),
b348090d Chris Wilson 2017-02-13 397 prime, div64_u64(ktime_to_ns(times[1]), prime));
b348090d Chris Wilson 2017-02-13 398 }
b348090d Chris Wilson 2017-02-13 399
b348090d Chris Wilson 2017-02-13 400 out_unlock:
b348090d Chris Wilson 2017-02-13 401 mutex_unlock(&i915->drm.struct_mutex);
b348090d Chris Wilson 2017-02-13 402 return err;
b348090d Chris Wilson 2017-02-13 403 }
b348090d Chris Wilson 2017-02-13 404

:::::: The code at line 344 was first introduced by commit
:::::: b348090d6758cc391dc91f8a8233b18f0acc8458 drm/i915: Simple selftest to exercise live requests

:::::: TO: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
:::::: CC: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip