[PATCH] [ppc64] fix hotplug irq migration code

Anton Blanchard anton at samba.org
Sun Aug 1 13:57:04 EST 2004


Hi,

In migrate_irqs_away we werent converting a virtual irq to a real one.
We ended up passing the wrong irq numbers to the hypervisor and
migration of affinitised irqs on cpu hot unplug didnt work.

Also clarify the rtas_stop_self printk.

Signed-off-by: Anton Blanchard <anton at samba.org>

diff -puN arch/ppc64/kernel/xics.c~migrate-irqs-away arch/ppc64/kernel/xics.c
--- foobar2/arch/ppc64/kernel/xics.c~migrate-irqs-away	2004-08-01 11:44:41.412353159 +1000
+++ foobar2-anton/arch/ppc64/kernel/xics.c	2004-08-01 11:53:43.050041725 +1000
@@ -657,9 +657,7 @@ void xics_migrate_irqs_away(void)
 	int set_indicator = rtas_token("set-indicator");
 	const unsigned int giqs = 9005UL; /* Global Interrupt Queue Server */
 	int status = 0;
-	unsigned int irq, cpu = smp_processor_id();
-	int xics_status[2];
-	unsigned long flags;
+	unsigned int irq, virq, cpu = smp_processor_id();

 	BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE);

@@ -676,12 +674,20 @@ void xics_migrate_irqs_away(void)
 	ops->cppr_info(cpu, DEFAULT_PRIORITY);
 	iosync();

-	printk(KERN_WARNING "HOTPLUG: Migrating IRQs away\n");
-	for_each_irq(irq) {
-		irq_desc_t *desc = get_irq_desc(irq);
+	for_each_irq(virq) {
+		irq_desc_t *desc;
+		int xics_status[2];
+		unsigned long flags;
+
+		/* We cant set affinity on ISA interrupts */
+		if (virq < irq_offset_value())
+			continue;
+
+		desc = get_irq_desc(virq);
+		irq = virt_irq_to_real(irq_offset_down(virq));

 		/* We need to get IPIs still. */
-		if (irq_offset_down(irq) == XICS_IPI)
+		if (irq == XICS_IPI || irq == NO_IRQ)
 			continue;

 		/* We only need to migrate enabled IRQS */
@@ -696,7 +702,7 @@ void xics_migrate_irqs_away(void)
 		if (status) {
 			printk(KERN_ERR "migrate_irqs_away: irq=%d "
 					"ibm,get-xive returns %d\n",
-					irq, status);
+					virq, status);
 			goto unlock;
 		}

@@ -709,21 +715,20 @@ void xics_migrate_irqs_away(void)
 			goto unlock;

 		printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n",
-		       irq, cpu);
+		       virq, cpu);

 		/* Reset affinity to all cpus */
 		xics_status[0] = default_distrib_server;

-		status = rtas_call(ibm_set_xive, 3, 1, NULL,
-				irq, xics_status[0], xics_status[1]);
+		status = rtas_call(ibm_set_xive, 3, 1, NULL, irq,
+				xics_status[0], xics_status[1]);
 		if (status)
 			printk(KERN_ERR "migrate_irqs_away irq=%d "
 					"ibm,set-xive returns %d\n",
-					irq, status);
+					virq, status);

 unlock:
 		spin_unlock_irqrestore(&desc->lock, flags);
 	}
-
 }
 #endif
diff -L xics.c -puN /dev/null /dev/null
diff -puN arch/ppc64/kernel/rtas.c~migrate-irqs-away arch/ppc64/kernel/rtas.c
--- foobar2/arch/ppc64/kernel/rtas.c~migrate-irqs-away	2004-08-01 12:39:46.199965774 +1000
+++ foobar2-anton/arch/ppc64/kernel/rtas.c	2004-08-01 12:40:28.722010572 +1000
@@ -500,7 +500,7 @@ void rtas_stop_self(void)

 	BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE);

-	printk("%u %u Ready to die...\n",
+	printk("cpu %u (hwid %u) Ready to die...\n",
 	       smp_processor_id(), hard_smp_processor_id());
 	enter_rtas(__pa(rtas_args));


_

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





More information about the Linuxppc64-dev mailing list