cpuhotplug: offline workqueue before close cpu [1/1]

PD#TV-7079

Problem:
Deadlock happened when burning cpu at high temperature.
 1486                        1916
schedule                    schedule
schedule_preempt_disabled   schedule_timeout
__mutex_lock_slowpath       wait_for_common
mutex_lock                  wait_for_completion

cpu_hotplug_set_max --wait hpg.mutex

                            cpuhp_kick_ap_work   --wait flush work
cpufreq_set_max_cpu_num     _cpu_down            --hold hpg.mutex
cpucore_set_cur_state       do_cpu_down
thermal_cdev_update         cpu_down
power_actor_set_power       cpu_subsys_offline
power_allocator_throttle    device_offline
handle_thermal_trip         cpu_hotplug_thread
thermal_zone_device_update  kthread
thermal_zone_device_check   ret_from_fork
process_one_work
worker_thread    --It's a work
kthread
ret_from_fork

Solution:
Close work queue before hold lock

Verify:
T972

Change-Id: I557281a1674bd67472b0655e4f1ba409ffead42f
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
This commit is contained in:
Tao Zeng
2019-06-28 15:16:58 +08:00
committed by Luke Go
parent 58104a8866
commit 6ce0e26b0e

View File

@@ -910,6 +910,10 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
if (!cpu_present(cpu))
return -EINVAL;
#ifdef CONFIG_AMLOGIC_MODIFY
/* avoid dead lock */
workqueue_offline_cpu(cpu);
#endif
cpu_hotplug_begin();
cpuhp_tasks_frozen = tasks_frozen;