All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [PATCH 11/13] drm/i915: annotate intel_atomic_commit_fence_wait
Date: Wed,  7 Nov 2018 16:30:17 +0100	[thread overview]
Message-ID: <20181107153019.26401-11-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20181107153019.26401-1-daniel.vetter@ffwll.ch>

In i915 we also have i915_sw_fence, as some kind of super fence. Since
those include dma-fences (it's the main use really, aside from
chaining them for the scheduler) they're relevant for any lockdep
cycles involving dma_fence.

But i915_sw_fence is also really tough to properly annonate:
- Most of the use (all of it in the scheduler) is entirely driven by
  callbacks. That creates dependency chains, but for all practical
  purposes we could treat that as part of the hw magic that executes
  requests for us. Eventually a dma_fence_signal() comes out of that,
  which we do annotate.

- For dma-fences we only annotate cpu waits, and don't follow any of
  the chains going through the hardware. Since dma_fence are supposed
  to be ordered an always complete that should be good enough, as long
  as we don't accidentally deadlock on the cpu side. So treating
  i915_sw_fence as part of the hw magic shouldn't reduce our deadlock
  coverage, as long as i915_sw_fence itself doesn't deadlock. And
  there's lots of debug checks for that already.

- There's one exception: intel_atomic_commit_fence_wait() is the only
  cpu wait on a i915_sw_fence we have. That one we should annotate,
  and annotate should be able to teach lockdep about our gpu reset vs
  modeset locking inversion. But in reality this is a dma-fence wait,
  and it using i915_sw_fence is really just an implementation detail.
  All other kms drivers use drm_atomic_helper_wait_for_fences()
  instead.

- There is a i915_sw_fence_wait for normal cpu waits (the one in the
  modeset code is open-coded because it also waits for gpu reset
  wakups), but that's only used for selftests.

So the simplest solution for annotating i915_sw_fence is therefore to
annotate intel_atomic_commit_fence() as a dma_fence wait.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bbf8ca21a7a2..cf9240625ae3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12747,6 +12747,7 @@ static void intel_atomic_commit_fence_wait(struct intel_atomic_state *intel_stat
 	struct wait_queue_entry wait_fence, wait_reset;
 	struct drm_i915_private *dev_priv = to_i915(intel_state->base.dev);
 
+	dma_fence_wait_acquire();
 	init_wait_entry(&wait_fence, 0);
 	init_wait_entry(&wait_reset, 0);
 	for (;;) {
@@ -12764,6 +12765,7 @@ static void intel_atomic_commit_fence_wait(struct intel_atomic_state *intel_stat
 	}
 	finish_wait(&intel_state->commit_ready.wait, &wait_fence);
 	finish_wait(&dev_priv->gpu_error.wait_queue, &wait_reset);
+	dma_fence_wait_release();
 }
 
 static void intel_atomic_cleanup_work(struct work_struct *work)
-- 
2.19.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-11-07 15:30 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 15:30 [PATCH 01/13] locking/lockdep: restore cross-release checks Daniel Vetter
2018-11-07 15:30 ` [PATCH 02/13] kthread: finer-grained lockdep/cross-release completion Daniel Vetter
2018-11-07 15:30 ` [PATCH 03/13] lockdep: Remove GFP_NOLOCKDEP annotation Daniel Vetter
2018-11-07 15:30 ` [PATCH 04/13] kernel/lockdep: Make cross-release a config option Daniel Vetter
2018-11-07 15:30 ` [PATCH 05/13] mm: Check if mmu notifier callbacks are allowed to fail Daniel Vetter
2018-11-07 15:30 ` [PATCH 06/13] mm, notifier: Catch sleeping/blocking for !blockable Daniel Vetter
2018-11-07 15:30 ` [PATCH 07/13] mm, notifier: Add a lockdep map for invalidate_range_start Daniel Vetter
2018-11-07 15:30 ` [PATCH 08/13] dma-fence: cross-release annotations Daniel Vetter
2018-11-07 15:30 ` [PATCH 09/13] reservation: Annotate dma_fence waits Daniel Vetter
2018-11-07 15:30 ` [PATCH 10/13] drm/i915: " Daniel Vetter
2018-11-07 15:30 ` Daniel Vetter [this message]
2018-11-07 15:30 ` [PATCH 12/13] HAX FOR CI: Enable cross-release Daniel Vetter
2018-11-08  9:31   ` [PATCH] " Daniel Vetter
2018-11-08  9:41     ` Chris Wilson
2018-11-20 11:00       ` Daniel Vetter
2018-11-20 10:58     ` Daniel Vetter
2018-11-22 16:35       ` Daniel Vetter
2018-11-23  8:53         ` Daniel Vetter
2018-11-23 12:45           ` Daniel Vetter
2018-11-23 13:24             ` Daniel Vetter
2018-11-07 15:30 ` [PATCH 13/13] Revert "locking/lockdep, cpu/hotplug: Annotate AP thread" Daniel Vetter
2018-11-07 16:51 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/13] locking/lockdep: restore cross-release checks Patchwork
2018-11-07 16:57 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-07 17:07 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-11-08 10:04 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/13] locking/lockdep: restore cross-release checks (rev2) Patchwork
2018-11-08 10:10 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-08 10:21 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-11-20 12:33 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/13] locking/lockdep: restore cross-release checks (rev3) Patchwork
2018-11-20 12:39 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-20 12:53 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-11-22 16:39 ` ✗ Fi.CI.BAT: failure for series starting with [01/13] locking/lockdep: restore cross-release checks (rev4) Patchwork
2018-11-23  8:57 ` ✗ Fi.CI.BAT: failure for series starting with [01/13] locking/lockdep: restore cross-release checks (rev5) Patchwork
2018-11-23 12:51 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/13] locking/lockdep: restore cross-release checks (rev6) Patchwork
2018-11-23 12:57 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-23 13:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-11-23 13:55 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/13] locking/lockdep: restore cross-release checks (rev7) Patchwork
2018-11-23 14:01 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-23 14:12 ` ✗ Fi.CI.BAT: failure " Patchwork

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=20181107153019.26401-11-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.