Commit 099473c1 authored by Jan-Bernd Themann's avatar Jan-Bernd Themann Committed by David S. Miller

ehea: Fix kernel deadlock in DLPAR-mem processing

Port reset operations and memory add/remove operations need to
be serialized to avoid a kernel deadlock. The deadlock is caused
by calling the napi_disable() function twice.
Therefore we have to employ the dlpar_mem_lock in the ehea_reset_port
function as well
Signed-off-by: default avatarJan-Bernd Themann <themann@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a91fb143
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <asm/io.h> #include <asm/io.h>
#define DRV_NAME "ehea" #define DRV_NAME "ehea"
#define DRV_VERSION "EHEA_0103" #define DRV_VERSION "EHEA_0105"
/* eHEA capability flags */ /* eHEA capability flags */
#define DLPAR_PORT_ADD_REM 1 #define DLPAR_PORT_ADD_REM 1
......
...@@ -2860,6 +2860,7 @@ static void ehea_reset_port(struct work_struct *work) ...@@ -2860,6 +2860,7 @@ static void ehea_reset_port(struct work_struct *work)
container_of(work, struct ehea_port, reset_task); container_of(work, struct ehea_port, reset_task);
struct net_device *dev = port->netdev; struct net_device *dev = port->netdev;
mutex_lock(&dlpar_mem_lock);
port->resets++; port->resets++;
mutex_lock(&port->port_lock); mutex_lock(&port->port_lock);
netif_stop_queue(dev); netif_stop_queue(dev);
...@@ -2882,6 +2883,7 @@ static void ehea_reset_port(struct work_struct *work) ...@@ -2882,6 +2883,7 @@ static void ehea_reset_port(struct work_struct *work)
netif_wake_queue(dev); netif_wake_queue(dev);
out: out:
mutex_unlock(&port->port_lock); mutex_unlock(&port->port_lock);
mutex_unlock(&dlpar_mem_lock);
} }
static void ehea_rereg_mrs(struct work_struct *work) static void ehea_rereg_mrs(struct work_struct *work)
...@@ -3543,10 +3545,7 @@ static int ehea_mem_notifier(struct notifier_block *nb, ...@@ -3543,10 +3545,7 @@ static int ehea_mem_notifier(struct notifier_block *nb,
int ret = NOTIFY_BAD; int ret = NOTIFY_BAD;
struct memory_notify *arg = data; struct memory_notify *arg = data;
if (!mutex_trylock(&dlpar_mem_lock)) { mutex_lock(&dlpar_mem_lock);
ehea_info("ehea_mem_notifier must not be called parallelized");
goto out;
}
switch (action) { switch (action) {
case MEM_CANCEL_OFFLINE: case MEM_CANCEL_OFFLINE:
...@@ -3575,7 +3574,6 @@ static int ehea_mem_notifier(struct notifier_block *nb, ...@@ -3575,7 +3574,6 @@ static int ehea_mem_notifier(struct notifier_block *nb,
out_unlock: out_unlock:
mutex_unlock(&dlpar_mem_lock); mutex_unlock(&dlpar_mem_lock);
out:
return ret; return ret;
} }
......
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