msm: kgsl: Allow the wait_timeout to be disabled

With the improved hang detection we don't technically need a upper
timeout bound for a process to wait in waitfortimestamp().  Allow
for a idle_timestamp of '0' to allow the loop to wait for ever.
The infrastructure for changing the idle_timeout still exists
so it can be changed to whatever value is appropriate for debugging
or testing.

CRs-fixed: 382366
CRs-fixed: 383999
Change-Id: Ic0dedbadf2c100eb56ed2338914575061776e725
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
Jordan Crouse 2012-08-09 15:08:59 -06:00 committed by Stephen Boyd
parent 0303adb2b1
commit 1c152d4571
2 changed files with 22 additions and 17 deletions

View file

@ -111,7 +111,7 @@ static struct adreno_device device_3d0 = {
.gmem_size = SZ_256K,
.pfp_fw = NULL,
.pm4_fw = NULL,
.wait_timeout = 10000, /* in milliseconds */
.wait_timeout = 0, /* in milliseconds, 0 means disabled */
.ib_check_level = 0,
};
@ -2197,12 +2197,11 @@ static int adreno_waittimestamp(struct kgsl_device *device,
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
struct kgsl_pwrctrl *pwr = &device->pwrctrl;
int retries = 0;
unsigned int msecs_first;
unsigned int msecs_part = KGSL_TIMEOUT_PART;
unsigned int ts_issued;
unsigned int context_id = _get_context_id(context);
unsigned int time_elapsed = 0;
unsigned int prev_reg_val[hang_detect_regs_count];
unsigned int wait;
memset(prev_reg_val, 0, sizeof(prev_reg_val));
@ -2220,11 +2219,18 @@ static int adreno_waittimestamp(struct kgsl_device *device,
goto done;
}
/* Keep the first timeout as 100msecs before rewriting
* the WPTR. Less visible impact if the WPTR has not
* been updated properly.
/*
* Make the first timeout interval 100 msecs and then try to kick the
* wptr again. This helps to ensure the wptr is updated properly. If
* the requested timeout is less than 100 msecs, then wait 20msecs which
* is the minimum amount of time we can safely wait at 100HZ
*/
msecs_first = (msecs <= 100) ? ((msecs + 4) / 5) : 100;
if (msecs == 0 || msecs >= 100)
wait = 100;
else
wait = 20;
do {
/*
* If the context ID is invalid, we are in a race with
@ -2263,8 +2269,8 @@ static int adreno_waittimestamp(struct kgsl_device *device,
device->wait_queue,
kgsl_check_interrupt_timestamp(device,
context, timestamp),
msecs_to_jiffies(retries ?
msecs_part : msecs_first), io);
msecs_to_jiffies(wait), io);
mutex_lock(&device->mutex);
if (status > 0) {
@ -2277,11 +2283,12 @@ static int adreno_waittimestamp(struct kgsl_device *device,
}
/*this wait timed out*/
time_elapsed = time_elapsed +
(retries ? msecs_part : msecs_first);
time_elapsed += wait;
wait = KGSL_TIMEOUT_PART;
retries++;
} while (time_elapsed < msecs);
} while (!msecs || time_elapsed < msecs);
hang_dump:
/*

View file

@ -52,11 +52,9 @@ adreno_ringbuffer_waitspace(struct adreno_ringbuffer *rb, unsigned int numcmds,
unsigned int freecmds;
unsigned int *cmds;
uint cmds_gpu;
struct adreno_device *adreno_dev = ADRENO_DEVICE(rb->device);
unsigned long wait_timeout = msecs_to_jiffies(adreno_dev->wait_timeout);
unsigned long wait_time;
unsigned long wait_timeout = msecs_to_jiffies(ADRENO_IDLE_TIMEOUT);
unsigned long wait_time_part;
unsigned int msecs_part = KGSL_TIMEOUT_PART;
unsigned int prev_reg_val[hang_detect_regs_count];
memset(prev_reg_val, 0, sizeof(prev_reg_val));
@ -87,7 +85,7 @@ adreno_ringbuffer_waitspace(struct adreno_ringbuffer *rb, unsigned int numcmds,
}
wait_time = jiffies + wait_timeout;
wait_time_part = jiffies + msecs_to_jiffies(msecs_part);
wait_time_part = jiffies + msecs_to_jiffies(KGSL_TIMEOUT_PART);
/* wait for space in ringbuffer */
while (1) {
GSL_RB_GET_READPTR(rb, &rb->rptr);
@ -101,7 +99,7 @@ adreno_ringbuffer_waitspace(struct adreno_ringbuffer *rb, unsigned int numcmds,
*/
if (time_after(jiffies, wait_time_part)) {
wait_time_part = jiffies +
msecs_to_jiffies(msecs_part);
msecs_to_jiffies(KGSL_TIMEOUT_PART);
if ((adreno_hang_detect(rb->device,
prev_reg_val))){
KGSL_DRV_ERR(rb->device,