MALI: utgard: rockchip: avoid crash when CONFIG_GPU_TRACEPOINTS enabled
authorchenzhen <chenzhen@rock-chips.com>
Wed, 27 Jul 2016 03:22:30 +0000 (11:22 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 27 Jul 2016 11:59:32 +0000 (19:59 +0800)
Change-Id: Icbb4f9e1b56a9a23cd7041c589e9814743fe562b
Signed-off-by: chenzhen <chenzhen@rock-chips.com>
drivers/gpu/arm/mali400/mali/common/mali_gp_scheduler.c
drivers/gpu/arm/mali400/mali/common/mali_group.c
drivers/gpu/arm/mali400/mali/common/mali_pp_scheduler.c

index 49fea1055ee4971291fd0180d3b77896304cb2fe..2e0699ae43acf1eba613c74109c7709b2edc2555 100755 (executable)
@@ -182,7 +182,8 @@ static void mali_gp_scheduler_schedule_internal_and_unlock(void)
                MALI_DEBUG_PRINT(4, ("Mali GP scheduler: Nothing to schedule (paused=%u, idle slots=%u)\n",
                                     pause_count, MALI_GP_SLOT_STATE_IDLE == slot.state ? 1 : 0));
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-               trace_gpu_sched_switch(mali_gp_get_hw_core_desc(group->gp_core), sched_clock(), 0, 0, 0);
+               if (group->gp_core)
+                       trace_gpu_sched_switch(mali_gp_get_hw_core_desc(group->gp_core), sched_clock(), 0, 0, 0);
 #endif
                return; /* Nothing to do, so early out */
        }
index 1b5942a5245bbca9ab66202c18786b1b7ec56a8e..aface075724679a3197e80a2e1aacbfc65eedff5 100755 (executable)
@@ -696,10 +696,12 @@ void mali_group_add_group(struct mali_group *parent, struct mali_group *child)
                                              MALI_PROFILING_EVENT_REASON_START_STOP_HW_VIRTUAL,
                                              mali_pp_job_get_pid(job), mali_pp_job_get_tid(job), 0, 0, 0);
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-               trace_gpu_sched_switch(
-                       mali_pp_core_description(child->pp_core),
-                       sched_clock(), mali_pp_job_get_tid(job),
-                       0, mali_pp_job_get_id(job));
+               if (child->pp_core) {
+                       trace_gpu_sched_switch(
+                               mali_pp_core_description(child->pp_core),
+                               sched_clock(), mali_pp_job_get_tid(job),
+                               0, mali_pp_job_get_id(job));
+               }
 #endif
 
 #if defined(CONFIG_MALI400_PROFILING)
@@ -849,9 +851,11 @@ void mali_group_start_gp_job(struct mali_group *group, struct mali_gp_job *job)
 #endif /* #if defined(CONFIG_MALI400_PROFILING) */
 
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-       trace_gpu_sched_switch(mali_gp_core_description(group->gp_core),
-                              sched_clock(), mali_gp_job_get_tid(job),
-                              0, mali_gp_job_get_id(job));
+       if (group->gp_core) {
+               trace_gpu_sched_switch(mali_gp_core_description(group->gp_core),
+                                      sched_clock(), mali_gp_job_get_tid(job),
+                                      0, mali_gp_job_get_id(job));
+       }
 #endif
 
        group->gp_running_job = job;
@@ -977,9 +981,11 @@ void mali_group_start_pp_job(struct mali_group *group, struct mali_pp_job *job,
        }
 
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-       trace_gpu_sched_switch(mali_pp_core_description(group->pp_core),
-                              sched_clock(), mali_pp_job_get_tid(job),
-                              0, mali_pp_job_get_id(job));
+       if (group->pp_core) {
+               trace_gpu_sched_switch(mali_pp_core_description(group->pp_core),
+                                      sched_clock(), mali_pp_job_get_tid(job),
+                                      0, mali_pp_job_get_id(job));
+       }
 #endif
 
        group->pp_running_job = job;
@@ -1149,9 +1155,11 @@ struct mali_pp_job *mali_group_complete_pp(struct mali_group *group, mali_bool s
                }
 
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-               trace_gpu_sched_switch(
-                       mali_gp_core_description(group->gp_core),
-                       sched_clock(), 0, 0, 0);
+               if (group->gp_core) {
+                       trace_gpu_sched_switch(
+                               mali_gp_core_description(group->gp_core),
+                               sched_clock(), 0, 0, 0);
+               }
 #endif
 
        }
@@ -1207,9 +1215,11 @@ struct mali_gp_job *mali_group_complete_gp(struct mali_group *group, mali_bool s
 #endif
 
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-               trace_gpu_sched_switch(
-                       mali_pp_core_description(group->pp_core),
-                       sched_clock(), 0, 0, 0);
+               if (group->pp_core) {
+                       trace_gpu_sched_switch(
+                               mali_pp_core_description(group->pp_core),
+                               sched_clock(), 0, 0, 0);
+               }
 #endif
 
 #if defined(CONFIG_MALI400_PROFILING)
index 0d5e4a63838af00ab8ea9d2240c208c22fc68a69..976cb4d49d543af62ad75e451d06d719ebbdb09e 100755 (executable)
@@ -867,7 +867,8 @@ static void mali_pp_scheduler_set_group_idle_and_unlock(struct mali_group *group
                        _mali_osk_list_move(&(group->pp_scheduler_list), &group_list_idle);
 
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-                       trace_gpu_sched_switch(mali_pp_get_hw_core_desc(group->pp_core), sched_clock(), 0, 0, 0);
+                       if (group->pp_core)
+                               trace_gpu_sched_switch(mali_pp_get_hw_core_desc(group->pp_core), sched_clock(), 0, 0, 0);
 #endif
 
                        mali_pp_scheduler_unlock();
@@ -1087,7 +1088,8 @@ void mali_pp_scheduler_job_done(struct mali_group *group, struct mali_pp_job *jo
                }
 
 #if defined(CONFIG_GPU_TRACEPOINTS) && defined(CONFIG_TRACEPOINTS)
-               trace_gpu_sched_switch(mali_pp_get_hw_core_desc(group->pp_core), sched_clock(), 0, 0, 0);
+               if (group->pp_core)
+                       trace_gpu_sched_switch(mali_pp_get_hw_core_desc(group->pp_core), sched_clock(), 0, 0, 0);
 #endif
 
                _mali_osk_wait_queue_wake_up(pp_scheduler_working_wait_queue);