Home Home > GIT Browse > SLE12-SP5-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2019-08-21 21:12:54 +0200
committerMichal Suchanek <msuchanek@suse.de>2019-08-21 21:13:06 +0200
commit9cbdd0c19b0296e7edd468b490d0dec90bfe1486 (patch)
tree460f84e9710403fee6f74ddc02db23408fc78166
parent9d5b64b68370d035e6c7b902a6dbb9df9b759b4a (diff)
powerpc/rtas: use device model APIs and serialization during
LPM (bsc#1144123 ltc#178840).
-rw-r--r--patches.arch/powerpc-rtas-use-device-model-APIs-and-serialization.patch98
-rw-r--r--series.conf3
2 files changed, 101 insertions, 0 deletions
diff --git a/patches.arch/powerpc-rtas-use-device-model-APIs-and-serialization.patch b/patches.arch/powerpc-rtas-use-device-model-APIs-and-serialization.patch
new file mode 100644
index 0000000000..8e5507ca13
--- /dev/null
+++ b/patches.arch/powerpc-rtas-use-device-model-APIs-and-serialization.patch
@@ -0,0 +1,98 @@
+From a6717c01ddc259f6f73364779df058e2c67309f8 Mon Sep 17 00:00:00 2001
+From: Nathan Lynch <nathanl@linux.ibm.com>
+Date: Fri, 2 Aug 2019 14:29:24 -0500
+Subject: [PATCH] powerpc/rtas: use device model APIs and serialization during
+ LPM
+
+References: bsc#1144123 ltc#178840
+Patch-mainline: queued
+Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
+Git-commit: a6717c01ddc259f6f73364779df058e2c67309f8
+
+The LPAR migration implementation and userspace-initiated cpu hotplug
+can interleave their executions like so:
+
+1. Set cpu 7 offline via sysfs.
+
+2. Begin a partition migration, whose implementation requires the OS
+ to ensure all present cpus are online; cpu 7 is onlined:
+
+ rtas_ibm_suspend_me -> rtas_online_cpus_mask -> cpu_up
+
+ This sets cpu 7 online in all respects except for the cpu's
+ corresponding struct device; dev->offline remains true.
+
+3. Set cpu 7 online via sysfs. _cpu_up() determines that cpu 7 is
+ already online and returns success. The driver core (device_online)
+ sets dev->offline = false.
+
+4. The migration completes and restores cpu 7 to offline state:
+
+ rtas_ibm_suspend_me -> rtas_offline_cpus_mask -> cpu_down
+
+This leaves cpu7 in a state where the driver core considers the cpu
+device online, but in all other respects it is offline and
+unused. Attempts to online the cpu via sysfs appear to succeed but the
+driver core actually does not pass the request to the lower-level
+cpuhp support code. This makes the cpu unusable until the cpu device
+is manually set offline and then online again via sysfs.
+
+Instead of directly calling cpu_up/cpu_down, the migration code should
+use the higher-level device core APIs to maintain consistent state and
+serialize operations.
+
+Fixes: 120496ac2d2d ("powerpc: Bring all threads online prior to migration/hibernation")
+Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20190802192926.19277-2-nathanl@linux.ibm.com
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kernel/rtas.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
+index 49159bb38949..ef290d4036ba 100644
+--- a/arch/powerpc/kernel/rtas.c
++++ b/arch/powerpc/kernel/rtas.c
+@@ -871,15 +871,17 @@ static int rtas_cpu_state_change_mask(enum rtas_cpu_state state,
+ return 0;
+
+ for_each_cpu(cpu, cpus) {
++ struct device *dev = get_cpu_device(cpu);
++
+ switch (state) {
+ case DOWN:
+- cpuret = cpu_down(cpu);
++ cpuret = device_offline(dev);
+ break;
+ case UP:
+- cpuret = cpu_up(cpu);
++ cpuret = device_online(dev);
+ break;
+ }
+- if (cpuret) {
++ if (cpuret < 0) {
+ pr_debug("%s: cpu_%s for cpu#%d returned %d.\n",
+ __func__,
+ ((state == UP) ? "up" : "down"),
+@@ -966,6 +968,8 @@ int rtas_ibm_suspend_me(u64 handle)
+ data.token = rtas_token("ibm,suspend-me");
+ data.complete = &done;
+
++ lock_device_hotplug();
++
+ /* All present CPUs must be online */
+ cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask);
+ cpuret = rtas_online_cpus_mask(offline_mask);
+@@ -1004,6 +1008,7 @@ int rtas_ibm_suspend_me(u64 handle)
+ __func__);
+
+ out:
++ unlock_device_hotplug();
+ free_cpumask_var(offline_mask);
+ return atomic_read(&data.error);
+ }
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 28bf1049c9..d70aa48a80 100644
--- a/series.conf
+++ b/series.conf
@@ -23419,6 +23419,9 @@
patches.fixes/0001-HID-wacom-Correct-distance-scale-for-2nd-gen-Intuos-.patch
patches.fixes/0001-HID-wacom-correct-misreported-EKR-ring-values.patch
+ # powerpc/linux next
+ patches.arch/powerpc-rtas-use-device-model-APIs-and-serialization.patch
+
# dhowells/linux-fs keys-uefi
patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch
patches.suse/0002-efi-Add-EFI-signature-data-types.patch