From: Jianxin Pan Date: Wed, 26 Jun 2019 09:08:49 +0000 (-0400) Subject: cpu_hotplug: fix dead lock between flush work and ipa [1/1] X-Git-Tag: hardkernel-4.9.236-104~1001 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce6d55237804849968125e199ce6672874819612;p=platform%2Fkernel%2Flinux-amlogic.git cpu_hotplug: fix dead lock between flush work and ipa [1/1] PD#TV-7161 Problem: dead lock between flush work and ipa Solution: fix dead lock between flush work and ipa Verify: TL1 Change-Id: I479869601c0816bbaeaa693a26bf606b6a168da0 Signed-off-by: Jianxin Pan --- diff --git a/drivers/amlogic/cpu_hotplug/cpu_hotplug.c b/drivers/amlogic/cpu_hotplug/cpu_hotplug.c index 8010e88..3df6617 100644 --- a/drivers/amlogic/cpu_hotplug/cpu_hotplug.c +++ b/drivers/amlogic/cpu_hotplug/cpu_hotplug.c @@ -33,6 +33,7 @@ #include #include #include "linux/amlogic/cpu_hotplug.h" +#include #define MAX_CLUSTRS 2 struct cpu_hotplug_s { @@ -102,7 +103,8 @@ void cpu_hotplug_set_max(unsigned int num, int clustr) return; } - mutex_lock(&hpg.mutex); + if (!mutex_trylock(&hpg.mutex)) + return; if (num > hpg.cpunum[clustr]) num = hpg.cpunum[clustr]; if (hpg.max_num[clustr] == num) { @@ -157,7 +159,10 @@ static int __ref cpu_hotplug_thread(void *data) while (1) { if (kthread_should_stop()) break; - mutex_lock(&hpg.mutex); + if (!mutex_trylock(&hpg.mutex)) { + usleep_range(1000, 2000); + continue; + } for (clustr = 0; clustr < hpg.clusters; clustr++) { if (!hpg.flgs[clustr]) continue;