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

Commit 48ec5471 authored by Prakash Kamliya's avatar Prakash Kamliya Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Avoid spin lock recursion in adreno_drawctxt_dump



A sync fence timeout may lead to call adreno_drawctxt_dump().
At the same time, cmdbatch timer expires and scheduled to run
on same CPU, which might result into calling adreno_drawctxt_dump()
for the same context. This result into deadlock for drawctx->lock.
Use spin_lock_bh to disable soft irq (timer) while we are dumping
the sync pt for fence timeout.

Change-Id: I25461358aaff4b5011002f57bfe6b3cadce72dac
CRs-Fixed: 876017
Signed-off-by: default avatarPrakash Kamliya <pkamliya@codeaurora.org>
parent da9777c8
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -60,7 +60,12 @@ void adreno_drawctxt_dump(struct kgsl_device *device,
	kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_CONSUMED, &start);
	kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &retire);

	spin_lock(&drawctxt->lock);
	/*
	 * We may have cmdbatch timer running, which also uses same
	 * lock, take a lock with software interrupt disabled (bh)
	 * to avoid spin lock recursion.
	 */
	spin_lock_bh(&drawctxt->lock);
	dev_err(device->dev,
		"  context[%d]: queue=%d, submit=%d, start=%d, retire=%d\n",
		context->id, queue, drawctxt->submitted_timestamp,
@@ -108,7 +113,7 @@ stats:
	dev_err(device->dev, "  context[%d]: submit times: %s\n",
		context->id, buf);

	spin_unlock(&drawctxt->lock);
	spin_unlock_bh(&drawctxt->lock);
}

/**