From 2a853017d0c6513b872463b3aadc33024cfd83ea Mon Sep 17 00:00:00 2001 From: Neeraj Upadhyay Date: Thu, 3 Dec 2020 11:25:12 +0530 Subject: [PATCH] soc: qcom: guestvm_loader: do cpu offline instead of isolate CPU isolation while loading SVM still causing issue of locking when multiple TZ calls goto TZ from both PVM and SVM. This is because isolated CPUs can still handle IPIs and some tasks are expected to run work on isolated CPUs and issue an IPI. At the same instance if hypervisor schedule a SVM on same pCPU and SVM do a TZ call then IPI can't be handled because SVM TZ call is spinning in TZ for a lock to grab which is already grabbed by PVM from a different CPU and that task is scheduled out. Hence IPI would ever served by CPU and lead to watchdog. To avoid this situation do cpu hotplug rather isolate. Change-Id: I40cc06fcd11fd90583e334b044feec6dc95fff68 Signed-off-by: Neeraj Upadhyay Signed-off-by: Murali Nalajala --- drivers/soc/qcom/guestvm_loader.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/soc/qcom/guestvm_loader.c b/drivers/soc/qcom/guestvm_loader.c index 91e8060256b9..e0205e34c2f2 100644 --- a/drivers/soc/qcom/guestvm_loader.c +++ b/drivers/soc/qcom/guestvm_loader.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -58,11 +59,12 @@ static void guestvm_isolate_cpu(void) int cpu, ret; for_each_cpu_and(cpu, &guestvm_reserve_cpus, cpu_online_mask) { - ret = sched_isolate_cpu(cpu); + ret = cpu_down(cpu); if (ret < 0) { - pr_err("fail to isolate CPU%d. ret=%d\n", cpu, ret); + pr_err("fail to offline CPU%d. ret=%d\n", cpu, ret); continue; } + pr_info("%s: offlined cpu : %d\n", __func__, cpu); cpumask_set_cpu(cpu, &guestvm_isolated_cpus); } @@ -76,11 +78,12 @@ static void guestvm_unisolate_cpu(void) int i, ret; for_each_cpu(i, &guestvm_isolated_cpus) { - ret = sched_unisolate_cpu(i); + ret = cpu_up(i); if (ret < 0) { - pr_err("fail to un-isolate CPU%d. ret=%d\n", i, ret); + pr_err("fail to online CPU%d. ret=%d\n", i, ret); continue; } + pr_info("%s: onlined cpu : %d\n", __func__, i); cpumask_clear_cpu(i, &guestvm_isolated_cpus); }