From: Brian King <brking@linux.vnet.ibm.com>
Subject: fix hang during live partition migration
Git-commit: 444080d13d05dc38d07dd3bf751d38bce7ab7c72
Patch-mainline: 3.3-rc4
References: bnc#740866

This fixes a hang that was observed during live partition migration.
Since stop_topology_update must not be called from an interrupt
context, call it earlier in the migration process.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Acked-by: Torsten Duwe <duwe@suse.de>

---

 arch/powerpc/kernel/rtas.c               |    5 +++--
 arch/powerpc/platforms/pseries/suspend.c |    6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff -puN arch/powerpc/kernel/rtas.c~powerpc_migration_vphn_fix arch/powerpc/kernel/rtas.c
--- linux-3.0/arch/powerpc/kernel/rtas.c~powerpc_migration_vphn_fix	2012-01-11 11:16:18.000000000 -0600
+++ linux-3.0-bjking1/arch/powerpc/kernel/rtas.c	2012-01-11 11:16:18.000000000 -0600
@@ -715,7 +715,6 @@ static int __rtas_suspend_last_cpu(struc
 	int cpu;
 
 	slb_set_size(SLB_MIN_SIZE);
-	stop_topology_update();
 	printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n", smp_processor_id());
 
 	while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) &&
@@ -731,7 +730,6 @@ static int __rtas_suspend_last_cpu(struc
 		rc = atomic_read(&data->error);
 
 	atomic_set(&data->error, rc);
-	start_topology_update();
 	pSeries_coalesce_init();
 
 	if (wake_when_done) {
@@ -845,6 +843,7 @@ int rtas_ibm_suspend_me(struct rtas_args
 	atomic_set(&data.error, 0);
 	data.token = rtas_token("ibm,suspend-me");
 	data.complete = &done;
+	stop_topology_update();
 
 	/* Call function on all CPUs.  One of us will make the
 	 * rtas call
@@ -857,6 +856,8 @@ int rtas_ibm_suspend_me(struct rtas_args
 	if (atomic_read(&data.error) != 0)
 		printk(KERN_ERR "Error doing global join\n");
 
+	start_topology_update();
+
 	return atomic_read(&data.error);
 }
 #else /* CONFIG_PPC_PSERIES */
diff -puN arch/powerpc/platforms/pseries/suspend.c~powerpc_migration_vphn_fix arch/powerpc/platforms/pseries/suspend.c
--- linux-3.0/arch/powerpc/platforms/pseries/suspend.c~powerpc_migration_vphn_fix	2012-01-11 11:16:18.000000000 -0600
+++ linux-3.0-bjking1/arch/powerpc/platforms/pseries/suspend.c	2012-01-11 11:16:18.000000000 -0600
@@ -23,6 +23,7 @@
 #include <asm/machdep.h>
 #include <asm/mmu.h>
 #include <asm/rtas.h>
+#include <asm/topology.h>
 
 static u64 stream_id;
 static struct sys_device suspend_sysdev;
@@ -137,8 +138,11 @@ static ssize_t store_hibernate(struct sy
 			ssleep(1);
 	} while (rc == -EAGAIN);
 
-	if (!rc)
+	if (!rc) {
+		stop_topology_update();
 		rc = pm_suspend(PM_SUSPEND_MEM);
+		start_topology_update();
+	}
 
 	stream_id = 0;
 
_
