Skip to contentSkip to conversation

drm/i915: Move context management under GEM

bug report Dan Carpenter 2 participants 2 messages Nov 6, 2019

lore
Share & tools
lore
#0 lore raw

Hello Chris Wilson,

The patch a4e7ccdac38e: "drm/i915: Move context management under GEM" from Oct 4, 2019, leads to the following static checker warning:

	drivers/gpu/drm/i915/gem/i915_gem_context.c:980 set_ppgtt()
	warn: 'ctx->mutex' both locked and unlocked.

drivers/gpu/drm/i915/gem/i915_gem_context.c
940 rcu_read_unlock();
941 if (!vm)
942 return -ENOENT;
943
944 err = mutex_lock_interruptible(&ctx->mutex);
945 if (err)
946 goto out;
947
948 if (i915_gem_context_is_closed(ctx)) {
949 err = -ENOENT;

   950                  goto out;
                        ^^^^^^^^

This should be goto unlock?

   951          }
   952  
   953          if (vm == rcu_access_pointer(ctx->vm))
   954                  goto unlock;
   955  
   956          /* Teardown the existing obj:vma cache, it will have to be rebuilt. */
   957          lut_close(ctx);
   958  
   959          old = __set_ppgtt(ctx, vm);
   960  
   961          /*
   962           * We need to flush any requests using the current ppgtt before
   963           * we release it as the requests do not hold a reference themselves,
   964           * only indirectly through the context.
   965           */
   966          err = context_barrier_task(ctx, ALL_ENGINES,
   967                                     skip_ppgtt_update,
   968                                     emit_ppgtt_update,
   969                                     set_ppgtt_barrier,
   970                                     old);
   971          if (err) {
   972                  i915_vm_close(__set_ppgtt(ctx, old));
   973                  i915_vm_close(old);
   974          }
   975  
   976  unlock:
   977          mutex_unlock(&ctx->mutex);
   978  out:
   979          i915_vm_put(vm);
   980          return err;
   981  }

regards,
dan carpenter
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw

Quoting Dan Carpenter (2019-11-06 13:48:14)

Quoted 21 lines

Hello Chris Wilson,

The patch a4e7ccdac38e: "drm/i915: Move context management under GEM" from Oct 4, 2019, leads to the following static checker warning:

        drivers/gpu/drm/i915/gem/i915_gem_context.c:980 set_ppgtt()
        warn: 'ctx->mutex' both locked and unlocked.

drivers/gpu/drm/i915/gem/i915_gem_context.c

   940          rcu_read_unlock();
   941          if (!vm)
   942                  return -ENOENT;
   943  
   944          err = mutex_lock_interruptible(&ctx->mutex);
   945          if (err)
   946                  goto out;
   947  
   948          if (i915_gem_context_is_closed(ctx)) {
   949                  err = -ENOENT;
   950                  goto out;
                        ^^^^^^^^
Quoted 1 line

This should be goto unlock?

Yes. Many thanks for the bug report.
https://patchwork.freedesktop.org/patch/339213/?series=69070&rev=1
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx