From: Alan Previn <alan.previn.teres.alexis@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 07/11] tools/intel_guc_logger: Add overflow awareness.
Date: Tue, 6 Dec 2022 00:58:45 -0800 [thread overview]
Message-ID: <20221206085849.271505-8-alan.previn.teres.alexis@intel.com> (raw)
In-Reply-To: <20221206085849.271505-1-alan.previn.teres.alexis@intel.com>
Update header structure definition and make logger
aware of the fw overflow flag so that it can warn the
end user of possible decode issue at that point in the
file. Also, copy the entire buffer irrespective of the
head and tail ptrs when overflow occurs.
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
tools/intel_guc_logger.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/tools/intel_guc_logger.c b/tools/intel_guc_logger.c
index 57657e66..38c50598 100644
--- a/tools/intel_guc_logger.c
+++ b/tools/intel_guc_logger.c
@@ -95,6 +95,7 @@ struct guc_t {
bool header_stored;
bool stop_logging;
bool capturing_stopped;
+ uint32_t fw_overflows;
};
struct global_t {
@@ -345,7 +346,15 @@ struct guc_log_buffer_state_2_0 {
uint32_t size; /* the buffer size that driver and GuC shares */
uint32_t sampled_write_offset; /* end-offset exclusive of new data */
uint32_t wrap_offset; /* end-offset exclusive when data wraps */
- uint32_t flags; /* GuC uses to update driver of events like overflows */
+ union {
+ /* GuC uses to update driver of events like overflows */
+ struct {
+ uint32_t midflushing:1;
+ uint32_t overflow_count:4;
+ uint32_t reserved:27;
+ };
+ uint32_t flags;
+ };
uint32_t version; /* we currently recognize version 2 */
#define GUCLOGEVT_2_0_VERSION 0x0002
};
@@ -425,6 +434,7 @@ static bool write_extracted_data(struct global_t *gbl, struct guc_t *guc,
struct guc_log_buffer_state_2_0 header = {0};
int bytes_to_copy = 0, copied = 0, ret = 0, tmp;
bool first_header = !guc->header_stored;
+ bool is_overflowing = false;
memcpy(&header, inptr, sizeof(header));
@@ -440,6 +450,17 @@ static bool write_extracted_data(struct global_t *gbl, struct guc_t *guc,
inptr += GUCLOGEVT_2_0_START_OFFSET;
+ if (guc->fw_overflows == 0xFFFFFFFF) {
+ guc->fw_overflows = header.overflow_count;
+ } else if (header.overflow_count != (guc->fw_overflows & 0x000F)) {
+ if (header.overflow_count < (guc->fw_overflows & 0x000F))
+ guc->fw_overflows += 16;
+ guc->fw_overflows = (guc->fw_overflows & ~0x000F) + header.overflow_count;
+ is_overflowing = true;
+ igt_info("GuC FW Log Overflow #%d - possible decode kaput after offset %ld\n",
+ guc->fw_overflows, guc->consumed);
+ }
+
/*
* If we just begun relay logging, copy the header just once, else
* copy only the new data from relay subbuf but ensure the output
@@ -454,6 +475,12 @@ static bool write_extracted_data(struct global_t *gbl, struct guc_t *guc,
guc->header_stored = true;
}
+ /* head == tail means we are empty unless overflowing, else augment ptrs for full copy*/
+ if (is_overflowing) {
+ header.read_offset = 0;
+ header.sampled_write_offset = header.wrap_offset ? : header.size;
+ }
+
/* In case of wrap-around, copy data in chronological order, i.e. spatial end first*/
if (header.read_offset > header.sampled_write_offset) {
tmp = header.wrap_offset ? : header.size;
@@ -794,6 +821,7 @@ int main(int argc, char **argv)
memset(&gucdata[0], 0, sizeof(struct guc_t));
gucdata[0].gt_id = 0;
+ gucdata[0].fw_overflows = 0xFFFFFFFF;
igt_assert_neq(asprintf(&gucdata[0].fspath, "gt/uc"), -1);
gucdata[0].outfd = -1;
--
2.34.1
next prev parent reply other threads:[~2022-12-06 8:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 8:58 [igt-dev] [PATCH i-g-t v2 00/11] Resurrect GuC Relay Logging Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 01/11] tools/intel_guc_logger: Re-enable basic functionality Alan Previn
2023-01-20 20:26 ` [igt-dev] [i-g-t, v2, " Dong, Zhanjun
2023-03-14 21:46 ` Teres Alexis, Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 02/11] tools/intel_guc_logger: Refactor intel_guc_logger globals into structs Alan Previn
2023-02-01 0:04 ` [igt-dev] [i-g-t, v2, " Dong, Zhanjun
2023-03-14 21:47 ` Teres Alexis, Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 03/11] tools/intel_guc_logger: Add GT-ID selection for intel_guc_logger Alan Previn
2023-03-14 21:54 ` Teres Alexis, Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 04/11] tools/intel_guc_logger: Add helper function for flusher code Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 05/11] tools/intel_guc_logger: Add GuC Log header structure definition Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 06/11] tools/intel_guc_logger: Concatenate log samples into a contiguous file Alan Previn
2022-12-06 8:58 ` Alan Previn [this message]
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 08/11] tools/intel_guc_logger: Limit relay logging output file to 4GB Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 09/11] tools/intel_guc_logger: By default don't change GuC log verbosity Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 10/11] tools/intel_guc_logger: On exit, save any leftover GuC log data Alan Previn
2022-12-06 8:58 ` [igt-dev] [PATCH i-g-t v2 11/11] tools/intel_guc_logger: Add useful debug messages Alan Previn
2022-12-06 9:41 ` [igt-dev] ✓ Fi.CI.BAT: success for Resurrect GuC Relay Logging (rev2) Patchwork
2022-12-06 11:27 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20221206085849.271505-8-alan.previn.teres.alexis@intel.com \
--to=alan.previn.teres.alexis@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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