Browse Source

intel/decoders: limit number of decoded batchbuffers

IGT has a test to hang the GPU that works by having a batch buffer
jump back into itself, trigger an infinite loop on the command stream.
As our implementation of the decoding is "perfectly" mimicking the
hardware, our decoder also "hangs". This change limits the number of
batch buffer we'll decode before we bail to 100.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
tags/19.1-branchpoint
Lionel Landwerlin 7 years ago
parent
commit
bf93084f44

+ 13
- 2
src/intel/common/gen_batch_decoder.c View File

const uint32_t *p, *end = batch + batch_size / sizeof(uint32_t); const uint32_t *p, *end = batch + batch_size / sizeof(uint32_t);
int length; int length;
struct gen_group *inst; struct gen_group *inst;
const char *reset_color = ctx->flags & GEN_BATCH_DECODE_IN_COLOR ? NORMAL : "";

if (ctx->n_batch_buffer_start >= 100) {
fprintf(ctx->fp, "%s0x%08"PRIx64": Max batch buffer jumps exceeded%s\n",
(ctx->flags & GEN_BATCH_DECODE_IN_COLOR) ? RED_COLOR : "",
(ctx->flags & GEN_BATCH_DECODE_OFFSETS) ? batch_addr : 0,
reset_color);
return;
}

ctx->n_batch_buffer_start++;


for (p = batch; p < end; p += length) { for (p = batch; p < end; p += length) {
inst = gen_ctx_find_instruction(ctx, p); inst = gen_ctx_find_instruction(ctx, p);
assert(inst == NULL || length > 0); assert(inst == NULL || length > 0);
length = MAX2(1, length); length = MAX2(1, length);


const char *reset_color = ctx->flags & GEN_BATCH_DECODE_IN_COLOR ? NORMAL : "";

uint64_t offset; uint64_t offset;
if (ctx->flags & GEN_BATCH_DECODE_OFFSETS) if (ctx->flags & GEN_BATCH_DECODE_OFFSETS)
offset = batch_addr + ((char *)p - (char *)batch); offset = batch_addr + ((char *)p - (char *)batch);
break; break;
} }
} }

ctx->n_batch_buffer_start--;
} }

+ 2
- 0
src/intel/common/gen_decoder.h View File

int max_vbo_decoded_lines; int max_vbo_decoded_lines;


enum drm_i915_gem_engine_class engine; enum drm_i915_gem_engine_class engine;

int n_batch_buffer_start;
}; };


void gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx, void gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,

+ 2
- 0
src/intel/tools/aubinator_viewer.h View File

enum aub_decode_stage stage; enum aub_decode_stage stage;
uint32_t end_urb_offset; uint32_t end_urb_offset;
struct aub_decode_urb_stage_state urb_stages[AUB_DECODE_N_STAGE]; struct aub_decode_urb_stage_state urb_stages[AUB_DECODE_N_STAGE];

int n_batch_buffer_start;
}; };


void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx, void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx,

+ 10
- 0
src/intel/tools/aubinator_viewer_decoder.cpp View File

const uint32_t *p, *batch = (const uint32_t *) _batch, *end = batch + batch_size / sizeof(uint32_t); const uint32_t *p, *batch = (const uint32_t *) _batch, *end = batch + batch_size / sizeof(uint32_t);
int length; int length;


if (ctx->n_batch_buffer_start >= 100) {
ImGui::TextColored(ctx->cfg->error_color,
"0x%08" PRIx64 ": Max batch buffer jumps exceeded", batch_addr);
return;
}

ctx->n_batch_buffer_start++;

for (p = batch; p < end; p += length) { for (p = batch; p < end; p += length) {
inst = gen_spec_find_instruction(ctx->spec, ctx->engine, p); inst = gen_spec_find_instruction(ctx->spec, ctx->engine, p);
length = gen_group_get_length(inst, p); length = gen_group_get_length(inst, p);
break; break;
} }
} }

ctx->n_batch_buffer_start--;
} }

Loading…
Cancel
Save