Steven Price 5b3ec8134f drm/panfrost: Handle resetting on timeout better
Panfrost uses multiple schedulers (one for each slot, so 2 in reality),
and on a timeout has to stop all the schedulers to safely perform a
reset. However more than one scheduler can trigger a timeout at the same
time. This race condition results in jobs being freed while they are
still in use.

When stopping other slots use cancel_delayed_work_sync() to ensure that
any timeout started for that slot has completed. Also use
mutex_trylock() to obtain reset_lock. This means that only one thread
attempts the reset, the other threads will simply complete without doing
anything (the first thread will wait for this in the call to
cancel_delayed_work_sync()).

While we're here and since the function is already dependent on
sched_job not being NULL, let's remove the unnecessary checks.

Fixes: aa20236784ab ("drm/panfrost: Prevent concurrent resets")
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191009094456.9704-1-steven.price@arm.com
2019-10-15 11:38:22 -05:00
..
2019-09-27 11:13:35 -07:00
2019-08-14 18:31:10 +02:00
2019-09-19 16:24:24 -07:00
2019-07-22 21:24:10 +02:00
2019-08-06 09:20:58 +02:00
2019-09-19 16:24:24 -07:00
2019-06-19 12:07:29 +02:00
2019-08-27 17:21:04 +10:00
2019-08-14 18:30:52 +02:00
2019-07-17 12:52:55 +02:00
2019-09-20 08:36:47 -07:00
2019-09-19 16:24:24 -07:00
2019-09-19 16:24:24 -07:00
2019-09-19 16:24:24 -07:00
2019-09-19 16:24:24 -07:00
2019-06-30 09:48:05 +02:00
2019-09-27 11:13:35 -07:00
2019-08-09 09:15:05 +02:00
2019-09-19 16:24:24 -07:00
2019-07-17 12:52:55 +02:00
2019-09-27 11:13:35 -07:00
2019-09-27 11:13:35 -07:00
2019-06-05 20:31:04 +02:00
2019-09-19 16:24:24 -07:00
2019-07-15 18:11:31 +02:00
2019-06-05 20:29:57 +02:00
2019-09-19 16:24:24 -07:00
2019-07-17 12:52:55 +02:00
2019-09-19 16:24:24 -07:00
2019-07-15 18:11:30 +02:00
2019-07-17 12:52:55 +02:00
2019-09-19 16:24:24 -07:00
2019-07-15 18:11:30 +02:00
2019-09-19 16:24:24 -07:00
2019-07-22 21:24:10 +02:00
2019-05-27 18:07:03 +02:00
2019-05-27 18:07:03 +02:00
2019-05-27 18:07:03 +02:00
2019-05-27 18:07:03 +02:00
2019-05-27 18:07:03 +02:00
2019-06-19 12:07:29 +02:00
2019-05-27 18:07:03 +02:00
2019-07-22 21:24:10 +02:00
2019-05-27 18:07:03 +02:00
2019-06-19 12:07:29 +02:00
2019-07-25 10:45:07 +02:00
2019-09-19 16:24:24 -07:00
2019-05-27 18:07:03 +02:00
2019-05-27 18:07:03 +02:00
2019-06-19 12:07:29 +02:00
2019-05-27 18:07:03 +02:00
2019-06-19 12:07:29 +02:00
2019-08-09 16:04:31 +10:00