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 <neeraju@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
This commit is contained in:
Neeraj Upadhyay 2020-12-03 11:25:12 +05:30 • committed by Murali Nalajala
commit 2a853017d0

View file

@ -15,6 +15,7 @@
#include <linux/sched.h>
#include <linux/workqueue.h>
#include <linux/haven/hh_rm_drv.h>
#include <linux/cpu.h>
#include <soc/qcom/subsystem_notif.h>
#include <soc/qcom/subsystem_restart.h>
@ -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);
}