From 6ce0e26b0e9ab2f4afdac7f43bf79af2949eae3e Mon Sep 17 00:00:00 2001 From: Tao Zeng Date: Fri, 28 Jun 2019 15:16:58 +0800 Subject: [PATCH] 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 --- kernel/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index 350ebd819391..dd07bf38bfc3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -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;