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

Commit 7a63b2b9 authored by Carter Cooper's avatar Carter Cooper
Browse files

msm: kgsl: Remove A4XX preemption fair scheduler



Preemption was never enabled for A4XX but there is a lot of
bookkeeping done for it. Remove this feature since it is never
enabled but corresponds to non-zero amounts of code.

Change-Id: Icc0135fd25f91f9b2a32df1d9b4c2c101ac35b65
Signed-off-by: default avatarCarter Cooper <ccooper@codeaurora.org>
parent da1bc76d
Loading
Loading
Loading
Loading
+5 −68
Original line number Diff line number Diff line
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -305,57 +305,15 @@ static void a4xx_preempt_trig_state(struct adreno_device *adreno_dev)
static struct adreno_ringbuffer *a4xx_next_ringbuffer(
		struct adreno_device *adreno_dev)
{
	struct adreno_ringbuffer *rb, *next = NULL;
	struct adreno_ringbuffer *rb;
	int i;

	FOR_EACH_RINGBUFFER(adreno_dev, rb, i) {
		if (!adreno_rb_empty(rb) && next == NULL) {
			next = rb;
			continue;
		if (!adreno_rb_empty(rb))
			return rb;
	}

		if (!adreno_disp_preempt_fair_sched)
			continue;

		switch (rb->starve_timer_state) {
		case ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT:
			if (!adreno_rb_empty(rb) &&
				adreno_dev->cur_rb != rb) {
				rb->starve_timer_state =
				ADRENO_DISPATCHER_RB_STARVE_TIMER_INIT;
				rb->sched_timer = jiffies;
			}
			break;
		case ADRENO_DISPATCHER_RB_STARVE_TIMER_INIT:
			if (time_after(jiffies, rb->sched_timer +
				msecs_to_jiffies(
					adreno_dispatch_starvation_time))) {
				rb->starve_timer_state =
				ADRENO_DISPATCHER_RB_STARVE_TIMER_ELAPSED;
				/* halt dispatcher to remove starvation */
				adreno_get_gpu_halt(adreno_dev);
			}
			break;
		case ADRENO_DISPATCHER_RB_STARVE_TIMER_SCHEDULED:
			/*
			 * If the RB has not been running for the minimum
			 * time slice then allow it to run
			 */
			if (!adreno_rb_empty(rb) && time_before(jiffies,
				adreno_dev->cur_rb->sched_timer +
				msecs_to_jiffies(adreno_dispatch_time_slice)))
				next = rb;
			else
				rb->starve_timer_state =
				ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT;
			break;
		case ADRENO_DISPATCHER_RB_STARVE_TIMER_ELAPSED:
		default:
			break;
		}
	}

	return next;
	return NULL;
}

static void a4xx_preempt_clear_state(struct adreno_device *adreno_dev)
@@ -490,27 +448,6 @@ static void a4xx_preempt_complete_state(struct adreno_device *adreno_dev)
	adreno_dev->cur_rb->wptr_preempt_end = 0xFFFFFFFF;
	adreno_dev->next_rb = NULL;

	if (adreno_disp_preempt_fair_sched) {
		/* starved rb is now scheduled so unhalt dispatcher */
		if (ADRENO_DISPATCHER_RB_STARVE_TIMER_ELAPSED ==
			adreno_dev->cur_rb->starve_timer_state)
			adreno_put_gpu_halt(adreno_dev);
		adreno_dev->cur_rb->starve_timer_state =
				ADRENO_DISPATCHER_RB_STARVE_TIMER_SCHEDULED;
		adreno_dev->cur_rb->sched_timer = jiffies;
		/*
		 * If the outgoing RB is has commands then set the
		 * busy time for it
		 */
		if (!adreno_rb_empty(adreno_dev->prev_rb)) {
			adreno_dev->prev_rb->starve_timer_state =
				ADRENO_DISPATCHER_RB_STARVE_TIMER_INIT;
			adreno_dev->prev_rb->sched_timer = jiffies;
		} else {
			adreno_dev->prev_rb->starve_timer_state =
				ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT;
		}
	}
	adreno_set_preempt_state(adreno_dev, ADRENO_PREEMPT_NONE);

	prevrptr = adreno_get_rptr(adreno_dev->prev_rb);
+0 −30
Original line number Diff line number Diff line
@@ -26,21 +26,6 @@

#define DRAWQUEUE_NEXT(_i, _s) (((_i) + 1) % (_s))

/* Time in ms after which the dispatcher tries to schedule an unscheduled RB */
unsigned int adreno_dispatch_starvation_time = 2000;

/* Amount of time in ms that a starved RB is permitted to execute for */
unsigned int adreno_dispatch_time_slice = 25;

/*
 * If set then dispatcher tries to schedule lower priority RB's after if they
 * have commands in their pipe and have been inactive for
 * _dispatch_starvation_time. Also, once an RB is schduled it will be allowed
 * to run for _dispatch_time_slice unless it's commands complete before
 * _dispatch_time_slice
 */
unsigned int adreno_disp_preempt_fair_sched;

/* Number of commands that can be queued in a context before it sleeps */
static unsigned int _context_drawqueue_size = 50;

@@ -2180,12 +2165,6 @@ static int dispatcher_do_fault(struct adreno_device *adreno_dev)
				adreno_dev->cur_rb = hung_rb;
			}
		}
		if (ADRENO_DISPATCHER_RB_STARVE_TIMER_ELAPSED ==
			rb->starve_timer_state) {
			adreno_put_gpu_halt(adreno_dev);
			rb->starve_timer_state =
			ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT;
		}
	}

	if (dispatch_q && !adreno_drawqueue_is_empty(dispatch_q)) {
@@ -2762,12 +2741,6 @@ static DISPATCHER_UINT_ATTR(fault_throttle_time, 0644, 0,
	_fault_throttle_time);
static DISPATCHER_UINT_ATTR(fault_throttle_burst, 0644, 0,
	_fault_throttle_burst);
static DISPATCHER_UINT_ATTR(disp_preempt_fair_sched, 0644, 0,
	adreno_disp_preempt_fair_sched);
static DISPATCHER_UINT_ATTR(dispatch_time_slice, 0644, 0,
	adreno_dispatch_time_slice);
static DISPATCHER_UINT_ATTR(dispatch_starvation_time, 0644, 0,
	adreno_dispatch_starvation_time);

static struct attribute *dispatcher_attrs[] = {
	&dispatcher_attr_inflight.attr,
@@ -2779,9 +2752,6 @@ static struct attribute *dispatcher_attrs[] = {
	&dispatcher_attr_fault_detect_interval.attr,
	&dispatcher_attr_fault_throttle_time.attr,
	&dispatcher_attr_fault_throttle_burst.attr,
	&dispatcher_attr_disp_preempt_fair_sched.attr,
	&dispatcher_attr_dispatch_time_slice.attr,
	&dispatcher_attr_dispatch_starvation_time.attr,
	NULL,
};

+0 −26
Original line number Diff line number Diff line
@@ -14,29 +14,7 @@
#ifndef ____ADRENO_DISPATCHER_H
#define ____ADRENO_DISPATCHER_H

extern unsigned int adreno_disp_preempt_fair_sched;
extern unsigned int adreno_drawobj_timeout;
extern unsigned int adreno_dispatch_starvation_time;
extern unsigned int adreno_dispatch_time_slice;

/**
 * enum adreno_dispatcher_starve_timer_states - Starvation control states of
 * a RB
 * @ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT: Uninitialized, starvation control
 * is not operating
 * @ADRENO_DISPATCHER_RB_STARVE_TIMER_INIT: Starvation timer is initialized
 * and counting
 * @ADRENO_DISPATCHER_RB_STARVE_TIMER_ELAPSED: The starvation timer has elapsed
 * this state indicates that the RB is starved
 * @ADRENO_DISPATCHER_RB_STARVE_TIMER_SCHEDULED: RB is scheduled on the device
 * and will remain scheduled for a minimum time slice when in this state.
 */
enum adreno_dispatcher_starve_timer_states {
	ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT = 0,
	ADRENO_DISPATCHER_RB_STARVE_TIMER_INIT = 1,
	ADRENO_DISPATCHER_RB_STARVE_TIMER_ELAPSED = 2,
	ADRENO_DISPATCHER_RB_STARVE_TIMER_SCHEDULED = 3,
};

/*
 * Maximum size of the dispatcher ringbuffer - the actual inflight size will be
@@ -78,9 +56,6 @@ struct adreno_dispatcher_drawqueue {
 * @work: work_struct to put the dispatcher in a work queue
 * @kobj: kobject for the dispatcher directory in the device sysfs node
 * @idle_gate: Gate to wait on for dispatcher to idle
 * @disp_preempt_fair_sched: If set then dispatcher will try to be fair to
 * starving RB's by scheduling them in and enforcing a minimum time slice
 * for every RB that is scheduled to run on the device
 */
struct adreno_dispatcher {
	struct mutex mutex;
@@ -94,7 +69,6 @@ struct adreno_dispatcher {
	struct kthread_work work;
	struct kobject kobj;
	struct completion idle_gate;
	unsigned int disp_preempt_fair_sched;
};

enum adreno_dispatcher_flags {
+0 −2
Original line number Diff line number Diff line
@@ -250,8 +250,6 @@ int adreno_ringbuffer_start(struct adreno_device *adreno_dev,
		rb->wptr = 0;
		rb->_wptr = 0;
		rb->wptr_preempt_end = 0xFFFFFFFF;
		rb->starve_timer_state =
			ADRENO_DISPATCHER_RB_STARVE_TIMER_UNINIT;
	}

	/* start is specific GPU rb */
+0 −5
Original line number Diff line number Diff line
@@ -107,9 +107,6 @@ struct adreno_ringbuffer_pagetable_info {
 * at the right rptr
 * @gpr11: The gpr11 value of this RB
 * @preempted_midway: Indicates that the RB was preempted before rptr = wptr
 * @sched_timer: Timer that tracks how long RB has been waiting to be scheduled
 * or how long it has been scheduled for after preempting in
 * @starve_timer_state: Indicates the state of the wait.
 * @preempt_lock: Lock to protect the wptr pointer while it is being updated
 */
struct adreno_ringbuffer {
@@ -132,8 +129,6 @@ struct adreno_ringbuffer {
	unsigned int wptr_preempt_end;
	unsigned int gpr11;
	int preempted_midway;
	unsigned long sched_timer;
	enum adreno_dispatcher_starve_timer_states starve_timer_state;
	spinlock_t preempt_lock;
};