All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@mellanox.com>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org,
	Nikolay Aleksandrov <razor@blackwall.org>,
	shm@cumulusnetworks.com, davem@davemloft.net,
	roopa@cumulusnetworks.com
Subject: Re: [Bridge] [PATCH net-next 3/4] bridge: vlan: break vlan_flush in two phases to keep old order
Date: Mon, 12 Oct 2015 21:15:48 +0300	[thread overview]
Message-ID: <20151012181548.GA17061@colbert.mtl.com> (raw)
In-Reply-To: <561BF413.5010609@cumulusnetworks.com>

Mon, Oct 12, 2015 at 08:55:31PM IDT, nikolay@cumulusnetworks.com wrote:
>On 10/12/2015 07:39 PM, Ido Schimmel wrote:
>> Mon, Oct 12, 2015 at 02:41:08PM IDT, razor@blackwall.org wrote:
>>> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>>>
>> Hi,
>> 
>>> Ido Schimmel reported a problem with switchdev devices because of the
>>> order change of del_nbp operations, more specifically the move of
>>> nbp_vlan_flush() which deletes all vlans and frees vlgrp after the
>>> rx_handler has been unregistered. So in order to fix this break
>>> vlan_flush in two phases:
>>> 1. delete all of vlan_group's vlans
>>> 2. destroy rhtable and free vlgrp
>>> We execute phase I (free_rht == false) in the same place as before so the
>>> vlans can be cleared and free the vlgrp after the rx_handler has been
>>> unregistered in phase II (free_rht == true).
>> I don't fully understand the reason for the two-phase cleanup. Please
>> see below.
>>>
>>> Reported-by: Ido Schimmel <idosch@mellanox.com>
>>> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>>> ---
>>> Ido: I hope this fixes it for your case, a test would be much appreciated.
>> This indeed fixes our switchdev issue. Thanks for the fix!
>>>
>[snip]
>>>
>>> -static void __vlan_flush(struct net_bridge_vlan_group *vlgrp)
>>> +static void __vlan_flush(struct net_bridge_vlan_group *vlgrp, bool free_rht)
>>> {
>>> 	struct net_bridge_vlan *vlan, *tmp;
>>>
>>> 	__vlan_delete_pvid(vlgrp, vlgrp->pvid);
>>> 	list_for_each_entry_safe(vlan, tmp, &vlgrp->vlan_list, vlist)
>>> 		__vlan_del(vlan);
>>> -	rhashtable_destroy(&vlgrp->vlan_hash);
>>> -	kfree_rcu(vlgrp, rcu);
>>> +
>> Why not just issue a synchronize_rcu here and remove the if statement? I
>> believe that would also be better for when we remove the bridge device
>> itself. It's fully symmetric with init that way.
>Hi,
>I considered that, but I don't want to issue a second synchronize_rcu() for each
>port when deleting them, with this change we avoid a second synchronize_rcu()
>and use the rx_handler unregister one. In complex setups with lots of ports
>this is a considerable overhead.
Yep, I assumed that was the reason.
>For the bridge device del case - the call is the same, there're no two phases
>there.
I know, but wouldn't it be a problem to delete the rhashtable in case of
a bridge? You don't have a synchronize_rcu just before as with ports or
are you relying on the kfree_rcu(masterv, rcu) in br_vlan_put_master?

It's probably a non-issue, but I want to make sure I'm not missing
something.

Thanks.
>
>Cheers,
> Nik

WARNING: multiple messages have this Message-ID (diff)
From: Ido Schimmel <idosch@mellanox.com>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Cc: Nikolay Aleksandrov <razor@blackwall.org>,
	<netdev@vger.kernel.org>, <shm@cumulusnetworks.com>,
	<roopa@cumulusnetworks.com>, <stephen@networkplumber.org>,
	<bridge@lists.linux-foundation.org>, <davem@davemloft.net>
Subject: Re: [PATCH net-next 3/4] bridge: vlan: break vlan_flush in two phases to keep old order
Date: Mon, 12 Oct 2015 21:15:48 +0300	[thread overview]
Message-ID: <20151012181548.GA17061@colbert.mtl.com> (raw)
In-Reply-To: <561BF413.5010609@cumulusnetworks.com>

Mon, Oct 12, 2015 at 08:55:31PM IDT, nikolay@cumulusnetworks.com wrote:
>On 10/12/2015 07:39 PM, Ido Schimmel wrote:
>> Mon, Oct 12, 2015 at 02:41:08PM IDT, razor@blackwall.org wrote:
>>> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>>>
>> Hi,
>> 
>>> Ido Schimmel reported a problem with switchdev devices because of the
>>> order change of del_nbp operations, more specifically the move of
>>> nbp_vlan_flush() which deletes all vlans and frees vlgrp after the
>>> rx_handler has been unregistered. So in order to fix this break
>>> vlan_flush in two phases:
>>> 1. delete all of vlan_group's vlans
>>> 2. destroy rhtable and free vlgrp
>>> We execute phase I (free_rht == false) in the same place as before so the
>>> vlans can be cleared and free the vlgrp after the rx_handler has been
>>> unregistered in phase II (free_rht == true).
>> I don't fully understand the reason for the two-phase cleanup. Please
>> see below.
>>>
>>> Reported-by: Ido Schimmel <idosch@mellanox.com>
>>> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>>> ---
>>> Ido: I hope this fixes it for your case, a test would be much appreciated.
>> This indeed fixes our switchdev issue. Thanks for the fix!
>>>
>[snip]
>>>
>>> -static void __vlan_flush(struct net_bridge_vlan_group *vlgrp)
>>> +static void __vlan_flush(struct net_bridge_vlan_group *vlgrp, bool free_rht)
>>> {
>>> 	struct net_bridge_vlan *vlan, *tmp;
>>>
>>> 	__vlan_delete_pvid(vlgrp, vlgrp->pvid);
>>> 	list_for_each_entry_safe(vlan, tmp, &vlgrp->vlan_list, vlist)
>>> 		__vlan_del(vlan);
>>> -	rhashtable_destroy(&vlgrp->vlan_hash);
>>> -	kfree_rcu(vlgrp, rcu);
>>> +
>> Why not just issue a synchronize_rcu here and remove the if statement? I
>> believe that would also be better for when we remove the bridge device
>> itself. It's fully symmetric with init that way.
>Hi,
>I considered that, but I don't want to issue a second synchronize_rcu() for each
>port when deleting them, with this change we avoid a second synchronize_rcu()
>and use the rx_handler unregister one. In complex setups with lots of ports
>this is a considerable overhead.
Yep, I assumed that was the reason.
>For the bridge device del case - the call is the same, there're no two phases
>there.
I know, but wouldn't it be a problem to delete the rhashtable in case of
a bridge? You don't have a synchronize_rcu just before as with ports or
are you relying on the kfree_rcu(masterv, rcu) in br_vlan_put_master?

It's probably a non-issue, but I want to make sure I'm not missing
something.

Thanks.
>
>Cheers,
> Nik

  reply	other threads:[~2015-10-12 18:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 11:41 [Bridge] [PATCH net-next 0/4] bridge: vlan: cleanups & fixes (part 3) Nikolay Aleksandrov
2015-10-12 11:41 ` Nikolay Aleksandrov
2015-10-12 11:41 ` [Bridge] [PATCH net-next 1/4] bridge: vlan: use proper rcu for the vlgrp member Nikolay Aleksandrov
2015-10-12 11:41   ` Nikolay Aleksandrov
2015-10-12 17:29   ` [Bridge] " Ido Schimmel
2015-10-12 17:29     ` Ido Schimmel
2015-10-12 11:41 ` [Bridge] [PATCH net-next 2/4] bridge: vlan: use rcu for vlan_list traversal in br_fill_ifinfo Nikolay Aleksandrov
2015-10-12 11:41   ` Nikolay Aleksandrov
2015-10-12 11:41 ` [Bridge] [PATCH net-next 3/4] bridge: vlan: break vlan_flush in two phases to keep old order Nikolay Aleksandrov
2015-10-12 11:41   ` Nikolay Aleksandrov
2015-10-12 17:39   ` [Bridge] " Ido Schimmel
2015-10-12 17:39     ` Ido Schimmel
2015-10-12 17:55     ` [Bridge] " Nikolay Aleksandrov
2015-10-12 17:55       ` Nikolay Aleksandrov
2015-10-12 18:15       ` Ido Schimmel [this message]
2015-10-12 18:15         ` Ido Schimmel
2015-10-12 18:16       ` [Bridge] " Nikolay Aleksandrov
2015-10-12 18:16         ` Nikolay Aleksandrov
2015-10-12 11:41 ` [Bridge] [PATCH net-next 4/4] bridge: vlan: combine (br|nbp)_vlan_flush into one Nikolay Aleksandrov
2015-10-12 11:41   ` Nikolay Aleksandrov
2015-10-12 17:51   ` [Bridge] " Ido Schimmel
2015-10-12 17:51     ` Ido Schimmel
2015-10-12 18:15     ` [Bridge] " Vivien Didelot
2015-10-12 18:15       ` Vivien Didelot
2015-10-12 18:27       ` [Bridge] " Ido Schimmel
2015-10-12 18:27         ` Ido Schimmel
2015-10-12 19:49         ` [Bridge] " Vivien Didelot
2015-10-12 19:49           ` Vivien Didelot
2015-10-13  6:41     ` [Bridge] " Scott Feldman
2015-10-13  6:41       ` Scott Feldman

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=20151012181548.GA17061@colbert.mtl.com \
    --to=idosch@mellanox.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=razor@blackwall.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=shm@cumulusnetworks.com \
    /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.