From: Petr Machata <petrm@nvidia.com>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: Petr Machata <petrm@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>, <netdev@vger.kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net-next 0/4] Allow configuration of multipath hash seed
Date: Mon, 3 Jun 2024 11:21:47 +0200 [thread overview]
Message-ID: <871q5e9xd0.fsf@nvidia.com> (raw)
In-Reply-To: <b4818488-a315-43bf-86bc-85cd6b854f0a@blackwall.org>
Nikolay Aleksandrov <razor@blackwall.org> writes:
> On 5/30/24 21:07, Nikolay Aleksandrov wrote:
>> On 5/30/24 20:27, Nikolay Aleksandrov wrote:
>>> On 5/30/24 18:25, Petr Machata wrote:
>>>>
>>>> I kept the RCU stuff in because it makes it easy to precompute the
>>>> siphash key while allowing readers to access it lock-free. I could
>>>> inline it and guard with a seqlock instead, but that's a bit messier
>>>> code-wise. Or indeed construct in-situ, it's an atomic access plus like
>>>> four instructions or something like that.
>>>
>>> You can READ/WRITE_ONCE() the full 8 bytes every time so it's lock-free
>>> and consistent view of both values for observers. For fast-path it'll
>>> only be accessing one of the two values, so it's fine either way. You
>>> can use barriers to ensure latest value is seen by interested readers,
>>> but for most eventual consistency would be enough.
>>
>> Actually aren't we interested only in user_seed in the external reader
>> case? We don't care what's in mp_seed, so this is much simpler.
>
> Oh, I misunderstood you, didn't I? :) Were you talking about
> constructing the siphash key in the fast-path above? If yes,
> then sure it's a few instructions but nothing conditional.
That's what I meant. I tried to be concise and went overboard.
> I don't think we need anything atomic in that case.
Hmm, right, no competing increments of any sort, so WRITE_ONCE in the
control path and READ_ONCE in fastpath should be enough.
Thanks for the feedback, I'll send v2 this week.
prev parent reply other threads:[~2024-06-03 9:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 11:18 [PATCH net-next 0/4] Allow configuration of multipath hash seed Petr Machata
2024-05-29 11:18 ` [PATCH net-next 1/4] net: ipv4,ipv6: Pass multipath hash computation through a helper Petr Machata
2024-05-29 11:18 ` [PATCH net-next 2/4] net: ipv4: Add a sysctl to set multipath hash seed Petr Machata
2024-05-31 1:00 ` Jakub Kicinski
2024-06-02 11:15 ` Ido Schimmel
2024-06-03 6:51 ` Nicolas Dichtel
2024-06-03 9:51 ` Petr Machata
2024-06-03 11:37 ` Petr Machata
2024-06-01 8:46 ` Eric Dumazet
2024-06-03 7:29 ` Toke Høiland-Jørgensen
2024-06-03 8:25 ` Eric Dumazet
2024-06-03 8:58 ` Toke Høiland-Jørgensen
2024-06-03 13:53 ` Paul E. McKenney
2024-06-03 9:50 ` Petr Machata
2024-05-29 11:18 ` [PATCH net-next 3/4] mlxsw: spectrum_router: Apply user-defined " Petr Machata
2024-05-29 11:18 ` [PATCH net-next 4/4] selftests: forwarding: router_mpath_hash: Add a new selftest Petr Machata
2024-05-29 19:57 ` [PATCH net-next 0/4] Allow configuration of multipath hash seed Nikolay Aleksandrov
2024-05-30 15:25 ` Petr Machata
2024-05-30 17:27 ` Nikolay Aleksandrov
2024-05-30 18:07 ` Nikolay Aleksandrov
2024-05-30 21:34 ` Nikolay Aleksandrov
2024-06-03 9:21 ` Petr Machata [this message]
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=871q5e9xd0.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).