> > + FILE *file; > > + int debug_fd; > > + char *line = NULL; > > + size_t line_size = 0; > > + char *dashes = NULL; > > + char *ring_name = NULL; > > + int bb_matched = 0; > > + uint32_t gtt_offset; > > + char expected_line[32]; > > + int req_matched = 0; > > + int requests; > > + uint32_t seqno, tail; > > + long jiffies; > > + int ringbuf_matched = 0; > > + unsigned int offset, command, expected_addr = 0; > > + int i, items; > > + bool bb_ok = false, req_ok = false, ringbuf_ok = false; > > Most of these are only of use in local scope. ACK, will change. > > + debug_fd = igt_debugfs_open("i915_error_state", O_RDONLY); > > + igt_assert(debug_fd >= 0); > > + file = fdopen(debug_fd, "r"); > > + > > + while (getline(&line, &line_size, file) > 0) { > > + dashes = strstr(line, "---"); > > + if (!dashes) > > + continue; > > + > > + ring_name = realloc(ring_name, dashes - line); > > + strncpy(ring_name, line, dashes - line); > > + ring_name[dashes - line - 1] = '\0'; > > + > > + bb_matched = sscanf(dashes, "--- gtt_offset = 0x%08x\n", > > + >t_offset); > > + if (bb_matched == 1) { > > + igt_assert(strstr(ring_name, expected_ring_name)); > > + igt_assert(gtt_offset == expected_offset); > > + > > + for (i = 0; i < sizeof(batch) / 4; i++) { > > + igt_assert(getline(&line, &line_size, file) > 0); > > + snprintf(expected_line, sizeof(expected_line), > "%08x : %08x", > > + 4*i, batch[i]); > > + igt_assert(strstr(line, expected_line)); > > + } > > + bb_ok = true; > > + continue; > > + } > > + > > + req_matched = sscanf(dashes, "--- %d requests\n", > > + &requests); > > + if (req_matched == 1) { > > + igt_assert(strstr(ring_name, expected_ring_name)); > > + igt_assert(requests == 1); > > Bad assumption. You could still have the request from > gem_quiescent_gpu() which may not have been retired before the error > triggers. Hmmmm... but I make a first valid gem_execbuf()+gem_sync() before the one that actually hangs. Shouldn´t that make sure that all previous requests have been retired? > > + > > + igt_assert(getline(&line, &line_size, file) > 0); > > + items = sscanf(line, " seqno 0x%08x, emitted %ld, tail > 0x%08x\n", > > + &seqno, &jiffies, &tail); > > + igt_assert(items == 3); > > Bad. I may change the format. s/may/will/ I still need to make sure I got a valid tail, so I need to know the format and fail if don´t understand it. Or do you want me to use a different tail, maybe the ringbuffer one? > > + req_ok = true; > > + continue; > > + } > > + > > + ringbuf_matched = sscanf(dashes, "--- ringbuffer = 0x%08x\n", > > + >t_offset); > > + if (ringbuf_matched == 1) { > > + if (!strstr(ring_name, expected_ring_name)) > > + continue; > > + igt_assert(req_ok); > > + > > + for (i = 0; i < tail / 4; i++) { > > + igt_assert(getline(&line, &line_size, file) > 0); > > + items = sscanf(line, "%08x : %08x\n", > > + &offset, &command); > > + igt_assert(items == 2); > > + if ((command & 0x1F800000) == > MI_BATCH_BUFFER_START) { > > + igt_assert(getline(&line, &line_size, > file) > 0); > > + items = sscanf(line, "%08x : %08x\n", > > + &offset, > &expected_addr); > > + igt_assert(items == 2); > > + i++; > > + } > > + } > > + igt_assert(expected_addr == expected_offset); > > Bad. Some gen encode flags into the BB start address. ACK, will change. > > + ringbuf_ok = true; > > + continue; > > + } > > + > > + if (bb_ok && req_ok && ringbuf_ok) > > + break; > > + } > > + igt_assert(bb_ok && req_ok && ringbuf_ok); > > + > > + free(line); > > + free(ring_name); > > + close(debug_fd); > > +} _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx