[Intel-gfx] [bug report] drm/i915: Move context management under GEM

Dan Carpenter dan.carpenter at oracle.com
Wed Nov 6 13:48:14 UTC 2019


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


More information about the Intel-gfx mailing list