[PATCH] ppc64 cpu hotplug

jschopp at austin.ibm.com jschopp at austin.ibm.com
Wed Mar 24 11:41:21 EST 2004


I found a couple bugs that affect cpu DLPAR/hotplug on ppc64.  The first
bug I have never actually produced but am pretty sure this is the correct
fix.  The second bug only affects certain hardware that I do not have
access to test this patch on.

So two untested bugfixes are below.  Thought I'd share them anyway since
somebody with hardware different than mine will likely need them and can
tell me if they work.

As always feedback and flames welcome.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1518  -> 1.1519
#	arch/ppc64/kernel/smp.c	1.68    -> 1.69
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/03/23	jschopp at threadlp13.austin.ibm.com	1.1519
# Fix two bugs related to cpu DLPAR/hotplug.  The first is to properly handle extended busy.  The second is to properly handle dynamically adding
# secondary SMT threads.
# --------------------------------------------
#
diff -Nru a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
--- a/arch/ppc64/kernel/smp.c	Tue Mar 23 18:33:17 2004
+++ b/arch/ppc64/kernel/smp.c	Tue Mar 23 18:33:17 2004
@@ -371,6 +371,7 @@
 			wait_time = rtas_extended_busy_delay_time(status);
 			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(wait_time);
+			break;
 		    }
 		    default:	/* shouldn't happen */
 			return -ENOMSG;
@@ -382,13 +383,13 @@

 /* Search all cpu DR entities, looking for one which is present.  If
  * the same hw index as before is available, grab that in preference.a
- * Match the dr-index to a cpu node in the device tree.  Use the reg
- * (hw index) from the node to query rtas if the cpu is in a stopped
- * state.
+ * Match the dr-index to a cpu node in the device tree.  Use the
+ * ibm,ppc-interrupt-server#s (hw index) from the node to query rtas
+ * if the cpu is in a stopped state.
  */
 static unsigned int find_physical_cpu_to_start(unsigned int old_hwindex)
 {
-	int i, idx;
+	int i, j, idx;
 	int count = 0;
 	int num_addr_cell, num_size_cell, len;
 	struct device_node *np;
@@ -426,18 +427,23 @@

 			if (!ireg || ireg[0] != idx)
 				continue;
-			ireg = (unsigned int *)get_property(np, "reg", &len);

-			if (!ireg)
-				continue;
+			ireg = (unsigned int*) get_property(np, "ibm,ppc-interrupt-server#s", &len);

-			status = query_cpu_stopped(*ireg);
-			if (status == 0) {
-				best = *ireg;
+			if (unlikely(!ireg)){
+			    ireg = (unsigned int*) get_property(np, "reg", &len);/* fake it with phys id */
+			    if(!ireg)
+				continue;
+			}
+			for(j = 0; j < (len / sizeof(u32)); j++){
+			    status = query_cpu_stopped(ireg[j]);
+			    if (status == 0) {
+				best = ireg[j];
 				if (best == old_hwindex) {
-					of_node_put(np);
-					goto out;
+				    of_node_put(np);
+				    goto out;
 				}
+			    }
 			}
 		}
 	}


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list