From: Tobias Waldekranz <tobias@waldekranz•com>
To: Vladimir Oltean <olteanv@gmail•com>
Cc: davem@davemloft•net, kuba@kernel•org, andrew@lunn•ch,
vivien.didelot@gmail•com, f.fainelli@gmail•com,
j.vosburgh@gmail•com, vfalico@gmail•com, andy@greyhouse•net,
netdev@vger•kernel.org
Subject: Re: [PATCH v2 net-next 2/4] net: dsa: Link aggregation support
Date: Tue, 01 Dec 2020 09:13:57 +0100 [thread overview]
Message-ID: <87czzu7xkq.fsf@waldekranz.com> (raw)
In-Reply-To: <20201201013706.6clgrx2tnapywgxf@skbuf>
On Tue, Dec 01, 2020 at 03:37, Vladimir Oltean <olteanv@gmail•com> wrote:
> On Mon, Nov 30, 2020 at 03:06:08PM +0100, Tobias Waldekranz wrote:
>> +static void dsa_lag_release(struct kref *refcount)
>> +{
>> + struct dsa_lag *lag = container_of(refcount, struct dsa_lag, refcount);
>> +
>> + rcu_assign_pointer(lag->dev, NULL);
>> + synchronize_rcu();
>> + memset(lag, 0, sizeof(*lag));
>> +}
>
> What difference does it make if lag->dev is set to NULL right away or
> after a grace period? Squeezing one last packet from that bonding interface?
> Pointer updates are atomic operations on all architectures that the
> kernel supports, and, as long as you use WRITE_ONCE and READ_ONCE memory
> barriers, there should be no reason for RCU protection that I can see.
> And unlike typical uses of RCU, you do not free lag->dev, because you do
> not own lag->dev. Instead, the bonding interface pointed to by lag->dev
> is going to be freed (in case of a deletion using ip link) after an RCU
> grace period anyway. And the receive data path is under an RCU read-side
> critical section anyway. So even if you set lag->dev to NULL using
> WRITE_ONCE, the existing in-flight readers from the RX data path that
> had called dsa_lag_dev_by_id() will still hold a reference to a valid
> bonding interface.
I completely agree with your analysis. I will remove all the RCU
primitives in v3. Thank you.
next prev parent reply other threads:[~2020-12-01 8:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 14:06 [PATCH v2 net-next 0/4] net: dsa: Link aggregation support Tobias Waldekranz
2020-11-30 14:06 ` [PATCH v2 net-next 1/4] net: bonding: Notify ports about their initial state Tobias Waldekranz
2020-11-30 14:06 ` [PATCH v2 net-next 2/4] net: dsa: Link aggregation support Tobias Waldekranz
2020-12-01 1:37 ` Vladimir Oltean
2020-12-01 8:13 ` Tobias Waldekranz [this message]
2020-12-01 13:29 ` Vladimir Oltean
2020-12-01 14:22 ` Tobias Waldekranz
2020-12-01 14:03 ` Vladimir Oltean
2020-12-01 14:29 ` Tobias Waldekranz
2020-12-01 20:04 ` Vladimir Oltean
2020-12-01 21:48 ` Tobias Waldekranz
2020-12-01 22:23 ` Vladimir Oltean
2020-11-30 14:06 ` [PATCH v2 net-next 3/4] net: dsa: mv88e6xxx: " Tobias Waldekranz
2020-11-30 14:06 ` [PATCH v2 net-next 4/4] net: dsa: tag_dsa: Support reception of packets from LAG devices Tobias Waldekranz
2020-12-01 21:24 ` Vladimir Oltean
2020-12-01 22:31 ` Tobias Waldekranz
2020-12-02 0:33 ` Vladimir Oltean
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=87czzu7xkq.fsf@waldekranz.com \
--to=tobias@waldekranz$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=andy@greyhouse$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=f.fainelli@gmail$(echo .)com \
--cc=j.vosburgh@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=olteanv@gmail$(echo .)com \
--cc=vfalico@gmail$(echo .)com \
--cc=vivien.didelot@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox