RESEND [PATCH] - SN: Add support for CPU disable

2007-08-22 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---
Resend #2:
  Add severity levels to the new "printk" messages.

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 ---
 arch/ia64/sn/kernel/irq.c   |   15 
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   26 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 64 insertions(+), 4 deletions(-)


Index: release/arch/ia64/sn/kernel/huberror.c
===
--- release.orig/arch/ia64/sn/kernel/huberror.c 2007-08-22 16:51:28.667238863 
-0500
+++ release/arch/ia64/sn/kernel/huberror.c  2007-08-22 18:41:19.088053993 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   "SN_hub_error", (void *)hubdev_info))
+   "SN_hub_error", (void *)hubdev_info)) {
printk("hub_error_init: Failed to request_irq for 0x%p\n",
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
"SN_TIO_error",
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk("ice_error_init: request_irq() error hubdev_info 
0x%p\n",
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: release/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- release.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/pcibr/pcibr_provider.c 2007-08-22 
18:41:19.100055471 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   "pcibr cannot allocate interrupt for error handler\n");
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the "kernel" pagesize 
Index: release/arch/ia64/sn/pci/tioca_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioca_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioca_provider.c   2007-08-22 18:41:19.112056948 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common->ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller->node = tioca_kern->ca_closest_node;
return tioca_common;
Index: release/arch/ia64/sn/pci/tioce_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioce_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioce_provider.c   2007-08-22 18:41:19.124058426 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common->ce_pcibus.bs_persist_segment,
   tioce_common->ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: release/include/asm-ia64/sn/sn_feature_sets.h
===
--- release.orig/include/asm-ia64/sn/sn_feature_sets.h  2007-08-22 
16:51:32.887758491 -0500
+++ release/include/asm-ia64/sn/sn_feature_sets.h   2007-08-22 
18:41:19.140060396 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - OS Features ---*/
 
Index: 

RESEND [PATCH] - SN: Add support for CPU disable

2007-08-22 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller [EMAIL PROTECTED]
---
Resend #2:
  Add severity levels to the new printk messages.

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 ---
 arch/ia64/sn/kernel/irq.c   |   15 
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   26 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 64 insertions(+), 4 deletions(-)


Index: release/arch/ia64/sn/kernel/huberror.c
===
--- release.orig/arch/ia64/sn/kernel/huberror.c 2007-08-22 16:51:28.667238863 
-0500
+++ release/arch/ia64/sn/kernel/huberror.c  2007-08-22 18:41:19.088053993 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   SN_hub_error, (void *)hubdev_info))
+   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
SN_TIO_error,
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk(ice_error_init: request_irq() error hubdev_info 
0x%p\n,
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: release/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- release.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/pcibr/pcibr_provider.c 2007-08-22 
18:41:19.100055471 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   pcibr cannot allocate interrupt for error handler\n);
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the kernel pagesize 
Index: release/arch/ia64/sn/pci/tioca_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioca_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioca_provider.c   2007-08-22 18:41:19.112056948 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common-ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller-node = tioca_kern-ca_closest_node;
return tioca_common;
Index: release/arch/ia64/sn/pci/tioce_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioce_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioce_provider.c   2007-08-22 18:41:19.124058426 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common-ce_pcibus.bs_persist_segment,
   tioce_common-ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: release/include/asm-ia64/sn/sn_feature_sets.h
===
--- release.orig/include/asm-ia64/sn/sn_feature_sets.h  2007-08-22 
16:51:32.887758491 -0500
+++ release/include/asm-ia64/sn/sn_feature_sets.h   2007-08-22 
18:41:19.140060396 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - OS Features ---*/
 
Index: release/arch/ia64/kernel/smpboot.c

RESEND [PATCH] - SN: Add support for CPU disable

2007-08-01 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 +---
 arch/ia64/sn/kernel/irq.c   |   15 +
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 62 insertions(+), 4 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-08-01 14:29:20.400606100 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   "SN_hub_error", (void *)hubdev_info))
+   "SN_hub_error", (void *)hubdev_info)) {
printk("hub_error_init: Failed to request_irq for 0x%p\n",
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
"SN_TIO_error",
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk("ice_error_init: request_irq() error hubdev_info 
0x%p\n",
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-08-01 
14:29:20.420608563 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   "pcibr cannot allocate interrupt for error handler\n");
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the "kernel" pagesize 
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-08-01 14:29:20.432610041 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common->ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller->node = tioca_kern->ca_closest_node;
return tioca_common;
Index: linux-2.6/arch/ia64/sn/pci/tioce_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioce_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioce_provider.c 2007-08-01 14:29:20.444611519 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common->ce_pcibus.bs_persist_segment,
   tioce_common->ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: linux-2.6/include/asm-ia64/sn/sn_feature_sets.h
===
--- linux-2.6.orig/include/asm-ia64/sn/sn_feature_sets.h2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/include/asm-ia64/sn/sn_feature_sets.h 2007-08-01 
14:29:20.456612997 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - OS Features ---*/
 
Index: linux-2.6/arch/ia64/kernel/smpboot.c

RESEND [PATCH] - SN: Add support for CPU disable

2007-08-01 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 +---
 arch/ia64/sn/kernel/irq.c   |   15 +
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 62 insertions(+), 4 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-08-01 14:29:20.400606100 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   SN_hub_error, (void *)hubdev_info))
+   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
SN_TIO_error,
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk(ice_error_init: request_irq() error hubdev_info 
0x%p\n,
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-08-01 
14:29:20.420608563 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   pcibr cannot allocate interrupt for error handler\n);
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the kernel pagesize 
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-08-01 14:29:20.432610041 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common-ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller-node = tioca_kern-ca_closest_node;
return tioca_common;
Index: linux-2.6/arch/ia64/sn/pci/tioce_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioce_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioce_provider.c 2007-08-01 14:29:20.444611519 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common-ce_pcibus.bs_persist_segment,
   tioce_common-ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: linux-2.6/include/asm-ia64/sn/sn_feature_sets.h
===
--- linux-2.6.orig/include/asm-ia64/sn/sn_feature_sets.h2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/include/asm-ia64/sn/sn_feature_sets.h 2007-08-01 
14:29:20.456612997 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - OS Features ---*/
 
Index: linux-2.6/arch/ia64/kernel/smpboot.c

Re: [PATCH] - SN: Add support for CPU disable

2007-07-31 Thread Luca Tettamanti
Hi,
I've a couple of comments on the patch:

John Keller <[EMAIL PROTECTED]> ha scritto:
> Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
> ===
> --- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-07-31 
> 09:09:55.414522005 -0500
> +++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-07-31 09:38:14.634045360 
> -0500
> @@ -14,6 +14,7 @@
> #include 
> #include 
> #include 
> +#include 
> #include "xtalk/xwidgetdev.h"
> #include "xtalk/hubdev.h"
> #include 
> @@ -185,11 +186,22 @@ void hubiio_crb_error_handler(struct hub
>  */
> void hub_error_init(struct hubdev_info *hubdev_info)
> {
> +
>if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
> -   "SN_hub_error", (void *)hubdev_info))
> +   "SN_hub_error", (void *)hubdev_info)) {
>printk("hub_error_init: Failed to request_irq for 0x%p\n",
>hubdev_info);
> -   return;
> +   return;
> +   }
> +
> +#ifdef CONFIG_SMP
> +   /*
> +* On systems which support CPU disabling (SHub2), all error 
> interrupts
> +* are targetted at the boot CPU.
> +*/
> +   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
> +   set_irq_affinity_info(SGI_II_ERROR, 0, 0);
> +#endif

This snippet is repeated many times. You may want to use an inline
helper (defined as no-op for !CONFIG_SMP), something like this:

#ifdef CONFIG_SMP
static inline void migrate_error_int(void)
{
/*
 * On systems which support CPU disabling (SHub2), all error interrupts
 * are targetted at the boot CPU.
 */
 if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
set_irq_affinity_info(SGI_II_ERROR, 0, 0);
}
#else
static inline void migrate_error_int(void) { }
#endif

As as bonus you remove the #ifdef from the main code.

> --- linux-2.6.orig/arch/ia64/sn/kernel/sn2/sn2_smp.c2007-07-31 
> 09:09:55.418522496 -0500
> +++ linux-2.6/arch/ia64/sn/kernel/sn2/sn2_smp.c 2007-07-31 09:38:14.782063615 
> -0500
> @@ -40,6 +40,7 @@
> #include 
> #include 
> #include 
> +#include 
> 
> DEFINE_PER_CPU(struct ptc_stats, ptcstats);
> DECLARE_PER_CPU(struct ptc_stats, ptcstats);
> @@ -429,6 +430,29 @@ void sn2_send_IPI(int cpuid, int vector,
>sn_send_IPI_phys(nasid, physid, vector, delivery_mode);
> }
> 
> +#ifdef CONFIG_HOTPLUG_CPU
> +/**
> + * sn_cpu_disable_allowed - Determine if a CPU can be disabled.
> + * @cpu - CPU that is requested to be disabled.
> + *
> + * CPU disable is only allowed on SHub2 systems running with a PROM
> + * that supports CPU disable. It is not permitted to disable the boot 
> processor.
> + */
> +bool sn_cpu_disable_allowed(int cpu)
> +{
> +   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
> +   if (cpu != 0)
> +   return true;
> +   else
> +   printk("Disabling the boot processor is not 
> allowed.\n");
> +
> +   else

Hum, brackets around the inner if statement?

Luca
-- 
Let me make your mind, leave yourself behind
Be not afraid
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - SN: Add support for CPU disable

2007-07-31 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/ia64/kernel/smpboot.c  |6 
 arch/ia64/sn/kernel/huberror.c  |   31 +++---
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 +
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |   10 +++
 arch/ia64/sn/pci/tioca_provider.c   |   10 +++
 arch/ia64/sn/pci/tioce_provider.c   |   11 +++
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 8 files changed, 90 insertions(+), 4 deletions(-)



Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-07-31 
09:09:55.414522005 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-07-31 09:38:14.634045360 
-0500
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xtalk/xwidgetdev.h"
 #include "xtalk/hubdev.h"
 #include 
@@ -185,11 +186,22 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   "SN_hub_error", (void *)hubdev_info))
+   "SN_hub_error", (void *)hubdev_info)) {
printk("hub_error_init: Failed to request_irq for 0x%p\n",
hubdev_info);
-   return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_II_ERROR, 0, 0);
+#endif
 }
 
 
@@ -202,11 +214,22 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
"SN_TIO_error",
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk("ice_error_init: request_irq() error hubdev_info 
0x%p\n",
hubdev_info);
-return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_TIO_ERROR, 0, 0);
+#endif
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-07-31 
09:38:14.662048814 -0500
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xtalk/xwidgetdev.h"
 #include "xtalk/hubdev.h"
 
@@ -146,6 +147,15 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
   "pcibr cannot allocate interrupt for error handler\n");
}
 
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_PCIASIC_ERROR, 0, 0);
+#endif
+
/* 
 * Update the Bridge with the "kernel" pagesize 
 */
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-07-31 09:38:14.686051774 
-0500
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 u32 tioca_gart_found;
 EXPORT_SYMBOL(tioca_gart_found);   /* used by agp-sgi */
@@ -653,6 +654,15 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   "Error interrupts won't be routed for TIOCA bus %d\n",
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common->ca_common.bs_persist_busnum);
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_TIOCA_ERROR, 0, 0);
+#endif
+
 
/* Setup locality information */
controller->node = tioca_kern->ca_closest_node;
Index: 

[PATCH] - SN: Add support for CPU disable

2007-07-31 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/ia64/kernel/smpboot.c  |6 
 arch/ia64/sn/kernel/huberror.c  |   31 +++---
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 +
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |   10 +++
 arch/ia64/sn/pci/tioca_provider.c   |   10 +++
 arch/ia64/sn/pci/tioce_provider.c   |   11 +++
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 8 files changed, 90 insertions(+), 4 deletions(-)



Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-07-31 
09:09:55.414522005 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-07-31 09:38:14.634045360 
-0500
@@ -14,6 +14,7 @@
 #include asm/sn/addrs.h
 #include asm/sn/shubio.h
 #include asm/sn/geo.h
+#include asm/sn/sn_feature_sets.h
 #include xtalk/xwidgetdev.h
 #include xtalk/hubdev.h
 #include asm/sn/bte.h
@@ -185,11 +186,22 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   SN_hub_error, (void *)hubdev_info))
+   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
-   return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_II_ERROR, 0, 0);
+#endif
 }
 
 
@@ -202,11 +214,22 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
SN_TIO_error,
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk(ice_error_init: request_irq() error hubdev_info 
0x%p\n,
hubdev_info);
-return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_TIO_ERROR, 0, 0);
+#endif
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-07-31 
09:38:14.662048814 -0500
@@ -17,6 +17,7 @@
 #include asm/sn/sn_sal.h
 #include asm/sn/pic.h
 #include asm/sn/sn2/sn_hwperf.h
+#include asm/sn/sn_feature_sets.h
 #include xtalk/xwidgetdev.h
 #include xtalk/hubdev.h
 
@@ -146,6 +147,15 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
   pcibr cannot allocate interrupt for error handler\n);
}
 
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_PCIASIC_ERROR, 0, 0);
+#endif
+
/* 
 * Update the Bridge with the kernel pagesize 
 */
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-07-31 09:38:14.686051774 
-0500
@@ -15,6 +15,7 @@
 #include asm/sn/pcidev.h
 #include asm/sn/pcibus_provider_defs.h
 #include asm/sn/tioca_provider.h
+#include asm/sn/sn_feature_sets.h
 
 u32 tioca_gart_found;
 EXPORT_SYMBOL(tioca_gart_found);   /* used by agp-sgi */
@@ -653,6 +654,15 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   Error interrupts won't be routed for TIOCA bus %d\n,
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common-ca_common.bs_persist_busnum);
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+  

Re: [PATCH] - SN: Add support for CPU disable

2007-07-31 Thread Luca Tettamanti
Hi,
I've a couple of comments on the patch:

John Keller [EMAIL PROTECTED] ha scritto:
 Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
 ===
 --- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-07-31 
 09:09:55.414522005 -0500
 +++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-07-31 09:38:14.634045360 
 -0500
 @@ -14,6 +14,7 @@
 #include asm/sn/addrs.h
 #include asm/sn/shubio.h
 #include asm/sn/geo.h
 +#include asm/sn/sn_feature_sets.h
 #include xtalk/xwidgetdev.h
 #include xtalk/hubdev.h
 #include asm/sn/bte.h
 @@ -185,11 +186,22 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
 +
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
 -   SN_hub_error, (void *)hubdev_info))
 +   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
 -   return;
 +   return;
 +   }
 +
 +#ifdef CONFIG_SMP
 +   /*
 +* On systems which support CPU disabling (SHub2), all error 
 interrupts
 +* are targetted at the boot CPU.
 +*/
 +   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
 +   set_irq_affinity_info(SGI_II_ERROR, 0, 0);
 +#endif

This snippet is repeated many times. You may want to use an inline
helper (defined as no-op for !CONFIG_SMP), something like this:

#ifdef CONFIG_SMP
static inline void migrate_error_int(void)
{
/*
 * On systems which support CPU disabling (SHub2), all error interrupts
 * are targetted at the boot CPU.
 */
 if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
set_irq_affinity_info(SGI_II_ERROR, 0, 0);
}
#else
static inline void migrate_error_int(void) { }
#endif

As as bonus you remove the #ifdef from the main code.

 --- linux-2.6.orig/arch/ia64/sn/kernel/sn2/sn2_smp.c2007-07-31 
 09:09:55.418522496 -0500
 +++ linux-2.6/arch/ia64/sn/kernel/sn2/sn2_smp.c 2007-07-31 09:38:14.782063615 
 -0500
 @@ -40,6 +40,7 @@
 #include asm/sn/shub_mmr.h
 #include asm/sn/nodepda.h
 #include asm/sn/rw_mmr.h
 +#include asm/sn/sn_feature_sets.h
 
 DEFINE_PER_CPU(struct ptc_stats, ptcstats);
 DECLARE_PER_CPU(struct ptc_stats, ptcstats);
 @@ -429,6 +430,29 @@ void sn2_send_IPI(int cpuid, int vector,
sn_send_IPI_phys(nasid, physid, vector, delivery_mode);
 }
 
 +#ifdef CONFIG_HOTPLUG_CPU
 +/**
 + * sn_cpu_disable_allowed - Determine if a CPU can be disabled.
 + * @cpu - CPU that is requested to be disabled.
 + *
 + * CPU disable is only allowed on SHub2 systems running with a PROM
 + * that supports CPU disable. It is not permitted to disable the boot 
 processor.
 + */
 +bool sn_cpu_disable_allowed(int cpu)
 +{
 +   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
 +   if (cpu != 0)
 +   return true;
 +   else
 +   printk(Disabling the boot processor is not 
 allowed.\n);
 +
 +   else

Hum, brackets around the inner if statement?

Luca
-- 
Let me make your mind, leave yourself behind
Be not afraid
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/