Hi Chris,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.20-rc4 next-20181128]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system]
url:
https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-selftests-Terminate-hangcheck-sanitycheck-forcibly/20181129-053109
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
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 warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/i915/intel_hangcheck.c:480:0:
drivers/gpu/drm/i915/selftests/intel_hangcheck.c: In function
'igt_hang_sanitycheck':
>> drivers/gpu/drm/i915/selftests/intel_hangcheck.c:341:6: warning: 'timeout'
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
if (timeout < 0) {
^
vim +/timeout +341 drivers/gpu/drm/i915/selftests/intel_hangcheck.c
3fb04cb0 Chris Wilson 2017-12-17 293
496b575e Chris Wilson 2017-02-13 294 static int igt_hang_sanitycheck(void
*arg)
496b575e Chris Wilson 2017-02-13 295 {
496b575e Chris Wilson 2017-02-13 296 struct drm_i915_private *i915 = arg;
e61e0f51 Chris Wilson 2018-02-21 297 struct i915_request *rq;
496b575e Chris Wilson 2017-02-13 298 struct intel_engine_cs *engine;
496b575e Chris Wilson 2017-02-13 299 enum intel_engine_id id;
496b575e Chris Wilson 2017-02-13 300 struct hang h;
496b575e Chris Wilson 2017-02-13 301 int err;
496b575e Chris Wilson 2017-02-13 302
496b575e Chris Wilson 2017-02-13 303 /* Basic check that we can execute our
hanging batch */
496b575e Chris Wilson 2017-02-13 304
496b575e Chris Wilson 2017-02-13 305 mutex_lock(>drm.struct_mutex);
496b575e Chris Wilson 2017-02-13 306 err = hang_init(, i915);
496b575e Chris Wilson 2017-02-13 307 if (err)
496b575e Chris Wilson 2017-02-13 308 goto unlock;
496b575e Chris Wilson 2017-02-13 309
496b575e Chris Wilson 2017-02-13 310 for_each_engine(engine, i915, id) {
63600d01 Chris Wilson 2018-11-28 311 struct igt_wedge_me w;
496b575e Chris Wilson 2017-02-13 312 long timeout;
496b575e Chris Wilson 2017-02-13 313
f2f5c061 Chris Wilson 2017-08-16 314 if
(!intel_engine_can_store_dword(engine))
f2f5c061 Chris Wilson 2017-08-16 315 continue;
f2f5c061 Chris Wilson 2017-08-16 316
8ec21a7c Chris Wilson 2018-02-05 317 rq = hang_create_request(,
engine);
496b575e Chris Wilson 2017-02-13 318 if (IS_ERR(rq)) {
496b575e Chris Wilson 2017-02-13 319 err = PTR_ERR(rq);
496b575e Chris Wilson 2017-02-13 320 pr_err("Failed to
create request for %s, err=%d\n",
496b575e Chris Wilson 2017-02-13 321 engine->name,
err);
496b575e Chris Wilson 2017-02-13 322 goto fini;
496b575e Chris Wilson 2017-02-13 323 }
496b575e Chris Wilson 2017-02-13 324
e61e0f51 Chris Wilson 2018-02-21 325 i915_request_get(rq);
496b575e Chris Wilson 2017-02-13 326
496b575e Chris Wilson 2017-02-13 327 *h.batch = MI_BATCH_BUFFER_END;
60456d5c Chris Wilson 2017-09-26 328 i915_gem_chipset_flush(i915);
60456d5c Chris Wilson 2017-09-26 329
697b9a87 Chris Wilson 2018-06-12 330 i915_request_add(rq);
496b575e Chris Wilson 2017-02-13 331
63600d01 Chris Wilson 2018-11-28 332 igt_wedge_on_timeout(, i915,
HZ / 10 /* 100ms timeout*/)
e61e0f51 Chris Wilson 2018-02-21 333 timeout =
i915_request_wait(rq,
496b575e Chris Wilson 2017-02-13 334
I915_WAIT_LOCKED,
496b575e Chris Wilson 2017-02-13 335
MAX_SCHEDULE_TIMEOUT);
63600d01 Chris Wilson 2018-11-28 336 if
(i915_terminally_wedged(>gpu_error))
63600d01 Chris Wilson 2018-11-28 337 timeout = -EIO;
63600d01 Chris Wilson 2018-11-28 338
e61e0f51 Chris Wilson 2018-02-21 339 i915_request_put(rq);
496b575e Chris Wilson 2017-02-13 340
496b575e Chris Wilson 2017-02-13 @341 if (timeout < 0) {
496b575e Chris Wilson 2017-02-13 342 err = timeout;
496b575e Chris Wilson 2017-02-13 343 pr_err("Wait for
request failed on %s, err=%d\n",
496b575e Chris Wilson 2017-02-13 344 engine->name,
err);
496b575e Chris Wilson 2017-02-13 345 goto fini;
496b575e Chris Wilson 2017-02-13 346 }
496b575e Chris Wilson 2017-02-13 347 }
496b575e Chris Wilson 2017-02-13 348
496b575e Chris Wilson 2017-02-13 349 fini:
496b575e