I reread the documentation for wait_event_timeout, my bad, all this time i assumed it returns
amount of jiffies he spent in waiting while actually it returns "the remaining jiffies (at least 1)
if the @condition evaluated
* to %true before the @timeout elapsed."Will fix that, please take a look also at the second patch.
Andrey
On 06/04/2018 01:53 PM, Christian König wrote:
+ ret = wait_event_timeout(
+ sched->job_scheduled,
+ drm_sched_entity_is_idle(entity),
+ timeout);
+
+ ret = ret ? timeout - ret : ret;
Ok we still seem to have a misunderstanding here what wait_event_timeout() returns.
As far as I know that line shouldn't be necessary and is actually quite harmful.
Apart from that this patch looks fine to me now,
Christian.