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

Commit 583980be authored by Shrenuj Bansal's avatar Shrenuj Bansal
Browse files

msm: kgsl: Move cmdbatch destroy out of the drawctxt spinlock



While emptying the cmdbatch synclist which is an rcu list during
cmdbatch destroy, there is a wait_for_completion() which can cause
the thread to go to sleep. As a result, we cannot destroy the
cmdbatch while holding the drawctxt spinlock since that would
cause a BUG.

Move the invalid cmdbatches into a temporary list as we loop
through the drawctxt cmdqueue and destroy them after releasing
the drawctxt spinlock.

Change-Id: Ia21f96999d8b9bd342c50a516a2ab4bbeda5ba7b
Signed-off-by: default avatarShrenuj Bansal <shrenujb@codeaurora.org>
parent dec3acb0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -226,6 +226,8 @@ void adreno_drawctxt_invalidate(struct kgsl_device *device,
		struct kgsl_context *context)
{
	struct adreno_context *drawctxt = ADRENO_CONTEXT(context);
	struct kgsl_cmdbatch *inv_cmdbatchs[ADRENO_CONTEXT_CMDQUEUE_SIZE];
	int i, cmd_num = 0;

	trace_adreno_drawctxt_invalidate(drawctxt);

@@ -255,11 +257,14 @@ void adreno_drawctxt_invalidate(struct kgsl_device *device,
		kgsl_cancel_events_timestamp(device, &context->events,
			cmdbatch->timestamp);

		kgsl_cmdbatch_destroy(cmdbatch);
		inv_cmdbatchs[cmd_num++] = cmdbatch;
	}

	spin_unlock(&drawctxt->lock);

	for (; cmd_num > 0; cmd_num--)
		kgsl_cmdbatch_destroy(inv_cmdbatchs[i]);

	/* Make sure all pending events are processed or cancelled */
	kgsl_flush_event_group(device, &context->events);