From 4122f747ac67eca4c27ffa8d7e91d7d0c3cb02a8 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 18 Feb 2020 07:43:51 -0500 Subject: [PATCH] pan/decode: Add `minimal` mode We would like a mode to skip decoding job payloads so we can just inspect for faults. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/gallium/drivers/panfrost/pan_job.c | 2 +- src/panfrost/pandecode/decode.c | 21 ++++++++++++++------- src/panfrost/pandecode/public.h | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index fb9812d29fd..8502f24e566 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -942,7 +942,7 @@ panfrost_batch_submit_ioctl(struct panfrost_batch *batch, /* Wait so we can get errors reported back */ drmSyncobjWait(screen->fd, &batch->out_sync->syncobj, 1, INT64_MAX, 0, NULL); - pandecode_jc(submit.jc, FALSE, screen->gpu_id); + pandecode_jc(submit.jc, FALSE, screen->gpu_id, false); } return 0; diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index 4cf7df2c74a..7e46014f3fa 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -2821,8 +2821,17 @@ pandecode_fragment_job(const struct pandecode_mapped_memory *mem, static int job_descriptor_number = 0; +/* Entrypoint to start tracing. jc_gpu_va is the GPU address for the first job + * in the chain; later jobs are found by walking the chain. Bifrost is, well, + * if it's bifrost or not. GPU ID is the more finegrained ID (at some point, we + * might wish to combine this with the bifrost parameter) because some details + * are model-specific even within a particular architecture. Minimal traces + * *only* examine the job descriptors, skipping printing entirely if there is + * no faults, and only descends into the payload if there are faults. This is + * useful for looking for faults without the overhead of invasive traces. */ + int -pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id) +pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal) { struct mali_job_descriptor_header *h; @@ -2853,6 +2862,10 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id) if (first) start_number = job_no; + /* If the job is good to go, skip it in minimal mode */ + if (minimal && (h->exception_status == 0x0 || h->exception_status == 0x1)) + continue; + pandecode_log("struct mali_job_descriptor_header job_%"PRIx64"_%d = {\n", jc_gpu_va, job_no); pandecode_indent++; @@ -2891,12 +2904,6 @@ pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id) pandecode_indent--; pandecode_log("};\n"); - /* Do not touch the field yet -- decode the payload first, and - * don't touch that either. This is essential for the uploads - * to occur in sequence and therefore be dynamically allocated - * correctly. Do note the size, however, for that related - * reason. */ - switch (h->job_type) { case JOB_TYPE_WRITE_VALUE: { struct mali_payload_write_value *s = payload; diff --git a/src/panfrost/pandecode/public.h b/src/panfrost/pandecode/public.h index 9144ea1b60d..4e460d4f4f3 100644 --- a/src/panfrost/pandecode/public.h +++ b/src/panfrost/pandecode/public.h @@ -51,7 +51,7 @@ void pandecode_close(void); void pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name); -int pandecode_jc(uint64_t jc_gpu_va, bool bifrost, unsigned gpu_id); +int pandecode_jc(uint64_t jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal); char * pandecode_exception_access(unsigned access); -- 2.30.2