diff options
| author | Doug Ledford <dledford@redhat.com> | 2014-12-10 11:47:04 -0500 |
|---|---|---|
| committer | Roland Dreier <roland@purestorage.com> | 2014-12-15 21:11:15 -0500 |
| commit | bb42a6dd02fb2901a69dbec2358810735b14b186 (patch) | |
| tree | 01625ffe9753bd7278172bda89b63f750429020e | |
| parent | 5141861cd5e17eac9676ff49c5abfafbea2b0e98 (diff) | |
IPoIB: Make ipoib_mcast_stop_thread flush the workqueue
We used to pass a flush variable to mcast_stop_thread to indicate if
we should flush the workqueue or not. This was due to some code
trying to flush a workqueue that it was currently running on which is
a no-no. Now that we have per-device work queues, and now that
ipoib_mcast_restart_task has taken the fact that it is queued on a
single thread workqueue with all of the ipoib_mcast_join_task's and
therefore has no need to stop the join task while it runs, we can do
away with the flush parameter and unilaterally flush always.
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib.h | 2 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 4 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 21 |
3 files changed, 12 insertions, 15 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 45fd10a72ec1..28dc927c0e8b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
| @@ -499,7 +499,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb); | |||
| 499 | 499 | ||
| 500 | void ipoib_mcast_restart_task(struct work_struct *work); | 500 | void ipoib_mcast_restart_task(struct work_struct *work); |
| 501 | int ipoib_mcast_start_thread(struct net_device *dev); | 501 | int ipoib_mcast_start_thread(struct net_device *dev); |
| 502 | int ipoib_mcast_stop_thread(struct net_device *dev, int flush); | 502 | int ipoib_mcast_stop_thread(struct net_device *dev); |
| 503 | 503 | ||
| 504 | void ipoib_mcast_dev_down(struct net_device *dev); | 504 | void ipoib_mcast_dev_down(struct net_device *dev); |
| 505 | void ipoib_mcast_dev_flush(struct net_device *dev); | 505 | void ipoib_mcast_dev_flush(struct net_device *dev); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index bfd17d41b5f2..660967871191 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -747,7 +747,7 @@ int ipoib_ib_dev_down(struct net_device *dev, int flush) | |||
| 747 | clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | 747 | clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); |
| 748 | netif_carrier_off(dev); | 748 | netif_carrier_off(dev); |
| 749 | 749 | ||
| 750 | ipoib_mcast_stop_thread(dev, flush); | 750 | ipoib_mcast_stop_thread(dev); |
| 751 | ipoib_mcast_dev_flush(dev); | 751 | ipoib_mcast_dev_flush(dev); |
| 752 | 752 | ||
| 753 | ipoib_flush_paths(dev); | 753 | ipoib_flush_paths(dev); |
| @@ -1097,7 +1097,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev) | |||
| 1097 | */ | 1097 | */ |
| 1098 | ipoib_flush_paths(dev); | 1098 | ipoib_flush_paths(dev); |
| 1099 | 1099 | ||
| 1100 | ipoib_mcast_stop_thread(dev, 1); | 1100 | ipoib_mcast_stop_thread(dev); |
| 1101 | ipoib_mcast_dev_flush(dev); | 1101 | ipoib_mcast_dev_flush(dev); |
| 1102 | 1102 | ||
| 1103 | ipoib_transport_dev_cleanup(dev); | 1103 | ipoib_transport_dev_cleanup(dev); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 845f910eb214..bc50dd0d0e4d 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
| @@ -648,7 +648,7 @@ int ipoib_mcast_start_thread(struct net_device *dev) | |||
| 648 | return 0; | 648 | return 0; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | int ipoib_mcast_stop_thread(struct net_device *dev, int flush) | 651 | int ipoib_mcast_stop_thread(struct net_device *dev) |
| 652 | { | 652 | { |
| 653 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 653 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 654 | 654 | ||
| @@ -659,8 +659,7 @@ int ipoib_mcast_stop_thread(struct net_device *dev, int flush) | |||
| 659 | cancel_delayed_work(&priv->mcast_task); | 659 | cancel_delayed_work(&priv->mcast_task); |
| 660 | mutex_unlock(&mcast_mutex); | 660 | mutex_unlock(&mcast_mutex); |
| 661 | 661 | ||
| 662 | if (flush) | 662 | flush_workqueue(priv->wq); |
| 663 | flush_workqueue(priv->wq); | ||
| 664 | 663 | ||
| 665 | return 0; | 664 | return 0; |
| 666 | } | 665 | } |
| @@ -838,8 +837,6 @@ void ipoib_mcast_restart_task(struct work_struct *work) | |||
| 838 | 837 | ||
| 839 | ipoib_dbg_mcast(priv, "restarting multicast task\n"); | 838 | ipoib_dbg_mcast(priv, "restarting multicast task\n"); |
| 840 | 839 | ||
| 841 | ipoib_mcast_stop_thread(dev, 0); | ||
| 842 | |||
| 843 | local_irq_save(flags); | 840 | local_irq_save(flags); |
| 844 | netif_addr_lock(dev); | 841 | netif_addr_lock(dev); |
| 845 | spin_lock(&priv->lock); | 842 | spin_lock(&priv->lock); |
| @@ -936,13 +933,10 @@ void ipoib_mcast_restart_task(struct work_struct *work) | |||
| 936 | * We have to cancel outside of the spinlock, but we have to | 933 | * We have to cancel outside of the spinlock, but we have to |
| 937 | * take the rtnl lock or else we race with the removal of | 934 | * take the rtnl lock or else we race with the removal of |
| 938 | * entries from the remove list in mcast_dev_flush as part | 935 | * entries from the remove list in mcast_dev_flush as part |
| 939 | * of ipoib_stop() which will call mcast_stop_thread with | 936 | * of ipoib_stop(). We detect the drop of the ADMIN_UP flag |
| 940 | * flush == 1 while holding the rtnl lock, and the | 937 | * to signal that we have hit this particular race, and we |
| 941 | * flush_workqueue won't complete until this restart_mcast_task | 938 | * return since we know we don't need to do anything else |
| 942 | * completes. So do like the carrier on task and attempt to | 939 | * anyway. |
| 943 | * take the rtnl lock, but if we can't before the ADMIN_UP flag | ||
| 944 | * goes away, then just return and know that the remove list will | ||
| 945 | * get flushed later by mcast_stop_thread. | ||
| 946 | */ | 940 | */ |
| 947 | while (!rtnl_trylock()) { | 941 | while (!rtnl_trylock()) { |
| 948 | if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) | 942 | if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) |
| @@ -954,6 +948,9 @@ void ipoib_mcast_restart_task(struct work_struct *work) | |||
| 954 | ipoib_mcast_leave(mcast->dev, mcast); | 948 | ipoib_mcast_leave(mcast->dev, mcast); |
| 955 | ipoib_mcast_free(mcast); | 949 | ipoib_mcast_free(mcast); |
| 956 | } | 950 | } |
| 951 | /* | ||
| 952 | * Restart our join task if needed | ||
| 953 | */ | ||
| 957 | ipoib_mcast_start_thread(dev); | 954 | ipoib_mcast_start_thread(dev); |
| 958 | rtnl_unlock(); | 955 | rtnl_unlock(); |
| 959 | } | 956 | } |
