[PATCH 11/13] [DEBUG] dump before data for comparison
Robert Beckett
bob.beckett at collabora.com
Thu Jun 23 17:52:37 UTC 2022
---
drivers/gpu/drm/i915/gt/selftest_reset.c | 33 +++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/selftest_reset.c b/drivers/gpu/drm/i915/gt/selftest_reset.c
index 75bc7d90c9dc..f8d4b13d7e1b 100644
--- a/drivers/gpu/drm/i915/gt/selftest_reset.c
+++ b/drivers/gpu/drm/i915/gt/selftest_reset.c
@@ -4,6 +4,7 @@
*/
#include <linux/crc32.h>
+#include <linux/highmem.h>
#include "gem/i915_gem_stolen.h"
#include "intel_region_ttm.h"
@@ -31,6 +32,13 @@ __igt_reset_stolen(struct intel_gt *gt,
void *tmp;
u32 *crc;
int err;
+ struct page **orig;
+
+ /* TODO: BOB_DEBUG
+ * use alloc_pages_bulk_array() to create shadow pages for each stolen page.
+ * when calculating the crc, also kmap, copy the data, kunmap
+ * if error, dump the original data too.
+ */
if (!drm_mm_node_allocated(&ggtt->error_capture))
return 0;
@@ -39,9 +47,17 @@ __igt_reset_stolen(struct intel_gt *gt,
if (!num_pages)
return 0;
- crc = kmalloc_array(num_pages, sizeof(u32), GFP_KERNEL);
- if (!crc)
+ orig = kmalloc_array(num_pages, sizeof(struct page *), GFP_KERNEL);
+ if (!orig) {
+ pr_err("BOB_DEBUG: %s(): failed to alloc orig. sz=0x%llx\n", __func__, num_pages * sizeof(struct page*));
return -ENOMEM;
+ }
+
+ crc = kmalloc_array(num_pages, sizeof(u32), GFP_KERNEL);
+ if (!crc) {
+ err = -ENOMEM;
+ goto err_orig;
+ }
tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!tmp) {
@@ -103,7 +119,11 @@ __igt_reset_stolen(struct intel_gt *gt,
in = (void __force *)s;
if (i915_memcpy_from_wc(tmp, in, PAGE_SIZE))
in = tmp;
+ else
+ pr_err("BOB_DEBUG: %s(): i915_memcpy_from_wc() returned false. page=%ld\n", __func__, (long)page);
+
crc[page] = crc32_le(0, in, PAGE_SIZE);
+ memcpy_to_page(orig[page], 0, in, PAGE_SIZE);
io_mapping_unmap(s);
}
@@ -147,8 +167,13 @@ __igt_reset_stolen(struct intel_gt *gt,
if (x != crc[page] && !busy) {
pr_debug("unused stolen page %pa modified by GPU reset\n",
&page);
- if (count++ == 0)
+ if (count++ == 0) {
igt_hexdump(in, PAGE_SIZE);
+ pr_debug("BOB_DEBUG: %s(): orig:\n", __func__);
+ in = kmap(orig[page]);
+ igt_hexdump(in, PAGE_SIZE);
+ kunmap(orig[page]);
+ }
max = page;
}
@@ -177,6 +202,8 @@ __igt_reset_stolen(struct intel_gt *gt,
kfree(tmp);
err_crc:
kfree(crc);
+err_orig:
+ kfree(orig);
return err;
}
--
2.25.1
More information about the Intel-gfx-trybot
mailing list