drm/etnaviv: add lockdep assert to fence allocation
authorLucas Stach <l.stach@pengutronix.de>
Wed, 22 Mar 2017 11:23:43 +0000 (12:23 +0100)
committerLucas Stach <l.stach@pengutronix.de>
Wed, 29 Mar 2017 13:52:26 +0000 (15:52 +0200)
Make sure the GPU lock is taken, so that fence completion order matches
seqno order.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/etnaviv/etnaviv_gpu.c

index 130d7d517a19a180ca7f2e744131aeabc554564b..a81a2e84f6adf48c31881ffe5c6864ee7272279e 100644 (file)
@@ -1051,6 +1051,12 @@ static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
 {
        struct etnaviv_fence *f;
 
+       /*
+        * GPU lock must already be held, otherwise fence completion order might
+        * not match the seqno order assigned here.
+        */
+       lockdep_assert_held(&gpu->lock);
+
        f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (!f)
                return NULL;