From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: [Intel-gfx] [PATCH v3 1/3] drm/i915/gt: BUG_ON unexpected NULL at scatterlist walking
Date: Mon, 2 May 2022 19:56:16 +0530 [thread overview]
Message-ID: <20220502142618.2704-2-ramalingam.c@intel.com> (raw)
In-Reply-To: <20220502142618.2704-1-ramalingam.c@intel.com>
While locating the start of ccs scatterlist in smem scatterlist, that has
to be the size of lmem obj size + corresponding ccs data size, report bug
if scatterlist terminate before that length.
v2:
s/GEM_BUG_ON/BUG_ON with more commenting [Matt]
v3:
Converted GEM_BUG_ON into BUG_ON with more documentation [Matt]
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com> (v1)
---
drivers/gpu/drm/i915/gt/intel_migrate.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
index 9d552f30b627..168d17b6f48a 100644
--- a/drivers/gpu/drm/i915/gt/intel_migrate.c
+++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
@@ -687,6 +687,16 @@ static void get_ccs_sg_sgt(struct sgt_dma *it, u32 bytes_to_cpy)
bytes_to_cpy -= len;
it->sg = __sg_next(it->sg);
+
+ /*
+ * On Flat-CCS capable platform when we back the lmem pages with
+ * smem pages we add extra pages at the end of the smem
+ * scatterlist, to store the ccs data corresponding to the lmem
+ * pages. get_ccs_sg_sgt() is called to get the pointer for the
+ * start of the extra pages added at the end of smem scatterlist.
+ * So scatterlist can't end at or before bytes_to_cpy.
+ */
+ BUG_ON(!it->sg);
it->dma = sg_dma_address(it->sg);
it->max = it->dma + sg_dma_len(it->sg);
} while (bytes_to_cpy);
@@ -748,8 +758,10 @@ intel_context_migrate_copy(struct intel_context *ce,
* Need to fix it.
*/
ccs_bytes_to_cpy = src_sz != dst_sz ? GET_CCS_BYTES(i915, bytes_to_cpy) : 0;
- if (ccs_bytes_to_cpy)
+ if (ccs_bytes_to_cpy) {
+ WARN_ON(abs(src_sz - dst_sz) < ccs_bytes_to_cpy);
get_ccs_sg_sgt(&it_ccs, bytes_to_cpy);
+ }
}
src_offset = 0;
--
2.20.1
next prev parent reply other threads:[~2022-05-02 14:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 14:26 [Intel-gfx] [PATCH v3 0/3] Flat-CCS eviction enhancements Ramalingam C
2022-05-02 14:26 ` Ramalingam C [this message]
2022-05-02 16:45 ` [Intel-gfx] [PATCH v3 1/3] drm/i915/gt: BUG_ON unexpected NULL at scatterlist walking Jani Nikula
2022-05-02 14:26 ` [Intel-gfx] [PATCH v3 2/3] drm/i915/gt: optimize the ccs_sz calculation per chunk Ramalingam C
2022-05-02 14:26 ` [Intel-gfx] [PATCH v3 3/3] drm/i915/gt: Document the eviction of the Flat-CCS objects Ramalingam C
2022-05-02 16:27 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Flat-CCS eviction enhancements (rev4) Patchwork
2022-05-02 16:52 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-05-02 21:39 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-05-03 2:08 ` Ramalingam C
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=20220502142618.2704-2-ramalingam.c@intel.com \
--to=ramalingam.c@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@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