Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116839
b: refs/heads/master
c: 263c24a
h: refs/heads/master
i:
  116837: beb7fad
  116835: b730b02
  116831: 5cf17ee
v: v3
  • Loading branch information
Stefan Roscher authored and Roland Dreier committed Oct 22, 2008
1 parent 05f2b40 commit ff83631
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19f4282149147b4a3e8c670373dc73ddd5d5facc
refs/heads/master: 263c24a2bbbaca75805ed231e8346d86410af9d0
48 changes: 48 additions & 0 deletions trunk/drivers/infiniband/hw/ehca/ehca_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#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"
Expand Down Expand Up @@ -969,6 +971,41 @@ 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;
Expand Down Expand Up @@ -996,6 +1033,12 @@ 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.");
Expand All @@ -1008,6 +1051,9 @@ static int __init ehca_module_init(void)

return 0;

module_init3:
ibmebus_unregister_driver(&ehca_driver);

module_init2:
ehca_destroy_slab_caches();

Expand All @@ -1023,6 +1069,8 @@ 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();
Expand Down

0 comments on commit ff83631

Please sign in to comment.