Commit 75c21ae9 authored by Joachim Fenkes's avatar Joachim Fenkes Committed by Roland Dreier

IB/ehca: Fix locking for shca_list_lock

shca_list_lock is taken from softirq context in ehca_poll_eqs, so we
need to lock IRQ safe elsewhere.  Found by lockdep.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 061e41fd
...@@ -717,6 +717,7 @@ static int __devinit ehca_probe(struct of_device *dev, ...@@ -717,6 +717,7 @@ static int __devinit ehca_probe(struct of_device *dev,
const u64 *handle; const u64 *handle;
struct ib_pd *ibpd; struct ib_pd *ibpd;
int ret, i, eq_size; int ret, i, eq_size;
unsigned long flags;
handle = of_get_property(dev->node, "ibm,hca-handle", NULL); handle = of_get_property(dev->node, "ibm,hca-handle", NULL);
if (!handle) { if (!handle) {
...@@ -830,9 +831,9 @@ static int __devinit ehca_probe(struct of_device *dev, ...@@ -830,9 +831,9 @@ static int __devinit ehca_probe(struct of_device *dev,
ehca_err(&shca->ib_device, ehca_err(&shca->ib_device,
"Cannot create device attributes ret=%d", ret); "Cannot create device attributes ret=%d", ret);
spin_lock(&shca_list_lock); spin_lock_irqsave(&shca_list_lock, flags);
list_add(&shca->shca_list, &shca_list); list_add(&shca->shca_list, &shca_list);
spin_unlock(&shca_list_lock); spin_unlock_irqrestore(&shca_list_lock, flags);
return 0; return 0;
...@@ -878,6 +879,7 @@ static int __devinit ehca_probe(struct of_device *dev, ...@@ -878,6 +879,7 @@ static int __devinit ehca_probe(struct of_device *dev,
static int __devexit ehca_remove(struct of_device *dev) static int __devexit ehca_remove(struct of_device *dev)
{ {
struct ehca_shca *shca = dev->dev.driver_data; struct ehca_shca *shca = dev->dev.driver_data;
unsigned long flags;
int ret; int ret;
sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp); sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp);
...@@ -915,9 +917,9 @@ static int __devexit ehca_remove(struct of_device *dev) ...@@ -915,9 +917,9 @@ static int __devexit ehca_remove(struct of_device *dev)
ib_dealloc_device(&shca->ib_device); ib_dealloc_device(&shca->ib_device);
spin_lock(&shca_list_lock); spin_lock_irqsave(&shca_list_lock, flags);
list_del(&shca->shca_list); list_del(&shca->shca_list);
spin_unlock(&shca_list_lock); spin_unlock_irqrestore(&shca_list_lock, flags);
return ret; return ret;
} }
...@@ -975,6 +977,7 @@ static int ehca_mem_notifier(struct notifier_block *nb, ...@@ -975,6 +977,7 @@ static int ehca_mem_notifier(struct notifier_block *nb,
unsigned long action, void *data) unsigned long action, void *data)
{ {
static unsigned long ehca_dmem_warn_time; static unsigned long ehca_dmem_warn_time;
unsigned long flags;
switch (action) { switch (action) {
case MEM_CANCEL_OFFLINE: case MEM_CANCEL_OFFLINE:
...@@ -985,12 +988,12 @@ static int ehca_mem_notifier(struct notifier_block *nb, ...@@ -985,12 +988,12 @@ static int ehca_mem_notifier(struct notifier_block *nb,
case MEM_GOING_ONLINE: case MEM_GOING_ONLINE:
case MEM_GOING_OFFLINE: case MEM_GOING_OFFLINE:
/* only ok if no hca is attached to the lpar */ /* only ok if no hca is attached to the lpar */
spin_lock(&shca_list_lock); spin_lock_irqsave(&shca_list_lock, flags);
if (list_empty(&shca_list)) { if (list_empty(&shca_list)) {
spin_unlock(&shca_list_lock); spin_unlock_irqrestore(&shca_list_lock, flags);
return NOTIFY_OK; return NOTIFY_OK;
} else { } else {
spin_unlock(&shca_list_lock); spin_unlock_irqrestore(&shca_list_lock, flags);
if (printk_timed_ratelimit(&ehca_dmem_warn_time, if (printk_timed_ratelimit(&ehca_dmem_warn_time,
30 * 1000)) 30 * 1000))
ehca_gen_err("DMEM operations are not allowed" ehca_gen_err("DMEM operations are not allowed"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment