Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-10-15 18:55:45 +0200
committerMichal Suchanek <msuchanek@suse.de>2018-10-15 18:55:45 +0200
commit026dc742e0c70ee89a66d2d24253c5f93a3b6c84 (patch)
treeacc2e92ecfe6e4e099987564f6691161b51f4afa
parent954903e41d9eea51f3426ffc5cd471c418e625ed (diff)
powerpc/rtas: Fix a potential race between CPU-Offline &
Migration (bsc#1111870).
-rw-r--r--patches.arch/powerpc-rtas-Fix-a-potential-race-between-CPU-Offlin.patch74
-rw-r--r--series.conf1
2 files changed, 75 insertions, 0 deletions
diff --git a/patches.arch/powerpc-rtas-Fix-a-potential-race-between-CPU-Offlin.patch b/patches.arch/powerpc-rtas-Fix-a-potential-race-between-CPU-Offlin.patch
new file mode 100644
index 0000000000..4d98c5c893
--- /dev/null
+++ b/patches.arch/powerpc-rtas-Fix-a-potential-race-between-CPU-Offlin.patch
@@ -0,0 +1,74 @@
+From 5d9c89cd8db668fa7addd4723e0de006e8a191ee Mon Sep 17 00:00:00 2001
+From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
+Date: Mon, 1 Oct 2018 16:10:39 +0530
+Subject: [PATCH] powerpc/rtas: Fix a potential race between CPU-Offline &
+ Migration
+
+References: bsc#1111870
+Patch-mainline: queued
+Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
+Git-commit: dfd718a2ed1f678e66749ffe41bdeafedf3f4314
+
+Live Partition Migrations require all the present CPUs to execute the
+H_JOIN call, and hence rtas_ibm_suspend_me() onlines any offline CPUs
+before initiating the migration for this purpose.
+
+The commit 85a88cabad57
+("powerpc/pseries: Disable CPU hotplug across migrations")
+disables any CPU-hotplug operations once all the offline CPUs are
+brought online to prevent any further state change. Once the
+CPU-Hotplug operation is disabled, the code assumes that all the CPUs
+are online.
+
+However, there is a minor window in rtas_ibm_suspend_me() between
+onlining the offline CPUs and disabling CPU-Hotplug when a concurrent
+CPU-offline operations initiated by the userspace can succeed thereby
+nullifying the the aformentioned assumption. In this unlikely case
+these offlined CPUs will not call H_JOIN, resulting in a system hang.
+
+Fix this by verifying that all the present CPUs are actually online
+after CPU-Hotplug has been disabled, failing which we restore the
+state of the offline CPUs in rtas_ibm_suspend_me() and return an
+-EBUSY.
+
+Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
+Cc: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
+Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
+Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kernel/rtas.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
+index 7c605dc98624..5fe41f0f59fd 100644
+--- a/arch/powerpc/kernel/rtas.c
++++ b/arch/powerpc/kernel/rtas.c
+@@ -983,6 +983,14 @@ int rtas_ibm_suspend_me(u64 handle)
+ cpu_hotplug_disable();
+ stop_topology_update();
+
++ /* Check if we raced with a CPU-Offline Operation */
++ if (unlikely(!cpumask_equal(cpu_present_mask, cpu_online_mask))) {
++ pr_err("%s: Raced against a concurrent CPU-Offline\n",
++ __func__);
++ atomic_set(&data.error, -EBUSY);
++ goto out_hotplug_enable;
++ }
++
+ /* Call function on all CPUs. One of us will make the
+ * rtas call
+ */
+@@ -994,6 +1002,7 @@ int rtas_ibm_suspend_me(u64 handle)
+ if (atomic_read(&data.error) != 0)
+ printk(KERN_ERR "Error doing global join\n");
+
++out_hotplug_enable:
+ start_topology_update();
+ cpu_hotplug_enable();
+
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index f2af62f962..c799a72232 100644
--- a/series.conf
+++ b/series.conf
@@ -17932,6 +17932,7 @@
patches.arch/powerpc-pseries-Remove-unneeded-uses-of-dlpar-work-q.patch
patches.arch/powerpc-pseries-Disable-CPU-hotplug-across-migration.patch
patches.arch/powerpc-fadump-re-register-firmware-assisted-dump-if.patch
+ patches.arch/powerpc-rtas-Fix-a-potential-race-between-CPU-Offlin.patch
# dhowells/linux-fs keys-uefi
patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch