All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/3] drm/xe: Add a parameter to xe_bb_create_job() to append or not batch buffer end instruction
Date: Wed, 11 Sep 2024 19:13:57 -0700	[thread overview]
Message-ID: <87jzfh39ga.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20240911200218.130219-2-jose.souza@intel.com>

On Wed, 11 Sep 2024 13:02:17 -0700, José Roberto de Souza wrote:
>

Hi Jose,

> There is overflow happening in OA because it reuses batch buffers,
> so at each submission one batch buffer end instruction is appended
> eventually causing a overflow.
> That will be fixed in the next patch, here just adding adding
> parameter and updating all the callers.

Thanks for finding this, this is indeed a bug.

However I have a much simpler fix, which is just the patch below (instead
of your two patches):

diff --git a/drivers/gpu/drm/xe/xe_bb.c b/drivers/gpu/drm/xe/xe_bb.c
index a13e0b3a169ed..148ccae265b47 100644
--- a/drivers/gpu/drm/xe/xe_bb.c
+++ b/drivers/gpu/drm/xe/xe_bb.c
@@ -65,7 +65,8 @@ __xe_bb_create_job(struct xe_exec_queue *q, struct xe_bb *bb, u64 *addr)
 {
 	u32 size = drm_suballoc_size(bb->bo);
 
-	bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
+	if (bb->cs[bb->len] != MI_BATCH_BUFFER_END)
+		bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
 
 	xe_gt_assert(q->gt, bb->len * 4 + bb_prefetch(q->gt) <= size);

So just append MI_BATCH_BUFFER_END if it is not already there. Also,
MI_BATCH_BUFFER_END can be added by the caller, otherwise the callee will
add that. Thoughts?

Please send this patch if you agree, I'll R-b it.

Thanks.
--
Ashutosh

  reply	other threads:[~2024-09-12  2:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 20:02 [PATCH 1/3] drm/xe: Fix build by setting the correct parameter to intel_dmc_suspend() José Roberto de Souza
2024-09-11 20:02 ` [PATCH 2/3] drm/xe: Add a parameter to xe_bb_create_job() to append or not batch buffer end instruction José Roberto de Souza
2024-09-12  2:13   ` Dixit, Ashutosh [this message]
2024-09-12 15:39     ` Souza, Jose
2024-09-11 20:02 ` [PATCH 3/3] drm/xe/oa: Fix overflow in oa batch buffer José Roberto de Souza
2024-09-11 20:08 ` ✓ CI.Patch_applied: success for series starting with [1/3] drm/xe: Fix build by setting the correct parameter to intel_dmc_suspend() Patchwork
2024-09-11 20:08 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-11 20:09 ` ✓ CI.KUnit: success " Patchwork
2024-09-11 20:11 ` [PATCH 1/3] " Rodrigo Vivi
2024-09-11 20:22 ` ✓ CI.Build: success for series starting with [1/3] " Patchwork
2024-09-11 20:24 ` ✓ CI.Hooks: " Patchwork
2024-09-11 20:25 ` ✓ CI.checksparse: " Patchwork
2024-09-11 20:41 ` ✓ CI.BAT: " Patchwork
2024-09-11 21:46 ` ✗ CI.FULL: 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=87jzfh39ga.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jose.souza@intel.com \
    /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.