From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
intel-xe@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/xe/xe_intel_bb: ensure valid next page
Date: Fri, 2 Jun 2023 12:48:17 +0100 [thread overview]
Message-ID: <20230602114817.849486-1-matthew.auld@intel.com> (raw)
Due to over-fetch, recommendation is to ensure we have a single valid
extra page beyond the batch. We currently lack this which seems to
explain why xe_intel_bb@full-batch generates CAT errors.
Currently we allow using the last GTT page, but this looks to be no-go,
since the next page will be beyond the actual GTT, in the case of
full-batch. The i915 path looks to already account for this. However
even with that fixed, Xe doesn't use scratch pages by default so the
next page will still not be valid.
With Xe rather expect that callers know about HW over-fetch, ensuring
that the batch has an extra page, if needed. Alternatively we could
apply the DRM_XE_VM_CREATE_SCRATCH_PAGE when creating the vm, but really
we want to get away from such things.
Bspec: 60223
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/262
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
lib/intel_batchbuffer.c | 6 ++++++
tests/xe/xe_intel_bb.c | 8 +++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 3cd680072..035facfc4 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -881,6 +881,12 @@ static inline uint64_t __intel_bb_get_offset(struct intel_bb *ibb,
* passed in. If this is the case, it copies the information over to the
* newly created batch buffer.
*
+ * NOTE: On Xe scratch pages are not used by default. Due to over-fetch (~512
+ * bytes) there might need to be a valid next page to avoid hangs or CAT errors
+ * if the batch is quite large and approaches the end boundary of the batch
+ * itself. Inflate the @size to ensure there is a valid next page in such
+ * cases.
+ *
* Returns:
*
* Pointer the intel_bb, asserts on failure.
diff --git a/tests/xe/xe_intel_bb.c b/tests/xe/xe_intel_bb.c
index 755cc530e..af8462af5 100644
--- a/tests/xe/xe_intel_bb.c
+++ b/tests/xe/xe_intel_bb.c
@@ -952,7 +952,13 @@ static void full_batch(struct buf_ops *bops)
struct intel_bb *ibb;
int i;
- ibb = intel_bb_create(xe, PAGE_SIZE);
+ /*
+ * Add an extra page to ensure over-fetch always sees a valid next page,
+ * which includes not going beyond the actual GTT, and ensuring we have
+ * a valid GTT entry, given that on xe we don't use scratch pages by
+ * default.
+ */
+ ibb = intel_bb_create(xe, 2 * PAGE_SIZE);
if (debug_bb)
intel_bb_set_debug(ibb, true);
--
2.40.1
next reply other threads:[~2023-06-02 11:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 11:48 Matthew Auld [this message]
2023-06-02 14:23 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/xe/xe_intel_bb: ensure valid next page Patchwork
2023-06-04 17:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-06-07 9:55 ` [igt-dev] [Intel-xe] [PATCH i-g-t] " Zbigniew Kempczyński
2023-06-07 10:27 ` Matthew Auld
2023-06-07 11:09 ` Zbigniew Kempczyński
2023-06-07 11:14 ` Matthew Auld
2023-06-07 10:01 ` [igt-dev] ✗ Fi.CI.BUILD: failure for tests/xe/xe_intel_bb: ensure valid next page (rev2) 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=20230602114817.849486-1-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox