From: pravalika gurram <pravalika.gurram@intel.com>
To: igt-dev@lists.freedesktop.org, zhanjun.dong@intel.com
Cc: pravalika gurram <pravalika.gurram@intel.com>
Subject: [PATCH v3] tests/intel/xe_exec_capture: Enhance test to check with DUMPABLE flag
Date: Wed, 12 Feb 2025 21:02:52 +0530 [thread overview]
Message-ID: <20250212153252.790029-1-pravalika.gurram@intel.com> (raw)
check if the VM is there when DRM_XE_VM_BIND_FLAG_DUMPABLE is set
in the generated devcoredump. check VM address within the range.
VM address is located after END_TAG and is at the end of dump, that's
why "stop on END_TAG" is removed.
Signed-off-by: pravalika gurram <pravalika.gurram@intel.com>
---
tests/intel/xe_exec_capture.c | 63 +++++++++++++++++++++++++----------
1 file changed, 45 insertions(+), 18 deletions(-)
diff --git a/tests/intel/xe_exec_capture.c b/tests/intel/xe_exec_capture.c
index 55ec3d4bd..4cc58928e 100644
--- a/tests/intel/xe_exec_capture.c
+++ b/tests/intel/xe_exec_capture.c
@@ -53,16 +53,15 @@
#define DUMP_PATH "/sys/class/drm/card%d/device/devcoredump/data"
#define START_TAG "**** Job ****"
-#define END_TAG "**** VM state ****"
/* Optional Space */
-#define SPC_O "[ \t]*"
+#define SPC_O "[ \t\\.]*"
/* Required Space */
-#define SPC "[ \t]+"
+#define SPC "[ \t\\.]+"
/* Optional Non-Space */
-#define NSPC_O "([^ \t]*)"
+#define NSPC_O "([^ \t\\.]*)"
/* Required Non-Space */
-#define NSPC "([^ \t]+)"
+#define NSPC "([^ \t\\.]+)"
#define BEG "^" SPC_O
#define REQ_FIELD NSPC SPC
#define REQ_FIELD_LAST NSPC SPC_O
@@ -77,6 +76,8 @@
#define INDEX_ENGINE_PHYSICAL 2
#define INDEX_ENGINE_NAME 1
#define INDEX_ENGINE_INSTANCE 4
+#define INDEX_VM_LENGTH 2
+#define INDEX_VM_SIZE 3
static u64
xe_sysfs_get_job_timeout_ms(int fd, struct drm_xe_engine_class_instance *eci)
@@ -177,7 +178,8 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci, int n_exec_qu
};
sync[0].handle = syncobj_create(fd, 0);
- xe_vm_bind_async(fd, vm, 0, bo, 0, addr, bo_size, sync, 1);
+ __xe_vm_bind_assert(fd, vm, 0, bo, 0, addr, bo_size,
+ DRM_XE_VM_BIND_OP_MAP, flags, sync, 1, 0, 0);
for (i = 0; i < n_execs; i++) {
u64 base_addr = addr;
@@ -287,10 +289,6 @@ static int load_all(FILE *fd, char **lines, char *buf)
/* Only save up to MAX_LINE_LEN to buffer */
safe_strncpy(lines[i++], buf, MAX_LINE_LEN);
-
- /* Stop on END_TAG */
- if (!strncmp(END_TAG, buf, strlen(END_TAG)))
- break;
}
return start_line;
}
@@ -351,7 +349,6 @@ static char
value = &line[match[target_index].rm_so];
line[match[target_index].rm_eo] = '\0';
}
-
if (key && value && strcmp(tag, key) == 0)
return value;
/* if key != tag, keep searching and loop to next line */
@@ -361,16 +358,43 @@ static char
return NULL;
}
+/* example i/p : [1580001a0000].length: 0x10000 */
+
+static uint64_t
+compare_hex_value(const char *output)
+{
+ char result[64];
+ uint64_t ret_val;
+ char *src = (char *)output, *dst = result;
+
+ while (*src) {
+ if (*src == '[' || *src == ']') {
+ src++;
+ continue;
+ }
+
+ *dst = toupper((unsigned char)*src);
+ dst++;
+ src++;
+ }
+ *dst = '\0';
+ ret_val = strtoull(result, NULL, 16);
+ return ret_val;
+}
+
static void
-check_item_u64(regex_t *regex, char **lines, const char *tag, u64 addr_lo, u64 addr_hi)
+check_item_u64(regex_t *regex, char **lines, const char *tag, u64 addr_lo,
+ u64 addr_hi, int tag_index, int target_index)
{
u64 result;
char *output;
- igt_assert_f((output = get_coredump_item(regex, lines, tag, INDEX_KEY, INDEX_VALUE)),
+ igt_assert_f((output = get_coredump_item(regex, lines, tag, tag_index, target_index)),
"Target not found:%s\n", tag);
- result = strtoul(output, NULL, 16);
- igt_debug("Compare %s %s vs [0x%lX-0x%lX]\n", tag, output, addr_lo, addr_hi);
+
+ result = compare_hex_value(output);
+ igt_debug("Compare %s %s vs [0x%lX-0x%lX] result %lX\n", tag, output,
+ addr_lo, addr_hi, result);
igt_assert_f((addr_lo <= result) && (result <= addr_hi),
"value %lX out of range[0x%lX-0x%lX]\n", result, addr_lo, addr_hi);
}
@@ -435,7 +459,7 @@ static void test_card(int fd)
igt_debug("Running on engine class: %x instance: %x\n", hwe->engine_class,
hwe->engine_instance);
- test_legacy_mode(fd, hwe, 1, 1, 0, addr);
+ test_legacy_mode(fd, hwe, 1, 1, DRM_XE_VM_BIND_FLAG_DUMPABLE, addr);
/* Wait 1 sec for devcoredump complete */
sleep(1);
@@ -451,10 +475,13 @@ static void test_card(int fd)
check_item_str(®ex, lines, "Capture_source:", INDEX_KEY, INDEX_VALUE,
"GuC", false);
+
check_item_u64(®ex, lines, "ACTHD:", addr,
- addr + BATCH_DW_COUNT * sizeof(u32));
+ addr + BATCH_DW_COUNT * sizeof(u32), INDEX_KEY, INDEX_VALUE);
check_item_u64(®ex, lines, "RING_BBADDR:", addr,
- addr + BATCH_DW_COUNT * sizeof(u32));
+ addr + BATCH_DW_COUNT * sizeof(u32), INDEX_KEY, INDEX_VALUE);
+ check_item_u64(®ex, lines, "length:", addr,
+ addr + BATCH_DW_COUNT * sizeof(u32), INDEX_VALUE, INDEX_KEY);
/* clear devcoredump */
rm_devcoredump(path);
--
2.37.1
next reply other threads:[~2025-02-12 15:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 15:32 pravalika gurram [this message]
2025-02-12 21:43 ` [PATCH v3] tests/intel/xe_exec_capture: Enhance test to check with DUMPABLE flag Dong, Zhanjun
2025-02-17 6:06 ` Gurram, Pravalika
2025-02-13 1:22 ` ✗ GitLab.Pipeline: warning for tests/intel/xe_exec_capture: Enhance test to check with DUMPABLE flag (rev3) Patchwork
2025-02-13 1:54 ` ✓ i915.CI.BAT: success " Patchwork
2025-02-13 1:58 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-13 11:08 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-13 13:54 ` ✗ Xe.CI.Full: " 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=20250212153252.790029-1-pravalika.gurram@intel.com \
--to=pravalika.gurram@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=zhanjun.dong@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