DORMANTno replies

[PATCH] hotplug/cpu: Extend start/stop cpumap lock scope

From: Michael Bringmann <hidden>
Date: 2018-10-13 22:06:56
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

The PPC mobility code may receive DLPAR CPU add/remove requests
to perform CPU changes at any time, including during LPAR migration
or RTAS requests or SMT changes.  When the operations are received
concurrently, there is an opportunity for DLPAR CPU remove requests
and other requests to overlap, and for one of the requests to be
interrupted after some shared state has been modified.  This patch
changes the duration for which cpu maps updates are suppressed
during DLPAR CPU operations made by 'drmgr' are suppressed to
reduce the period in which changes to shared state may occur.

Signed-off-by: Michael Bringmann <redacted>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 2f8e621..fce46c56 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -356,7 +356,6 @@ static int dlpar_online_cpu(struct device_node *dn)
 
 	nthreads = len / sizeof(u32);
 
-	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
 		thread = be32_to_cpu(intserv[i]);
 		for_each_present_cpu(cpu) {
@@ -378,7 +377,6 @@ static int dlpar_online_cpu(struct device_node *dn)
 			printk(KERN_WARNING "Could not find cpu to online "
 			       "with physical id 0x%x\n", thread);
 	}
-	cpu_maps_update_done();
 
 out:
 	return rc;
@@ -523,7 +521,6 @@ static int dlpar_offline_cpu(struct device_node *dn)
 
 	nthreads = len / sizeof(u32);
 
-	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
 		thread = be32_to_cpu(intserv[i]);
 		for_each_present_cpu(cpu) {
@@ -559,7 +556,6 @@ static int dlpar_offline_cpu(struct device_node *dn)
 		if (cpu == num_possible_cpus())
 			printk(KERN_WARNING "Could not find cpu to offline with physical id 0x%x\n", thread);
 	}
-	cpu_maps_update_done();
 
 out:
 	return rc;
@@ -811,6 +807,7 @@ int dlpar_cpu(struct pseries_hp_errorlog *hp_elog)
 	drc_index = hp_elog->_drc_u.drc_index;
 
 	lock_device_hotplug();
+	cpu_maps_update_begin();
 
 	switch (hp_elog->action) {
 	case PSERIES_HP_ELOG_ACTION_REMOVE:
@@ -835,6 +832,7 @@ int dlpar_cpu(struct pseries_hp_errorlog *hp_elog)
 		break;
 	}
 
+	cpu_maps_update_done();
 	unlock_device_hotplug();
 	return rc;
 }
@@ -850,7 +848,9 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
 	if (rc)
 		return -EINVAL;
 
+	cpu_maps_update_begin();
 	rc = dlpar_cpu_add(drc_index);
+	cpu_maps_update_done();
 
 	return rc ? rc : count;
 }
@@ -871,7 +871,9 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 		return -EINVAL;
 	}
 
+	cpu_maps_update_begin();
 	rc = dlpar_cpu_remove(dn, drc_index);
+	cpu_maps_update_done();
 	of_node_put(dn);
 
 	return rc ? rc : count;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help