Module Name: src Committed By: riastradh Date: Thu Aug 23 01:10:28 UTC 2018
Modified Files: src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_fence.c Log Message: Attempt to make sense of return values of nouveau_fence_wait. PR kern/53441 XXX pullup-7 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.7 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.8 --- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.7 Thu Aug 23 01:10:21 2018 +++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c Thu Aug 23 01:10:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nouveau_fence.c,v 1.7 2018/08/23 01:10:21 riastradh Exp $ */ +/* $NetBSD: nouveau_fence.c,v 1.8 2018/08/23 01:10:28 riastradh Exp $ */ /* * Copyright (C) 2007 Ben Skeggs. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.7 2018/08/23 01:10:21 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.8 2018/08/23 01:10:28 riastradh Exp $"); #include <sys/types.h> #include <sys/xcall.h> @@ -446,6 +446,9 @@ nouveau_fence_wait_uevent_handler(void * * * Wait using a nouveau event for completion of fence on chan. * Wait interruptibly iff intr is true. + * + * Return 0 if fence was signalled, negative error code on + * timeout (-EBUSY) or interrupt (-ERESTARTSYS) or other error. */ static int nouveau_fence_wait_uevent(struct nouveau_fence *fence, @@ -487,12 +490,18 @@ nouveau_fence_wait_uevent(struct nouveau } nouveau_fence_gc_grab(fctx, &done_list); spin_unlock(&fctx->lock); - } - - if (ret >= 0) { - fence->timeout = jiffies + ret; - if (time_after_eq(jiffies, fence->timeout)) + if (ret < 0) { + /* error */ + } else if (ret == 0) { + /* timeout */ ret = -EBUSY; + } else { + /* success */ + ret = 0; + } + } else { + /* timeout */ + ret = -EBUSY; } } else { spin_lock(&fctx->lock); @@ -525,6 +534,9 @@ nouveau_fence_wait_uevent(struct nouveau * Wait for fence to complete. Wait interruptibly iff intr is * true. If lazy is true, may sleep, either for a single tick or * for an interrupt; otherwise will busy-wait. + * + * Return 0 if fence was signalled, negative error code on + * timeout (-EBUSY) or interrupt (-ERESTARTSYS) or other error. */ int nouveau_fence_wait(struct nouveau_fence *fence, bool lazy, bool intr)