diff mbox series

[3/3] drm/i915: Assert the csb tail is within bounds

Message ID 20181127173845.17403-3-mika.kuoppala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915: Prepare for larger CSB status FIFO size | expand

Commit Message

Mika Kuoppala Nov. 27, 2018, 5:38 p.m. UTC
Make sure that the tail we get from hardware fits
within the bounds dictated by our count of csb entries.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Chris Wilson Nov. 27, 2018, 5:48 p.m. UTC | #1
Quoting Mika Kuoppala (2018-11-27 17:38:45)
> Make sure that the tail we get from hardware fits
> within the bounds dictated by our count of csb entries.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_lrc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 107244ab09ef..1a34e91c1305 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -888,6 +888,7 @@ static void process_csb(struct intel_engine_cs *engine)
>          */
>         head = execlists->csb_head;
>         tail = READ_ONCE(*execlists->csb_write);
> +       GEM_DEBUG_BUG_ON(tail >= execlists->csb_entries);
>         GEM_TRACE("%s cs-irq head=%d, tail=%d\n", engine->name, head, tail);

Apply the assert after the debug trace.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 107244ab09ef..1a34e91c1305 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -888,6 +888,7 @@  static void process_csb(struct intel_engine_cs *engine)
 	 */
 	head = execlists->csb_head;
 	tail = READ_ONCE(*execlists->csb_write);
+	GEM_DEBUG_BUG_ON(tail >= execlists->csb_entries);
 	GEM_TRACE("%s cs-irq head=%d, tail=%d\n", engine->name, head, tail);
 	if (unlikely(head == tail))
 		return;