intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: [Intel-xe] [PATCH 2/3] drm/xe: Adjust batchbuffer space warning when creating a job
Date: Wed, 29 Mar 2023 10:33:33 -0700	[thread overview]
Message-ID: <20230329173334.4015124-3-matthew.d.roper@intel.com> (raw)
In-Reply-To: <20230329173334.4015124-1-matthew.d.roper@intel.com>

We should WARN (not BUG) when creating a job if the batchbuffer does not
have sufficient space and padding.  The hardware prefetch requirements
should also be considered.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/xe/xe_bb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_bb.c b/drivers/gpu/drm/xe/xe_bb.c
index f326f117ba3b..7172801ee570 100644
--- a/drivers/gpu/drm/xe/xe_bb.c
+++ b/drivers/gpu/drm/xe/xe_bb.c
@@ -63,10 +63,10 @@ __xe_bb_create_job(struct xe_engine *kernel_eng, struct xe_bb *bb, u64 *addr)
 {
 	u32 size = drm_suballoc_size(bb->bo);
 
-	XE_BUG_ON((bb->len * 4 + 1) > size);
-
 	bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
 
+	WARN_ON(bb->len * 4 + bb_prefetch(kernel_eng->gt) > size);
+
 	xe_sa_bo_flush_write(bb->bo);
 
 	return xe_sched_job_create(kernel_eng, addr);
-- 
2.39.2


  parent reply	other threads:[~2023-03-29 17:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 17:33 [Intel-xe] [PATCH 0/3] Minor batchbuffer handling fixes Matt Roper
2023-03-29 17:33 ` [Intel-xe] [PATCH 1/3] drm/xe: Include hardware prefetch buffer in batchbuffer allocations Matt Roper
2023-03-31 20:14   ` Lucas De Marchi
2023-03-31 20:34     ` Matt Roper
2023-03-29 17:33 ` Matt Roper [this message]
2023-03-29 17:33 ` [Intel-xe] [PATCH 3/3] drm/xe: Don't emit extra MI_BATCH_BUFFER_END in WA batchbuffer Matt Roper
2023-03-29 17:36 ` [Intel-xe] ✓ CI.Patch_applied: success for Minor batchbuffer handling fixes Patchwork
2023-03-29 17:36 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
2023-03-29 18:20   ` Michal Wajdeczko
2023-03-29 17:59 ` [Intel-xe] [PATCH 0/3] " Souza, Jose
2023-03-29 18:08 ` [Intel-xe] ✓ CI.Patch_applied: success for Minor batchbuffer handling fixes (rev2) Patchwork
2023-03-29 18:09 ` [Intel-xe] ✗ CI.KUnit: 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=20230329173334.4015124-3-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-xe@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;
as well as URLs for NNTP newsgroup(s).