struct radeon_fence             *fence;
        /* last flush or NULL if we still need to flush */
        struct radeon_fence             *last_flush;
+       /* last use of vmid */
+       struct radeon_fence             *last_id_use;
 };
 
 struct radeon_vm_manager {
 
        unsigned i;
 
        /* check if the id is still valid */
-       if (vm->fence && vm->fence == rdev->vm_manager.active[vm->id])
+       if (vm->last_id_use && vm->last_id_use == rdev->vm_manager.active[vm->id])
                return NULL;
 
        /* we definately need to flush */
 
        radeon_fence_unref(&vm->fence);
        vm->fence = radeon_fence_ref(fence);
+
+       radeon_fence_unref(&vm->last_id_use);
+       vm->last_id_use = radeon_fence_ref(fence);
 }
 
 /**
 {
        vm->id = 0;
        vm->fence = NULL;
+       vm->last_flush = NULL;
+       vm->last_id_use = NULL;
        mutex_init(&vm->mutex);
        INIT_LIST_HEAD(&vm->list);
        INIT_LIST_HEAD(&vm->va);
        }
        radeon_fence_unref(&vm->fence);
        radeon_fence_unref(&vm->last_flush);
+       radeon_fence_unref(&vm->last_id_use);
        mutex_unlock(&vm->mutex);
 }