From: Erez Shitrit <erezsh-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: Or Gerlitz <gerlitz.or-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 09/22] IB/ipoib: fix IPOIB_MCAST_RUN flag usage
Date: Fri, 13 Feb 2015 10:50:00 +0200 [thread overview]
Message-ID: <54DDBAB8.10002@dev.mellanox.co.il> (raw)
In-Reply-To: <73f38862d167a9849482464519c04b7c1f0a8b7c.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 2/12/2015 3:43 AM, Doug Ledford wrote:
> The usage of IPOIB_MCAST_RUN as a flag is inconsistent. In some places
> it is used to mean "our device is administratively allowed to send
> multicast joins/leaves/packets" and in other places it means "our
> multicast join task thread is currently running and will process your
> request if you put it on the queue". However, this latter meaning is in
> fact flawed as there is a race condition between the join task testing
> the mcast list and finding it empty of remaining work, dropping the
> mcast mutex and also the priv->lock spinlock, and clearing the
> IPOIB_MCAST_RUN flag. Further, there are numerous locations that use
> the flag in the former fashion, and when all tasks complete and the task
> thread clears the RUN flag, all of those other locations will fail to
> ever again queue any work. This results in the interface coming up fine
> initially, but having problems adding new multicast groups after the
> first round of groups have all been added and the RUN flag is cleared by
> the join task thread when it thinks it is done. To resolve this issue,
> convert all locations in the code to treat the RUN flag as an indicator
> that the multicast portion of this interface is in fact administratively
> up and joins/leaves/sends can be performed. There is no harm (other
> than a slight performance penalty) to never clearing this flag and using
> it in this fashion as it simply means that a few places that used to
> micro-optimize how often this task was queued on a work queue will now
> queue the task a few extra times. We can address that suboptimal
> behavior in future patches.
>
> Signed-off-by: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> index bc50dd0d0e4..91b8fe118ec 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> @@ -630,8 +630,6 @@ void ipoib_mcast_join_task(struct work_struct *work)
> }
>
> ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");
> -
> - clear_bit(IPOIB_MCAST_RUN, &priv->flags);
> }
>
> int ipoib_mcast_start_thread(struct net_device *dev)
> @@ -641,8 +639,8 @@ int ipoib_mcast_start_thread(struct net_device *dev)
> ipoib_dbg_mcast(priv, "starting multicast thread\n");
>
> mutex_lock(&mcast_mutex);
> - if (!test_and_set_bit(IPOIB_MCAST_RUN, &priv->flags))
> - queue_delayed_work(priv->wq, &priv->mcast_task, 0);
> + set_bit(IPOIB_MCAST_RUN, &priv->flags);
Hi Doug,
Can you use IPOIB_FLAG_OPER_UP instead of IPOIB_MCAST_RUN, in all these
places and get rid of that RUN bit?
> + queue_delayed_work(priv->wq, &priv->mcast_task, 0);
> mutex_unlock(&mcast_mutex);
>
> return 0;
> @@ -725,7 +723,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb)
> memcpy(mcast->mcmember.mgid.raw, mgid, sizeof (union ib_gid));
> __ipoib_mcast_add(dev, mcast);
> list_add_tail(&mcast->list, &priv->multicast_list);
> - if (!test_and_set_bit(IPOIB_MCAST_RUN, &priv->flags))
> + if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
> queue_delayed_work(priv->wq, &priv->mcast_task, 0);
> }
>
> @@ -951,7 +949,8 @@ void ipoib_mcast_restart_task(struct work_struct *work)
> /*
> * Restart our join task if needed
> */
> - ipoib_mcast_start_thread(dev);
> + if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
> + queue_delayed_work(priv->wq, &priv->mcast_task, 0);
> rtnl_unlock();
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-02-13 8:50 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 1:43 [PATCH 00/22] IB/ipoib: Fixups for multicast issues Doug Ledford
[not found] ` <cover.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 1:43 ` [PATCH 01/22] IB/ipoib: Consolidate rtnl_lock tasks in workqueue Doug Ledford
2015-02-12 1:43 ` [PATCH 02/22] IB/ipoib: Make the carrier_on_task race aware Doug Ledford
2015-02-12 1:43 ` [PATCH 03/22] IB/ipoib: fix MCAST_FLAG_BUSY usage Doug Ledford
2015-02-12 1:43 ` [PATCH 04/22] IB/ipoib: fix mcast_dev_flush/mcast_restart_task race Doug Ledford
2015-02-12 1:43 ` [PATCH 05/22] IB/ipoib: change init sequence ordering Doug Ledford
2015-02-12 1:43 ` [PATCH 06/22] IB/ipoib: Use dedicated workqueues per interface Doug Ledford
2015-02-12 1:43 ` [PATCH 07/22] IB/ipoib: Make ipoib_mcast_stop_thread flush the workqueue Doug Ledford
2015-02-12 1:43 ` [PATCH 08/22] IB/ipoib: No longer use flush as a parameter Doug Ledford
2015-02-12 1:43 ` [PATCH 09/22] IB/ipoib: fix IPOIB_MCAST_RUN flag usage Doug Ledford
[not found] ` <73f38862d167a9849482464519c04b7c1f0a8b7c.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-13 8:50 ` Erez Shitrit [this message]
[not found] ` <54DDBAB8.10002-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-02-13 13:30 ` Doug Ledford
2015-02-12 1:43 ` [PATCH 10/22] IB/ipoib: Add a helper to restart the multicast task Doug Ledford
2015-02-12 1:43 ` [PATCH 11/22] IB/ipoib: make delayed tasks not hold up everything Doug Ledford
2015-02-12 1:43 ` [PATCH 12/22] IB/ipoib: Handle -ENETRESET properly in our callback Doug Ledford
2015-02-12 1:43 ` [PATCH 13/22] IB/ipoib: don't restart our thread on ENETRESET Doug Ledford
2015-02-12 1:43 ` [PATCH 14/22] IB/ipoib: remove unneeded locks Doug Ledford
[not found] ` <3cd3c664adb2877317c8f684ee344749b2915e45.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-13 16:59 ` Or Gerlitz
2015-02-12 1:43 ` [PATCH 15/22] IB/ipoib: fix race between mcast_dev_flush and mcast_join Doug Ledford
2015-02-12 1:43 ` [PATCH 16/22] IB/ipoib: fix ipoib_mcast_restart_task Doug Ledford
2015-02-12 1:43 ` [PATCH 17/22] IB/ipoib: flush the ipoib_workqueue on unregister Doug Ledford
2015-02-12 1:43 ` [PATCH 18/22] IB/ipoib: cleanup a couple debug messages Doug Ledford
[not found] ` <7aeffef3862526da5a472c15f94564897a4d7537.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-13 16:40 ` Or Gerlitz
[not found] ` <CAJ3xEMi2yvaL6QGPFXDcJavnnw4Lxk64bdkZnm--FE8NiKQmbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-13 17:21 ` Doug Ledford
2015-02-12 1:43 ` [PATCH 19/22] IB/ipoib: make sure we reap all our ah on shutdown Doug Ledford
[not found] ` <14ee2e7737123c7d37465ac52be5c026240c9985.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 18:35 ` Or Gerlitz
2015-02-12 1:43 ` [PATCH 20/22] IB/ipoib: don't queue a work struct up twice Doug Ledford
[not found] ` <30a5bd6461381448c52af0d7408dbc14da9ac4d0.1423703861.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 18:33 ` Or Gerlitz
[not found] ` <54DCF20C.3040704-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-02-12 19:47 ` Doug Ledford
[not found] ` <1423770436.3387.4.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 21:35 ` Or Gerlitz
2015-02-12 1:43 ` [PATCH 21/22] IB/ipoib: deserialize multicast joins Doug Ledford
2015-02-12 1:43 ` [PATCH 22/22] IB/ipoib: drop mcast_mutex usage Doug Ledford
2015-02-12 4:46 ` [PATCH 00/22] IB/ipoib: Fixups for multicast issues Or Gerlitz
[not found] ` <54DC303C.2020207-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-02-12 4:55 ` Doug Ledford
[not found] ` <1423716906.3424.74.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-12 5:25 ` Or Gerlitz
[not found] ` <54DC3934.3010401-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-02-12 14:02 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DDBAB8.10002@dev.mellanox.co.il \
--to=erezsh-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=gerlitz.or-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.