Mali: midgard: add an error handling pass in kbase_mmu_interrupt()

For RK redmine Defect #168230.

Change-Id: I3cd6544dd23b833138e4cc700a8f2cdd627ff592
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
This commit is contained in:
Zhen Chen 2018-07-08 15:25:35 +08:00 committed by Tao Huang
parent 7dc1699c5d
commit 94f98e877c
4 changed files with 26 additions and 7 deletions

View File

@ -14,6 +14,8 @@
*/
/* #define ENABLE_DEBUG_LOG */
#include "../../platform/rk/custom_log.h"
#include <linux/bitops.h>
@ -164,6 +166,10 @@ void kbase_mmu_interrupt(struct kbase_device *kbdev, u32 irq_stat)
* the MMU is updated
*/
kctx = kbasep_js_runpool_lookup_ctx(kbdev, as_no);
if (!kctx) {
E("fail to lookup ctx, to break out.");
break;
}
/* find faulting address */

View File

@ -131,16 +131,21 @@ int kbase_ctx_sched_retain_ctx(struct kbase_context *kctx)
return kctx->as_nr;
}
void kbase_ctx_sched_retain_ctx_refcount(struct kbase_context *kctx)
int kbase_ctx_sched_retain_ctx_refcount(struct kbase_context *kctx)
{
struct kbase_device *const kbdev = kctx->kbdev;
lockdep_assert_held(&kbdev->hwaccess_lock);
WARN_ON(atomic_read(&kctx->refcount) == 0);
if (atomic_read(&kctx->refcount) == 0)
return -1;
WARN_ON(kctx->as_nr == KBASEP_AS_NR_INVALID);
WARN_ON(kbdev->as_to_kctx[kctx->as_nr] != kctx);
atomic_inc(&kctx->refcount);
return 0;
}
void kbase_ctx_sched_release_ctx(struct kbase_context *kctx)

View File

@ -87,8 +87,11 @@ int kbase_ctx_sched_retain_ctx(struct kbase_context *kctx);
* it doesn't get descheduled.
*
* The kbase_device::hwaccess_lock must be held whilst calling this function
* @return
* , 0;
* *kctx , -1.
*/
void kbase_ctx_sched_retain_ctx_refcount(struct kbase_context *kctx);
int kbase_ctx_sched_retain_ctx_refcount(struct kbase_context *kctx);
/* kbase_ctx_sched_release_ctx - Release a reference to the @ref kbase_context
*

View File

@ -13,9 +13,8 @@
*
*/
/* #define ENABLE_DEBUG_LOG */
#include "./platform/rk/custom_log.h"
/*
* Job Scheduler Implementation
@ -1245,6 +1244,7 @@ bool kbasep_js_runpool_retain_ctx(struct kbase_device *kbdev,
struct kbase_context *kbasep_js_runpool_lookup_ctx(struct kbase_device *kbdev,
int as_nr)
{
int ret = 0;
unsigned long flags;
struct kbasep_js_device_data *js_devdata;
struct kbase_context *found_kctx = NULL;
@ -1257,8 +1257,13 @@ struct kbase_context *kbasep_js_runpool_lookup_ctx(struct kbase_device *kbdev,
found_kctx = kbdev->as_to_kctx[as_nr];
if (found_kctx != NULL)
kbase_ctx_sched_retain_ctx_refcount(found_kctx);
if (found_kctx != NULL) {
ret = kbase_ctx_sched_retain_ctx_refcount(found_kctx);
if (ret != 0) {
E("fail to retain ctx_refcount, ret : %d.", ret);
found_kctx = NULL;
}
}
spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);