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

Commit 35bfdb57 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Fix drawqueue timer race condition"

parents 93e4b12e 10ae2ed6
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/wait.h>
@@ -632,6 +632,17 @@ static int sendcmd(struct adreno_device *adreno_dev,
	secs = time.ktime;
	nsecs = do_div(secs, 1000000000);

	/*
	 * For the first submission in any given command queue update the
	 * expected expire time - this won't actually be used / updated until
	 * the command queue in question goes current, but universally setting
	 * it here avoids the possibilty of some race conditions with preempt
	 */

	if (dispatch_q->inflight == 1)
		dispatch_q->expires = jiffies +
			msecs_to_jiffies(adreno_drawobj_timeout);

	trace_adreno_cmdbatch_submitted(drawobj, (int) dispatcher->inflight,
		time.ticks, (unsigned long) secs, nsecs / 1000, drawctxt->rb,
		adreno_get_rptr(drawctxt->rb));
@@ -644,17 +655,6 @@ static int sendcmd(struct adreno_device *adreno_dev,
	dispatch_q->tail = (dispatch_q->tail + 1) %
		ADRENO_DISPATCH_DRAWQUEUE_SIZE;

	/*
	 * For the first submission in any given command queue update the
	 * expected expire time - this won't actually be used / updated until
	 * the command queue in question goes current, but universally setting
	 * it here avoids the possibilty of some race conditions with preempt
	 */

	if (dispatch_q->inflight == 1)
		dispatch_q->expires = jiffies +
			msecs_to_jiffies(adreno_drawobj_timeout);

	/*
	 * If we believe ourselves to be current and preemption isn't a thing,
	 * then set up the timer.  If this misses, then preemption is indeed a
+7 −2
Original line number Diff line number Diff line
@@ -396,6 +396,12 @@ static inline int cp_mem_write(struct adreno_device *adreno_dev,
	return dwords;
}

static bool _check_secured(struct adreno_context *drawctxt, unsigned int flags)
{
	return ((drawctxt->base.flags & KGSL_CONTEXT_SECURE) &&
		!is_internal_cmds(flags));
}

static int
adreno_ringbuffer_addcmds(struct adreno_ringbuffer *rb,
				unsigned int flags, unsigned int *cmds,
@@ -441,8 +447,7 @@ adreno_ringbuffer_addcmds(struct adreno_ringbuffer *rb,
	 */
	if (drawctxt) {
		drawctxt->internal_timestamp = rb->timestamp;
		if (drawctxt->base.flags & KGSL_CONTEXT_SECURE)
			secured_ctxt = true;
		secured_ctxt = _check_secured(drawctxt, flags);
	}

	/*