diff mbox

intel_error_decode: use 64b gtt_offset

Message ID 1398735950-23760-1-git-send-email-benjamin.widawsky@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky April 29, 2014, 1:45 a.m. UTC
See the relevant kernel patch for the details. I guess this breaks
support for older error state, I am not actually sure. Without
versioning our error state though, I cannot think of a better way.
Suggestions are welcome.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 tools/intel_error_decode.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Daniel Vetter April 29, 2014, 8:52 a.m. UTC | #1
On Mon, Apr 28, 2014 at 06:45:50PM -0700, Ben Widawsky wrote:
> See the relevant kernel patch for the details. I guess this breaks
> support for older error state, I am not actually sure. Without
> versioning our error state though, I cannot think of a better way.
> Suggestions are welcome.

Just drop the length qualifier and let scanf it the full number?
-Daniel

> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> ---
>  tools/intel_error_decode.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
> index 1eeff07..d0028a1 100644
> --- a/tools/intel_error_decode.c
> +++ b/tools/intel_error_decode.c
> @@ -311,17 +311,17 @@ print_fence(unsigned int devid, uint64_t fence)
>  uint32_t head[MAX_RINGS];
>  int head_ndx = 0;
>  int num_rings = 0;
> -static void print_batch(int is_batch, const char *ring_name, uint32_t gtt_offset)
> +static void print_batch(int is_batch, const char *ring_name, uint64_t gtt_offset)
>  {
>  	const char *buffer_type[2] = {  "ringbuffer", "batchbuffer" };
>  	if (is_batch || !num_rings)
> -		printf("%s (%s) at 0x%08x\n", buffer_type[is_batch], ring_name, gtt_offset);
> +		printf("%s (%s) at 0x%016lx\n", buffer_type[is_batch], ring_name, gtt_offset);
>  	else
> -		printf("%s (%s) at 0x%08x; HEAD points to: 0x%08x\n", buffer_type[is_batch], ring_name, gtt_offset, head[head_ndx++ % num_rings] + gtt_offset);
> +		printf("%s (%s) at 0x%016lx; HEAD points to: 0x%016lx\n", buffer_type[is_batch], ring_name, gtt_offset, head[head_ndx++ % num_rings] + gtt_offset);
>  }
>  
>  static void decode(struct drm_intel_decode *ctx, bool is_batch,
> -		   const char *ring_name, uint32_t gtt_offset, uint32_t *data,
> +		   const char *ring_name, uint64_t gtt_offset, uint32_t *data,
>  		   int *count)
>  {
>  	if (!*count)
> @@ -344,7 +344,7 @@ read_data_file(FILE *file)
>  	char *line = NULL;
>  	size_t line_size;
>  	uint32_t offset, value, ring_length = 0;
> -	uint32_t gtt_offset = 0, new_gtt_offset;
> +	uint64_t gtt_offset = 0, new_gtt_offset;
>  	char *ring_name = NULL;
>  	int is_batch = 1;
>  
> @@ -361,7 +361,7 @@ read_data_file(FILE *file)
>  			if (num_rings == -1)
>  				num_rings = head_ndx;
>  
> -			matched = sscanf(dashes, "--- gtt_offset = 0x%08x\n",
> +			matched = sscanf(dashes, "--- gtt_offset = 0x%016lx\n",
>  					&new_gtt_offset);
>  			if (matched == 1) {
>  				decode(decode_ctx, is_batch, ring_name,
> @@ -373,7 +373,7 @@ read_data_file(FILE *file)
>  				continue;
>  			}
>  
> -			matched = sscanf(dashes, "--- ringbuffer = 0x%08x\n",
> +			matched = sscanf(dashes, "--- ringbuffer = 0x%08lx\n",
>  					&new_gtt_offset);
>  			if (matched == 1) {
>  				decode(decode_ctx, is_batch, ring_name,
> -- 
> 1.9.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter April 29, 2014, 9:01 a.m. UTC | #2
On Tue, Apr 29, 2014 at 10:52:44AM +0200, Daniel Vetter wrote:
> On Mon, Apr 28, 2014 at 06:45:50PM -0700, Ben Widawsky wrote:
> > See the relevant kernel patch for the details. I guess this breaks
> > support for older error state, I am not actually sure. Without
> > versioning our error state though, I cannot think of a better way.
> > Suggestions are welcome.
> 
> Just drop the length qualifier and let scanf it the full number?

Also, you know the drill: Testcase, please. A copy of drv_hangman to also
feed the captured error state into intel_error_decode and check that it
doesn't fall overr (exitcode != 0 and nothing on stderr). Maybe call it
drv_error_decode or something like that.
-Daniel
Chris Wilson April 29, 2014, 10:48 a.m. UTC | #3
On Tue, Apr 29, 2014 at 11:01:10AM +0200, Daniel Vetter wrote:
> On Tue, Apr 29, 2014 at 10:52:44AM +0200, Daniel Vetter wrote:
> > On Mon, Apr 28, 2014 at 06:45:50PM -0700, Ben Widawsky wrote:
> > > See the relevant kernel patch for the details. I guess this breaks
> > > support for older error state, I am not actually sure. Without
> > > versioning our error state though, I cannot think of a better way.
> > > Suggestions are welcome.
> > 
> > Just drop the length qualifier and let scanf it the full number?
> 
> Also, you know the drill: Testcase, please. A copy of drv_hangman to also
> feed the captured error state into intel_error_decode and check that it
> doesn't fall overr (exitcode != 0 and nothing on stderr). Maybe call it
> drv_error_decode or something like that.

Actually, I would have hoped you asked for uniformity in presenting and
parsing 64bit values :)
-Chris
Daniel Vetter April 29, 2014, 11:05 a.m. UTC | #4
On Tue, Apr 29, 2014 at 12:48 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Tue, Apr 29, 2014 at 11:01:10AM +0200, Daniel Vetter wrote:
>> On Tue, Apr 29, 2014 at 10:52:44AM +0200, Daniel Vetter wrote:
>> > On Mon, Apr 28, 2014 at 06:45:50PM -0700, Ben Widawsky wrote:
>> > > See the relevant kernel patch for the details. I guess this breaks
>> > > support for older error state, I am not actually sure. Without
>> > > versioning our error state though, I cannot think of a better way.
>> > > Suggestions are welcome.
>> >
>> > Just drop the length qualifier and let scanf it the full number?
>>
>> Also, you know the drill: Testcase, please. A copy of drv_hangman to also
>> feed the captured error state into intel_error_decode and check that it
>> doesn't fall overr (exitcode != 0 and nothing on stderr). Maybe call it
>> drv_error_decode or something like that.
>
> Actually, I would have hoped you asked for uniformity in presenting and
> parsing 64bit values :)

That approaches a turing test, so a bit out of scope for igt ;-)
-Daniel
Ben Widawsky April 30, 2014, 12:54 a.m. UTC | #5
On Tue, Apr 29, 2014 at 11:01:10AM +0200, Daniel Vetter wrote:
> On Tue, Apr 29, 2014 at 10:52:44AM +0200, Daniel Vetter wrote:
> > On Mon, Apr 28, 2014 at 06:45:50PM -0700, Ben Widawsky wrote:
> > > See the relevant kernel patch for the details. I guess this breaks
> > > support for older error state, I am not actually sure. Without
> > > versioning our error state though, I cannot think of a better way.
> > > Suggestions are welcome.
> > 
> > Just drop the length qualifier and let scanf it the full number?
> 
> Also, you know the drill: Testcase, please. A copy of drv_hangman to also
> feed the captured error state into intel_error_decode and check that it
> doesn't fall overr (exitcode != 0 and nothing on stderr). Maybe call it
> drv_error_decode or something like that.
> -Daniel

You're not going to get it from me. If you don't take the patch, that's
fine by me.
diff mbox

Patch

diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
index 1eeff07..d0028a1 100644
--- a/tools/intel_error_decode.c
+++ b/tools/intel_error_decode.c
@@ -311,17 +311,17 @@  print_fence(unsigned int devid, uint64_t fence)
 uint32_t head[MAX_RINGS];
 int head_ndx = 0;
 int num_rings = 0;
-static void print_batch(int is_batch, const char *ring_name, uint32_t gtt_offset)
+static void print_batch(int is_batch, const char *ring_name, uint64_t gtt_offset)
 {
 	const char *buffer_type[2] = {  "ringbuffer", "batchbuffer" };
 	if (is_batch || !num_rings)
-		printf("%s (%s) at 0x%08x\n", buffer_type[is_batch], ring_name, gtt_offset);
+		printf("%s (%s) at 0x%016lx\n", buffer_type[is_batch], ring_name, gtt_offset);
 	else
-		printf("%s (%s) at 0x%08x; HEAD points to: 0x%08x\n", buffer_type[is_batch], ring_name, gtt_offset, head[head_ndx++ % num_rings] + gtt_offset);
+		printf("%s (%s) at 0x%016lx; HEAD points to: 0x%016lx\n", buffer_type[is_batch], ring_name, gtt_offset, head[head_ndx++ % num_rings] + gtt_offset);
 }
 
 static void decode(struct drm_intel_decode *ctx, bool is_batch,
-		   const char *ring_name, uint32_t gtt_offset, uint32_t *data,
+		   const char *ring_name, uint64_t gtt_offset, uint32_t *data,
 		   int *count)
 {
 	if (!*count)
@@ -344,7 +344,7 @@  read_data_file(FILE *file)
 	char *line = NULL;
 	size_t line_size;
 	uint32_t offset, value, ring_length = 0;
-	uint32_t gtt_offset = 0, new_gtt_offset;
+	uint64_t gtt_offset = 0, new_gtt_offset;
 	char *ring_name = NULL;
 	int is_batch = 1;
 
@@ -361,7 +361,7 @@  read_data_file(FILE *file)
 			if (num_rings == -1)
 				num_rings = head_ndx;
 
-			matched = sscanf(dashes, "--- gtt_offset = 0x%08x\n",
+			matched = sscanf(dashes, "--- gtt_offset = 0x%016lx\n",
 					&new_gtt_offset);
 			if (matched == 1) {
 				decode(decode_ctx, is_batch, ring_name,
@@ -373,7 +373,7 @@  read_data_file(FILE *file)
 				continue;
 			}
 
-			matched = sscanf(dashes, "--- ringbuffer = 0x%08x\n",
+			matched = sscanf(dashes, "--- ringbuffer = 0x%08lx\n",
 					&new_gtt_offset);
 			if (matched == 1) {
 				decode(decode_ctx, is_batch, ring_name,