[ewg] [PATCH] IB/ehca: Remove suppress-DMEM code for 2.6.2[456]

Joachim Fenkes fenkes at de.ibm.com
Fri Nov 14 07:15:58 PST 2008


Our "suppress DMEM" code works in these kernels only if
CONFIG_HOTPLUG_SPARSE_MEMORY is disabled, so patch it out again.

Signed-off-by: Joachim Fenkes <fenkes at de.ibm.com>

---

Vlad, please apply this one for RC5 -- thanks!
  Joachim

diff -Nurp a/kernel_patches/backport/2.6.24/ehca_00_revert_inhibit_dmem.patch b/kernel_patches/backport/2.6.24/ehca_00_revert_inhibit_dmem.patch
--- a/kernel_patches/backport/2.6.24/ehca_00_revert_inhibit_dmem.patch	1970-01-01 01:00:00.000000000 +0100
+++ b/kernel_patches/backport/2.6.24/ehca_00_revert_inhibit_dmem.patch	2008-11-14 15:39:00.000000000 +0100
@@ -0,0 +1,113 @@
+From 263c24a2bbbaca75805ed231e8346d86410af9d0 Mon Sep 17 00:00:00 2001
+From: Stefan Roscher <ossrosch at linux.vnet.ibm.com>
+Date: Wed, 22 Oct 2008 15:54:38 -0700
+Subject: [PATCH] IB/ehca: Reject dynamic memory add/remove when ehca adapter is present
+
+Since the ehca device driver does not support dynamic memory add and
+remove operations, the driver must explicitly reject such requests in
+order to prevent unpredictable behaviors related to existing memory
+regions that cover all of memory being used by InfiniBand protocols in
+the kernel.
+
+The solution (for now at least) is to add a memory notifier to the
+ehca device driver and if a request for dynamic memory add or remove
+comes in, ehca will always reject it.  The user can add or remove
+memory by hot-removing the ehca adapter, performing the memory
+operation, and then hot-adding the ehca adapter back.
+
+Signed-off-by: Stefan Roscher <stefan.roscher at de.ibm.com>
+Signed-off-by: Roland Dreier <rolandd at cisco.com>
+---
+ drivers/infiniband/hw/ehca/ehca_main.c |   48 --------------------------------
+ 1 files changed, 0 insertions(+), 48 deletions(-)
+
+diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
+index bb02a86..086959a 100644
+--- a/drivers/infiniband/hw/ehca/ehca_main.c
++++ b/drivers/infiniband/hw/ehca/ehca_main.c
+@@ -44,8 +44,6 @@
+ #include <linux/slab.h>
+ #endif
+ 
+-#include <linux/notifier.h>
+-#include <linux/memory.h>
+ #include "ehca_classes.h"
+ #include "ehca_iverbs.h"
+ #include "ehca_mrmw.h"
+@@ -971,41 +969,6 @@ void ehca_poll_eqs(unsigned long data)
+ 	spin_unlock(&shca_list_lock);
+ }
+ 
+-static int ehca_mem_notifier(struct notifier_block *nb,
+-			     unsigned long action, void *data)
+-{
+-	static unsigned long ehca_dmem_warn_time;
+-
+-	switch (action) {
+-	case MEM_CANCEL_OFFLINE:
+-	case MEM_CANCEL_ONLINE:
+-	case MEM_ONLINE:
+-	case MEM_OFFLINE:
+-		return NOTIFY_OK;
+-	case MEM_GOING_ONLINE:
+-	case MEM_GOING_OFFLINE:
+-		/* only ok if no hca is attached to the lpar */
+-		spin_lock(&shca_list_lock);
+-		if (list_empty(&shca_list)) {
+-			spin_unlock(&shca_list_lock);
+-			return NOTIFY_OK;
+-		} else {
+-			spin_unlock(&shca_list_lock);
+-			if (printk_timed_ratelimit(&ehca_dmem_warn_time,
+-						   30 * 1000))
+-				ehca_gen_err("DMEM operations are not allowed"
+-					     "as long as an ehca adapter is"
+-					     "attached to the LPAR");
+-			return NOTIFY_BAD;
+-		}
+-	}
+-	return NOTIFY_OK;
+-}
+-
+-static struct notifier_block ehca_mem_nb = {
+-	.notifier_call = ehca_mem_notifier,
+-};
+-
+ static int __init ehca_module_init(void)
+ {
+ 	int ret;
+@@ -1033,12 +996,6 @@ static int __init ehca_module_init(void)
+ 		goto module_init2;
+ 	}
+ 
+-	ret = register_memory_notifier(&ehca_mem_nb);
+-	if (ret) {
+-		ehca_gen_err("Failed registering memory add/remove notifier");
+-		goto module_init3;
+-	}
+-
+ 	if (ehca_poll_all_eqs != 1) {
+ 		ehca_gen_err("WARNING!!!");
+ 		ehca_gen_err("It is possible to lose interrupts.");
+@@ -1051,9 +1008,6 @@ static int __init ehca_module_init(void)
+ 
+ 	return 0;
+ 
+-module_init3:
+-	ibmebus_unregister_driver(&ehca_driver);
+-
+ module_init2:
+ 	ehca_destroy_slab_caches();
+ 
+@@ -1069,8 +1023,6 @@ static void __exit ehca_module_exit(void)
+ 
+ 	ibmebus_unregister_driver(&ehca_driver);
+ 
+-	unregister_memory_notifier(&ehca_mem_nb);
+-
+ 	ehca_destroy_slab_caches();
+ 
+ 	ehca_destroy_comp_pool();
+-- 
+1.5.5
+
diff -Nurp a/kernel_patches/backport/2.6.25/ehca_00_revert_inhibit_dmem.patch b/kernel_patches/backport/2.6.25/ehca_00_revert_inhibit_dmem.patch
--- a/kernel_patches/backport/2.6.25/ehca_00_revert_inhibit_dmem.patch	1970-01-01 01:00:00.000000000 +0100
+++ b/kernel_patches/backport/2.6.25/ehca_00_revert_inhibit_dmem.patch	2008-11-14 15:39:01.000000000 +0100
@@ -0,0 +1,113 @@
+From 263c24a2bbbaca75805ed231e8346d86410af9d0 Mon Sep 17 00:00:00 2001
+From: Stefan Roscher <ossrosch at linux.vnet.ibm.com>
+Date: Wed, 22 Oct 2008 15:54:38 -0700
+Subject: [PATCH] IB/ehca: Reject dynamic memory add/remove when ehca adapter is present
+
+Since the ehca device driver does not support dynamic memory add and
+remove operations, the driver must explicitly reject such requests in
+order to prevent unpredictable behaviors related to existing memory
+regions that cover all of memory being used by InfiniBand protocols in
+the kernel.
+
+The solution (for now at least) is to add a memory notifier to the
+ehca device driver and if a request for dynamic memory add or remove
+comes in, ehca will always reject it.  The user can add or remove
+memory by hot-removing the ehca adapter, performing the memory
+operation, and then hot-adding the ehca adapter back.
+
+Signed-off-by: Stefan Roscher <stefan.roscher at de.ibm.com>
+Signed-off-by: Roland Dreier <rolandd at cisco.com>
+---
+ drivers/infiniband/hw/ehca/ehca_main.c |   48 --------------------------------
+ 1 files changed, 0 insertions(+), 48 deletions(-)
+
+diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
+index bb02a86..086959a 100644
+--- a/drivers/infiniband/hw/ehca/ehca_main.c
++++ b/drivers/infiniband/hw/ehca/ehca_main.c
+@@ -44,8 +44,6 @@
+ #include <linux/slab.h>
+ #endif
+ 
+-#include <linux/notifier.h>
+-#include <linux/memory.h>
+ #include "ehca_classes.h"
+ #include "ehca_iverbs.h"
+ #include "ehca_mrmw.h"
+@@ -971,41 +969,6 @@ void ehca_poll_eqs(unsigned long data)
+ 	spin_unlock(&shca_list_lock);
+ }
+ 
+-static int ehca_mem_notifier(struct notifier_block *nb,
+-			     unsigned long action, void *data)
+-{
+-	static unsigned long ehca_dmem_warn_time;
+-
+-	switch (action) {
+-	case MEM_CANCEL_OFFLINE:
+-	case MEM_CANCEL_ONLINE:
+-	case MEM_ONLINE:
+-	case MEM_OFFLINE:
+-		return NOTIFY_OK;
+-	case MEM_GOING_ONLINE:
+-	case MEM_GOING_OFFLINE:
+-		/* only ok if no hca is attached to the lpar */
+-		spin_lock(&shca_list_lock);
+-		if (list_empty(&shca_list)) {
+-			spin_unlock(&shca_list_lock);
+-			return NOTIFY_OK;
+-		} else {
+-			spin_unlock(&shca_list_lock);
+-			if (printk_timed_ratelimit(&ehca_dmem_warn_time,
+-						   30 * 1000))
+-				ehca_gen_err("DMEM operations are not allowed"
+-					     "as long as an ehca adapter is"
+-					     "attached to the LPAR");
+-			return NOTIFY_BAD;
+-		}
+-	}
+-	return NOTIFY_OK;
+-}
+-
+-static struct notifier_block ehca_mem_nb = {
+-	.notifier_call = ehca_mem_notifier,
+-};
+-
+ static int __init ehca_module_init(void)
+ {
+ 	int ret;
+@@ -1033,12 +996,6 @@ static int __init ehca_module_init(void)
+ 		goto module_init2;
+ 	}
+ 
+-	ret = register_memory_notifier(&ehca_mem_nb);
+-	if (ret) {
+-		ehca_gen_err("Failed registering memory add/remove notifier");
+-		goto module_init3;
+-	}
+-
+ 	if (ehca_poll_all_eqs != 1) {
+ 		ehca_gen_err("WARNING!!!");
+ 		ehca_gen_err("It is possible to lose interrupts.");
+@@ -1051,9 +1008,6 @@ static int __init ehca_module_init(void)
+ 
+ 	return 0;
+ 
+-module_init3:
+-	ibmebus_unregister_driver(&ehca_driver);Hi, Vlad,

please pull from ~hnguyen/libehca.git -- there's a new fix for OFED 1.4 in there.

Thanks and regards,
  Joachim


+-
+ module_init2:
+ 	ehca_destroy_slab_caches();
+ 
+@@ -1069,8 +1023,6 @@ static void __exit ehca_module_exit(void)
+ 
+ 	ibmebus_unregister_driver(&ehca_driver);
+ 
+-	unregister_memory_notifier(&ehca_mem_nb);
+-
+ 	ehca_destroy_slab_caches();
+ 
+ 	ehca_destroy_comp_pool();
+-- 
+1.5.5
+
diff -Nurp a/kernel_patches/backport/2.6.26/ehca_00_revert_inhibit_dmem.patch b/kernel_patches/backport/2.6.26/ehca_00_revert_inhibit_dmem.patch
--- a/kernel_patches/backport/2.6.26/ehca_00_revert_inhibit_dmem.patch	1970-01-01 01:00:00.000000000 +0100
+++ b/kernel_patches/backport/2.6.26/ehca_00_revert_inhibit_dmem.patch	2008-11-14 15:39:02.000000000 +0100
@@ -0,0 +1,113 @@
+From 263c24a2bbbaca75805ed231e8346d86410af9d0 Mon Sep 17 00:00:00 2001
+From: Stefan Roscher <ossrosch at linux.vnet.ibm.com>
+Date: Wed, 22 Oct 2008 15:54:38 -0700
+Subject: [PATCH] IB/ehca: Reject dynamic memory add/remove when ehca adapter is present
+
+Since the ehca device driver does not support dynamic memory add and
+remove operations, the driver must explicitly reject such requests in
+order to prevent unpredictable behaviors related to existing memory
+regions that cover all of memory being used by InfiniBand protocols in
+the kernel.
+
+The solution (for now at least) is to add a memory notifier to the
+ehca device driver and if a request for dynamic memory add or remove
+comes in, ehca will always reject it.  The user can add or removeHi, Vlad,

please pull from ~hnguyen/libehca.git -- there's a new fix for OFED 1.4 in there.

Thanks and regards,
  Joachim


+memory by hot-removing the ehca adapter, performing the memory
+operation, and then hot-adding the ehca adapter back.
+
+Signed-off-by: Stefan Roscher <stefan.roscher at de.ibm.com>
+Signed-off-by: Roland Dreier <rolandd at cisco.com>
+---
+ drivers/infiniband/hw/ehca/ehca_main.c |   48 --------------------------------
+ 1 files changed, 0 insertions(+), 48 deletions(-)
+
+diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
+index bb02a86..086959a 100644
+--- a/drivers/infiniband/hw/ehca/ehca_main.c
++++ b/drivers/infiniband/hw/ehca/ehca_main.c
+@@ -44,8 +44,6 @@
+ #include <linux/slab.h>
+ #endif
+ 
+-#include <linux/notifier.h>
+-#include <linux/memory.h>
+ #include "ehca_classes.h"
+ #include "ehca_iverbs.h"
+ #include "ehca_mrmw.h"
+@@ -971,41 +969,6 @@ void ehca_poll_eqs(unsigned long data)
+ 	spin_unlock(&shca_list_lock);
+ }
+ 
+-static int ehca_mem_notifier(struct notifier_block *nb,
+-			     unsigned long action, void *data)
+-{
+-	static unsigned long ehca_dmem_warn_time;
+-
+-	switch (action) {
+-	case MEM_CANCEL_OFFLINE:Hi, Vlad,

please pull from ~hnguyen/libehca.git -- there's a new fix for OFED 1.4 in there.

Thanks and regards,
  Joachim


+-	case MEM_CANCEL_ONLINE:
+-	case MEM_ONLINE:
+-	case MEM_OFFLINE:
+-		return NOTIFY_OK;
+-	case MEM_GOING_ONLINE:
+-	case MEM_GOING_OFFLINE:
+-		/* only ok if no hca is attached to the lpar */
+-		spin_lock(&shca_list_lock);
+-		if (list_empty(&shca_list)) {
+-			spin_unlock(&shca_list_lock);
+-			return NOTIFY_OK;
+-		} else {
+-			spin_unlock(&shca_list_lock);
+-			if (printk_timed_ratelimit(&ehca_dmem_warn_time,
+-						   30 * 1000))
+-				ehca_gen_err("DMEM operations are not allowed"
+-					     "as long as an ehca adapter is"
+-					     "attached to the LPAR");
+-			return NOTIFY_BAD;
+-		}
+-	}
+-	return NOTIFY_OK;
+-}
+-
+-static struct notifier_block ehca_mem_nb = {
+-	.notifier_call = ehca_mem_notifier,
+-};
+-
+ static int __init ehca_module_init(void)
+ {
+ 	int ret;
+@@ -1033,12 +996,6 @@ static int __init ehca_module_init(void)
+ 		goto module_init2;
+ 	}
+ 
+-	ret = register_memory_notifier(&ehca_mem_nb);
+-	if (ret) {
+-		ehca_gen_err("Failed registering memory add/remove notifier");
+-		goto module_init3;
+-	}
+-
+ 	if (ehca_poll_all_eqs != 1) {
+ 		ehca_gen_err("WARNING!!!");
+ 		ehca_gen_err("It is possible to lose interrupts.");
+@@ -1051,9 +1008,6 @@ static int __init ehca_module_init(void)
+ 
+ 	return 0;
+ 
+-module_init3:
+-	ibmebus_unregister_driver(&ehca_driver);
+-
+ module_init2:
+ 	ehca_destroy_slab_caches();
+ 
+@@ -1069,8 +1023,6 @@ static void __exit ehca_module_exit(void)
+ 
+ 	ibmebus_unregister_driver(&ehca_driver);
+ 
+-	unregister_memory_notifier(&ehca_mem_nb);
+-
+ 	ehca_destroy_slab_caches();
+ 
+ 	ehca_destroy_comp_pool();
+-- 
+1.5.5
+






More information about the ewg mailing list