Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41c7e1df authored by Harshdeep Dhatt's avatar Harshdeep Dhatt Committed by Jordan Crouse
Browse files

msm: kgsl: Store cmdbatch execution times from submit to retire



Store the time delta from cmdbatch submit to retire and dump
it in the event of fence timeout on fences that we own. This
piece of information helps debug fence timeout issues.

Change-Id: If4c89b70234998627df73f1cf133d8f7634bc937
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent 0b51b3a7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -529,6 +529,8 @@ static int sendcmd(struct adreno_device *adreno_dev,
	trace_adreno_cmdbatch_submitted(cmdbatch, (int) dispatcher->inflight,
		time.ticks, (unsigned long) secs, nsecs / 1000);

	cmdbatch->submit_ticks = time.ticks;

	dispatch_q->cmd_q[dispatch_q->tail] = cmdbatch;
	dispatch_q->tail = (dispatch_q->tail + 1) %
		ADRENO_DISPATCH_CMDQUEUE_SIZE;
@@ -1796,6 +1798,13 @@ static int adreno_dispatch_process_cmdqueue(struct adreno_device *adreno_dev,
				(int) dispatcher->inflight, start_ticks,
				retire_ticks);

			/* Record the delta between submit and retire ticks */
			drawctxt->submit_retire_ticks[drawctxt->ticks_index] =
				retire_ticks - cmdbatch->submit_ticks;

			drawctxt->ticks_index = (drawctxt->ticks_index + 1)
				% SUBMIT_RETIRE_TICKS_SIZE;

			/* Zero the old entry*/
			dispatch_q->cmd_q[dispatch_q->head] = NULL;

+21 −1
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ void adreno_drawctxt_dump(struct kgsl_device *device,
{
	unsigned int queue, start, retire;
	struct adreno_context *drawctxt = ADRENO_CONTEXT(context);

	int index, pos;
	char buf[120];
	mutex_lock(&drawctxt->mutex);

	kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_QUEUED, &queue);
@@ -88,6 +89,25 @@ void adreno_drawctxt_dump(struct kgsl_device *device,
		spin_unlock(&cmdbatch->lock);
	}

	memset(buf, 0, sizeof(buf));

	pos = 0;

	for (index = 0; index < SUBMIT_RETIRE_TICKS_SIZE; index++) {
		uint64_t msecs;
		unsigned int usecs;

		if (!drawctxt->submit_retire_ticks[index])
			continue;
		msecs = drawctxt->submit_retire_ticks[index] * 10;
		usecs = do_div(msecs, 192);
		usecs = do_div(msecs, 1000);
		pos += snprintf(buf + pos, sizeof(buf) - pos, "%d.%0d ",
			(unsigned int)msecs, usecs);
	}
	dev_err(device->dev, "  context[%d]: submit times: %s\n",
		context->id, buf);

	mutex_unlock(&drawctxt->mutex);
}

+7 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ struct adreno_context_type {
};

#define ADRENO_CONTEXT_CMDQUEUE_SIZE 128
#define SUBMIT_RETIRE_TICKS_SIZE 7

struct kgsl_device;
struct adreno_device;
@@ -46,6 +47,10 @@ struct kgsl_context;
 * @queued_timestamp: The last timestamp that was queued on this context
 * @rb: The ringbuffer in which this context submits commands.
 * @submitted_timestamp: The last timestamp that was submitted for this context
 * @submit_retire_ticks: Array to hold cmdbatch execution times from submit
 *                       to retire
 * @ticks_index: The index into submit_retire_ticks[] where the new delta will
 *		 be written.
 */
struct adreno_context {
	struct kgsl_context base;
@@ -69,6 +74,8 @@ struct adreno_context {
	unsigned int queued_timestamp;
	struct adreno_ringbuffer *rb;
	unsigned int submitted_timestamp;
	uint64_t submit_retire_ticks[SUBMIT_RETIRE_TICKS_SIZE];
	int ticks_index;
};

/**
+2 −0
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ struct kgsl_memobj_node {
 * for easy access
 * @profile_index: Index to store the start/stop ticks in the kernel profiling
 * buffer
 * @submit_ticks: Variable to hold ticks at the time of cmdbatch submit.
 * This structure defines an atomic batch of command buffers issued from
 * userspace.
 */
@@ -262,6 +263,7 @@ struct kgsl_cmdbatch {
	struct kgsl_mem_entry *profiling_buf_entry;
	unsigned long profiling_buffer_gpuaddr;
	unsigned int profile_index;
	uint64_t submit_ticks;
};

/**