fctx->fenceptr = fenceptr;
        spin_lock_init(&fctx->spinlock);
 
+       /*
+        * Start out close to the 32b fence rollover point, so we can
+        * catch bugs with fence comparisons.
+        */
+       fctx->last_fence = 0xffffff00;
+       fctx->completed_fence = fctx->last_fence;
+       *fctx->fenceptr = fctx->last_fence;
+
        return fctx;
 }
 
        unsigned long flags;
 
        spin_lock_irqsave(&fctx->spinlock, flags);
-       fctx->completed_fence = max(fence, fctx->completed_fence);
+       if (fence_after(fence, fctx->completed_fence))
+               fctx->completed_fence = fence;
        spin_unlock_irqrestore(&fctx->spinlock, flags);
 }