Wait loop can be interrupted by signal, so if signals are raised
periodically (e.g. SIGALRM) this loop may never finish. Use
emission time as a base for fence timeout.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
uint32_t sequence;
bool signalled;
+ unsigned long timeout;
void (*work)(void *priv, bool signalled);
void *priv;
}
OUT_RING (chan, fence->sequence);
FIRE_RING(chan);
+ fence->timeout = jiffies + 3 * DRM_HZ;
return 0;
}
int
__nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
{
- unsigned long timeout = jiffies + (3 * DRM_HZ);
+ struct nouveau_fence *fence = nouveau_fence(sync_obj);
+ unsigned long timeout = fence->timeout;
unsigned long sleep_time = NSEC_PER_MSEC / 1000;
ktime_t t;
int ret = 0;