Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: chris@chris-wilson.co.uk
Cc: intel-gfx@lists.freedesktop.org
Subject: [bug report] drm/i915: Move context management under GEM
Date: Wed, 6 Nov 2019 16:48:14 +0300	[thread overview]
Message-ID: <20191106134814.GA23187@mwanda> (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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: chris@chris-wilson.co.uk
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [bug report] drm/i915: Move context management under GEM
Date: Wed, 6 Nov 2019 16:48:14 +0300	[thread overview]
Message-ID: <20191106134814.GA23187@mwanda> (raw)
Message-ID: <20191106134814.XrzzjvfjPKSZ3zUwq-aLUrz7h1LsXWaUhEN0ikKmyZ4@z> (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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2019-11-06 13:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 13:48 Dan Carpenter [this message]
2019-11-06 13:48 ` [Intel-gfx] [bug report] drm/i915: Move context management under GEM Dan Carpenter
2019-11-06 15:08 ` Chris Wilson
2019-11-06 15:08   ` [Intel-gfx] " Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191106134814.GA23187@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox