Mesa (master): intel/tools/error: Drop support for non-ascii85 encoded error states.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Nov 14 01:11:22 UTC 2017


Module: Mesa
Branch: master
Commit: 1898bf11a885c440fd861978f3ee204fe918b159
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1898bf11a885c440fd861978f3ee204fe918b159

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Nov 11 21:55:27 2017 -0800

intel/tools/error: Drop support for non-ascii85 encoded error states.

Error state files used to look like:

   render ring --- gtt_offset = 0x0e8f6000
   00000000 :  69040000
   00000004 :  79090000
   ...
   00007ffc :  00000000
   --- ringbuffer = 0x00001000

There were thousands of lines between sections.  The file format changed
with Kernel 4.10, and now has a single ascii85-encoded line following
each section heading.  This is much easier to parse.

There are a bunch of bugs in our handling of the old style format,
where we'd decode the wrong data, at the wrong time.  Fixing all of
these is going to be a giant pain.  It's also a lot of extra code
complexity.  In order to properly decode indirect state, or compute
shaders, we'll also need to parse data in advance of decoding, which
is going to be a giant pain with this ad-hoc "decode everywhere!"
mentality.  So, let's just drop support for the older file format.

This unfortunately requires an error state generated by Kernel 4.10 or
later.  That's probably not the end of the world, as we encourage users
to upgrade to the latest kernel when encountering GPU hangs anyway.  It
might be a giant pain for people with LTS kernels, though...

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/intel/tools/aubinator_error_decode.c | 39 ++++----------------------------
 1 file changed, 4 insertions(+), 35 deletions(-)

diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index 72919c1c9e..279f1ac01c 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -485,9 +485,8 @@ static void
 read_data_file(FILE *file)
 {
    struct gen_spec *spec = NULL;
-   uint32_t *data = NULL;
    long long unsigned fence;
-   int data_size = 0, count = 0, line_number = 0, matched;
+   int matched;
    char *line = NULL;
    size_t line_size;
    uint32_t offset, value;
@@ -500,7 +499,6 @@ read_data_file(FILE *file)
    while (getline(&line, &line_size, file) > 0) {
       char *new_ring_name = NULL;
       char *dashes;
-      line_number++;
 
       if (sscanf(line, "%m[^ ] command stream\n", &new_ring_name) > 0) {
          free(ring_name);
@@ -508,7 +506,8 @@ read_data_file(FILE *file)
       }
 
       if (line[0] == ':' || line[0] == '~') {
-         count = ascii85_decode(line+1, &data, line[0] == ':');
+         uint32_t *data = NULL;
+         int count = ascii85_decode(line+1, &data, line[0] == ':');
          if (count == 0) {
             fprintf(stderr, "ASCII85 decode failed.\n");
             exit(EXIT_FAILURE);
@@ -533,6 +532,7 @@ read_data_file(FILE *file)
          } else {
             decode(spec, buffer_name, ring_name, gtt_offset, data, &count);
          }
+         free(data);
          continue;
       }
 
@@ -554,9 +554,6 @@ read_data_file(FILE *file)
                new_gtt_offset |= lo;
             }
 
-            decode(spec,
-                   buffer_name, ring_name,
-                   gtt_offset, data, &count);
             gtt_offset = new_gtt_offset;
             free(ring_name);
             ring_name = new_ring_name;
@@ -573,9 +570,6 @@ read_data_file(FILE *file)
                new_gtt_offset |= lo;
             }
 
-            decode(spec,
-                   buffer_name, ring_name,
-                   gtt_offset, data, &count);
             gtt_offset = new_gtt_offset;
             free(ring_name);
             ring_name = new_ring_name;
@@ -592,9 +586,6 @@ read_data_file(FILE *file)
                new_gtt_offset |= lo;
             }
 
-            decode(spec,
-                   buffer_name, ring_name,
-                   gtt_offset, data, &count);
             gtt_offset = new_gtt_offset;
             free(ring_name);
             ring_name = new_ring_name;
@@ -624,10 +615,6 @@ read_data_file(FILE *file)
          uint32_t reg, reg2;
 
          /* display reg section is after the ringbuffers, don't mix them */
-         decode(spec,
-                buffer_name, ring_name,
-                gtt_offset, data, &count);
-
          printf("%s", line);
 
          matched = sscanf(line, "PCI ID: 0x%04x\n", &reg);
@@ -716,27 +703,9 @@ read_data_file(FILE *file)
 
          continue;
       }
-
-      count++;
-
-      if (count > data_size) {
-         data_size = data_size ? data_size * 2 : 1024;
-         data = realloc(data, data_size * sizeof (uint32_t));
-         if (data == NULL) {
-            fprintf(stderr, "Out of memory.\n");
-            exit(EXIT_FAILURE);
-         }
-      }
-
-      data[count-1] = value;
    }
 
-   decode(spec,
-          buffer_name, ring_name,
-          gtt_offset, data, &count);
-
    gen_disasm_destroy(disasm);
-   free(data);
    free(line);
    free(ring_name);
 }




More information about the mesa-commit mailing list