From: Jiyu Yang Date: Fri, 7 Aug 2015 03:18:43 +0000 (+0800) Subject: PD#108267 fixed timeout when antutu5.7 many times run X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=774dbea0619930df682b77d702f287450079f254;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git PD#108267 fixed timeout when antutu5.7 many times run this patch from these two patch Errata847169_Crashes_In_Application_Close.patch Errata850522_Mali450_Job_Scheduler_Stop_In_CornerCase.patch backtrace is below <6>[ 2131.508868] kworker/1:1 D ffffffc001085a00 0 1625 2 0x00000000 <6>[ 2131.515844] Workqueue: events delayed_fput <4>[ 2131.519892] Call trace: <4>[ 2131.522310] [] __switch_to+0x74/0x8c <4>[ 2131.527403] [] __schedule+0x2b8/0x744 <4>[ 2131.532572] [] schedule+0x2c/0x80 <4>[ 2131.537417] [] _mali_osk_wait_queue_wait_event+0x44/0x80 [mali] <4>[ 2131.544833] [] mali_timeline_system_abort+0xfc/0x120 [mali] <4>[ 2131.551902] [] _mali_ukk_close+0x58/0xb4 [mali] <4>[ 2131.557938] [] mali_release+0x3c/0xd4 [mali] <4>[ 2131.563708] [] __fput+0x90/0x20c <4>[ 2131.568452] [] delayed_fput+0x3c/0x54 <4>[ 2131.573629] [] process_one_work+0x140/0x430 <4>[ 2131.579320] [] worker_thread+0x140/0x3d4 <4>[ 2131.584754] [] kthread+0xd8/0xf0 Change-Id: I884b38478b09e3bdbf0d168abd589faccd3f1e23 Signed-off-by: Jiyu Yang --- diff --git a/mali/common/mali_executor.c b/mali/common/mali_executor.c index c6fc52b..28bbc1d 100755 --- a/mali/common/mali_executor.c +++ b/mali/common/mali_executor.c @@ -131,7 +131,6 @@ static void mali_executor_wq_schedule(void *arg); static void mali_executor_send_gp_oom_to_user(struct mali_gp_job *job); static void mali_executor_complete_group(struct mali_group *group, mali_bool success, - mali_bool release_jobs, struct mali_gp_job **gp_job_done, struct mali_pp_job **pp_job_done); static void mali_executor_change_state_pp_physical(struct mali_group *group, @@ -446,8 +445,7 @@ void mali_executor_zap_all_active(struct mali_session_data *session) if (MALI_FALSE == ret) { struct mali_gp_job *gp_job = NULL; - mali_executor_complete_group(gp_group, MALI_FALSE, - MALI_TRUE, &gp_job, NULL); + mali_executor_complete_group(gp_group, MALI_FALSE, &gp_job, NULL); MALI_DEBUG_ASSERT_POINTER(gp_job); @@ -461,8 +459,7 @@ void mali_executor_zap_all_active(struct mali_session_data *session) if (MALI_FALSE == ret) { struct mali_pp_job *pp_job = NULL; - mali_executor_complete_group(virtual_group, MALI_FALSE, - MALI_TRUE, NULL, &pp_job); + mali_executor_complete_group(virtual_group, MALI_FALSE, NULL, &pp_job); if (NULL != pp_job) { /* PP job completed, make sure it is freed */ @@ -480,8 +477,7 @@ void mali_executor_zap_all_active(struct mali_session_data *session) if (MALI_FALSE == ret) { struct mali_pp_job *pp_job = NULL; - mali_executor_complete_group(group, MALI_FALSE, - MALI_TRUE, NULL, &pp_job); + mali_executor_complete_group(group, MALI_FALSE, NULL, &pp_job); if (NULL != pp_job) { /* PP job completed, free it */ @@ -619,8 +615,7 @@ _mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group, success = (int_result != MALI_INTERRUPT_RESULT_ERROR) ? MALI_TRUE : MALI_FALSE; - mali_executor_complete_group(group, success, - MALI_TRUE, &job, NULL); + mali_executor_complete_group(group, success, &job, NULL); mali_executor_unlock(); @@ -720,8 +715,7 @@ _mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group, success = (int_result == MALI_INTERRUPT_RESULT_SUCCESS) ? MALI_TRUE : MALI_FALSE; - mali_executor_complete_group(group, success, - MALI_TRUE, NULL, &job); + mali_executor_complete_group(group, success, NULL, &job); mali_executor_unlock(); @@ -805,8 +799,7 @@ _mali_osk_errcode_t mali_executor_interrupt_mmu(struct mali_group *group, mali_mmu_get_rawstat(group->mmu), status)); #endif - mali_executor_complete_group(group, MALI_FALSE, - MALI_TRUE, &gp_job, &pp_job); + mali_executor_complete_group(group, MALI_FALSE, &gp_job, &pp_job); mali_executor_unlock(); @@ -982,8 +975,7 @@ void mali_executor_abort_session(struct mali_session_data *session) if (EXEC_STATE_WORKING == gp_group_state) { struct mali_gp_job *gp_job = NULL; - mali_executor_complete_group(gp_group, MALI_FALSE, - MALI_TRUE, &gp_job, NULL); + mali_executor_complete_group(gp_group, MALI_FALSE, &gp_job, NULL); MALI_DEBUG_ASSERT_POINTER(gp_job); @@ -1001,8 +993,7 @@ void mali_executor_abort_session(struct mali_session_data *session) && mali_group_get_session(virtual_group) == session) { struct mali_pp_job *pp_job = NULL; - mali_executor_complete_group(virtual_group, MALI_FALSE, - MALI_FALSE, NULL, &pp_job); + mali_executor_complete_group(virtual_group, MALI_FALSE, NULL, &pp_job); if (NULL != pp_job) { /* PP job completed, make sure it is freed */ @@ -1017,8 +1008,7 @@ void mali_executor_abort_session(struct mali_session_data *session) if (mali_group_get_session(group) == session) { struct mali_pp_job *pp_job = NULL; - mali_executor_complete_group(group, MALI_FALSE, - MALI_FALSE, NULL, &pp_job); + mali_executor_complete_group(group, MALI_FALSE, NULL, &pp_job); if (NULL != pp_job) { /* PP job completed, make sure it is freed */ @@ -1327,8 +1317,7 @@ _mali_osk_errcode_t _mali_ukk_gp_suspend_response(_mali_uk_gp_suspend_response_s /* Correct job is still running */ struct mali_gp_job *job_done = NULL; - mali_executor_complete_group(gp_group, MALI_FALSE, - MALI_TRUE, &job_done, NULL); + mali_executor_complete_group(gp_group, MALI_FALSE, &job_done, NULL); /* The same job should have completed */ MALI_DEBUG_ASSERT(job_done == job); @@ -1464,8 +1453,8 @@ static mali_bool mali_executor_virtual_group_is_usable(void) { #if defined(CONFIG_MALI450) MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD(); - return (EXEC_STATE_INACTIVE == virtual_group_state || - EXEC_STATE_IDLE == virtual_group_state) ? + return ((EXEC_STATE_INACTIVE == virtual_group_state || + EXEC_STATE_IDLE == virtual_group_state)&&(virtual_group->state != MALI_GROUP_STATE_ACTIVATION_PENDING)) ? MALI_TRUE : MALI_FALSE; #else return MALI_FALSE; @@ -1817,8 +1806,7 @@ static void mali_executor_send_gp_oom_to_user(struct mali_gp_job *job) notification); } static struct mali_gp_job *mali_executor_complete_gp(struct mali_group *group, - mali_bool success, - mali_bool release_jobs) + mali_bool success) { struct mali_gp_job *job; @@ -1832,20 +1820,17 @@ static struct mali_gp_job *mali_executor_complete_gp(struct mali_group *group, /* Core is now ready to go into idle list */ gp_group_state = EXEC_STATE_IDLE; - if (release_jobs) { - /* This will potentially queue more GP and PP jobs */ - mali_timeline_tracker_release(&job->tracker); + /* This will potentially queue more GP and PP jobs */ + mali_timeline_tracker_release(&job->tracker); - /* Signal PP job */ - mali_gp_job_signal_pp_tracker(job, success); - } + /* Signal PP job */ + mali_gp_job_signal_pp_tracker(job, success); return job; } static struct mali_pp_job *mali_executor_complete_pp(struct mali_group *group, - mali_bool success, - mali_bool release_jobs) + mali_bool success) { struct mali_pp_job *job; u32 sub_job; @@ -1874,7 +1859,7 @@ static struct mali_pp_job *mali_executor_complete_pp(struct mali_group *group, mali_pp_job_mark_sub_job_completed(job, success); job_is_done = mali_pp_job_is_complete(job); - if (job_is_done && release_jobs) { + if (job_is_done) { /* This will potentially queue more GP and PP jobs */ mali_timeline_tracker_release(&job->tracker); } @@ -1884,7 +1869,6 @@ static struct mali_pp_job *mali_executor_complete_pp(struct mali_group *group, static void mali_executor_complete_group(struct mali_group *group, mali_bool success, - mali_bool release_jobs, struct mali_gp_job **gp_job_done, struct mali_pp_job **pp_job_done) { @@ -1895,13 +1879,11 @@ static void mali_executor_complete_group(struct mali_group *group, mali_bool pp_job_is_done = MALI_TRUE; if (NULL != gp_core) { - gp_job = mali_executor_complete_gp(group, - success, release_jobs); + gp_job = mali_executor_complete_gp(group, success); } else { MALI_DEBUG_ASSERT_POINTER(pp_core); MALI_IGNORE(pp_core); - pp_job = mali_executor_complete_pp(group, - success, release_jobs); + pp_job = mali_executor_complete_pp(group, success); pp_job_is_done = mali_pp_job_is_complete(pp_job); } diff --git a/mali/common/mali_scheduler.c b/mali/common/mali_scheduler.c index e799825..b07f78a 100755 --- a/mali/common/mali_scheduler.c +++ b/mali/common/mali_scheduler.c @@ -621,9 +621,13 @@ void mali_scheduler_abort_session(struct mali_session_data *session) pp_job); mali_pp_job_mark_unstarted_failed(pp_job); - if (mali_pp_job_is_complete(pp_job)) { - mali_pp_job_list_move(pp_job, - &removed_jobs_pp); + if (MALI_FALSE == mali_pp_job_has_unstarted_sub_jobs(pp_job)) { + if (mali_pp_job_is_complete(pp_job)) { + mali_pp_job_list_move(pp_job, + &removed_jobs_pp); + } else { + mali_pp_job_list_remove(pp_job); + } } } } @@ -640,9 +644,13 @@ void mali_scheduler_abort_session(struct mali_session_data *session) pp_job); mali_pp_job_mark_unstarted_failed(pp_job); - if (mali_pp_job_is_complete(pp_job)) { - mali_pp_job_list_move(pp_job, - &removed_jobs_pp); + if (MALI_FALSE == mali_pp_job_has_unstarted_sub_jobs(pp_job)) { + if (mali_pp_job_is_complete(pp_job)) { + mali_pp_job_list_move(pp_job, + &removed_jobs_pp); + } else { + mali_pp_job_list_remove(pp_job); + } } } } diff --git a/mali/common/mali_timeline.c b/mali/common/mali_timeline.c index b369f14..47f0138 100755 --- a/mali/common/mali_timeline.c +++ b/mali/common/mali_timeline.c @@ -647,13 +647,12 @@ static mali_scheduler_mask mali_timeline_tracker_activate(struct mali_timeline_t _mali_osk_atomic_dec(&gp_tracker_count); break; case MALI_TIMELINE_TRACKER_PP: - schedule_mask = mali_scheduler_activate_pp_job((struct mali_pp_job *) tracker->job); - if (mali_pp_job_is_virtual((struct mali_pp_job *)tracker->job)) { _mali_osk_atomic_dec(&virt_pp_tracker_count); } else { _mali_osk_atomic_dec(&phy_pp_tracker_count); } + schedule_mask = mali_scheduler_activate_pp_job((struct mali_pp_job *) tracker->job); break; case MALI_TIMELINE_TRACKER_SOFT: timeline = tracker->timeline;