Subject: Re: [PATCH] Fix interrupt distribution in ppc970

From: Mohan Kumar M <[email-masked]>
Date: Mon, 9 Apr 2007 14:27:32 +0530

On Wed, Mar 07, 2007 at 11:52:32AM +0100, Michael Ellerman wrote:
> There's already maxcpus in init/main.c, that would probably be better,
> though still ugly.
>
Based on Mike's suggestions, I modified the patch. The attached patch
refers max_cpus variable to check whether the kernel is booted with
maxcpus=1 parameter and if maxcpus=1 is specified the patch assigns only
the current boot cpu to be the default distribution server.

Patch is generated over 2.6.20 kernel, cleanly applies to 2.6.21-rc5
kernel.

Any suggestion, comment?

Signed-off-by: Mohan Kumar M <[email-masked]>
---
 arch/powerpc/platforms/pseries/xics.c |    9 +++++++++
 init/main.c                           |    2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

Index: linux-2.6.20/arch/powerpc/platforms/pseries/xics.c
===================================================================
--- linux-2.6.20.orig/arch/powerpc/platforms/pseries/xics.c
+++ linux-2.6.20/arch/powerpc/platforms/pseries/xics.c
@@ -679,6 +679,8 @@ static struct device_node *cpuid_to_of_n
 	return NULL;
 }
 
+extern unsigned int max_cpus;
+
 void __init xics_init_IRQ(void)
 {
 	int i, j;
@@ -734,6 +736,13 @@ void __init xics_init_IRQ(void)
 skip_gserver_check:
 	of_node_put(np);
 
+	/* Kdump with maxcpus parameter in PPC970xx creates interrupt
+	 * distribution problems. So assign current boot cpu id to
+	 * interrupt distribution server
+	 */
+	if (max_cpus == 1)
+		default_distrib_server = default_server;
+
 	if (firmware_has_feature(FW_FEATURE_LPAR))
 		ppc_md.get_irq = xics_get_irq_lpar;
 	else
Index: linux-2.6.20/init/main.c
===================================================================
--- linux-2.6.20.orig/init/main.c
+++ linux-2.6.20/init/main.c
@@ -128,7 +128,7 @@ static char *execute_command;
 static char *ramdisk_execute_command;
 
 /* Setup configured maximum number of CPUs to activate */
-static unsigned int max_cpus = NR_CPUS;
+unsigned int max_cpus = NR_CPUS;
 
 /*
  * If set, this is an indication to the drivers that reset the underlying