From 85c2e5b901e2c9124362ca800bec7d9efc9904ba Mon Sep 17 00:00:00 2001 From: chenzhen Date: Wed, 27 Jul 2016 11:22:30 +0800 Subject: [PATCH] MALI: utgard: rockchip: avoid crash when CONFIG_GPU_TRACEPOINTS enabled Change-Id: Icbb4f9e1b56a9a23cd7041c589e9814743fe562b Signed-off-by: chenzhen --- .../mali400/mali/common/mali_gp_scheduler.c | 3 +- .../gpu/arm/mali400/mali/common/mali_group.c | 42 ++++++++++++------- .../mali400/mali/common/mali_pp_scheduler.c | 6 ++- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/arm/mali400/mali/common/mali_gp_scheduler.c b/drivers/gpu/arm/mali400/mali/common/mali_gp_scheduler.c index 49fea1055ee4..2e0699ae43ac 100755 --- a/drivers/gpu/arm/mali400/mali/common/mali_gp_scheduler.c +++ b/drivers/gpu/arm/mali400/mali/common/mali_gp_scheduler.c @@ -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 */ } diff --git a/drivers/gpu/arm/mali400/mali/common/mali_group.c b/drivers/gpu/arm/mali400/mali/common/mali_group.c index 1b5942a5245b..aface0757246 100755 --- a/drivers/gpu/arm/mali400/mali/common/mali_group.c +++ b/drivers/gpu/arm/mali400/mali/common/mali_group.c @@ -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) diff --git a/drivers/gpu/arm/mali400/mali/common/mali_pp_scheduler.c b/drivers/gpu/arm/mali400/mali/common/mali_pp_scheduler.c index 0d5e4a63838a..976cb4d49d54 100755 --- a/drivers/gpu/arm/mali400/mali/common/mali_pp_scheduler.c +++ b/drivers/gpu/arm/mali400/mali/common/mali_pp_scheduler.c @@ -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); -- 2.34.1