[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2ccea8e0-e36e-a53a-2d30-9ce1bcdb873f@linux.dev>
Date: Fri, 26 May 2023 14:08:48 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: andrii@...nel.org, ast@...nel.org, bpf@...r.kernel.org,
daniel@...earbox.net, davem@...emloft.net, dsahern@...nel.org,
edumazet@...gle.com, haoluo@...gle.com, joe@...ium.io,
joe@...d.net.nz, john.fastabend@...il.com, jolsa@...nel.org,
kafai@...com, kpsingh@...nel.org, kuba@...nel.org,
linux-kernel@...r.kernel.org, lmb@...valent.com,
netdev@...r.kernel.org, pabeni@...hat.com, sdf@...gle.com,
song@...nel.org, willemdebruijn.kernel@...il.com, yhs@...com
Subject: Re: [PATCH bpf-next 1/2] bpf, net: Support SO_REUSEPORT sockets with
bpf_sk_assign
On 5/25/23 7:49 PM, Kuniyuki Iwashima wrote:
>> We may want to use rcu_access_pointer(sk->sk_reuseport_cb) in
>> each lookup_reuseport() instead of adding sk_state check ?
> And if someone has a weird program that creates multiple listeners and
> disable SO_REUSEPORT for a listener that hits first in lhash2, checking
> sk_reuseport_cb might not work ?
I am also not sure what the correct expectation is if the application disable
SO_REUSEPORT in a sk after bind(). This is not something new or specific from
the current patch though.
> I hope no one does such though, checking sk_reuseport
> and sk_state could be better.
My previous comment on checking sk_state is to avoid the unnecessary
inet_ehashfn() for the TCP_ESTABLISHED sk. Checking sk_reuseport_cb could also
work since it should be NULL for established sk. However, not sure if it could
be another cacheline access. The udp one is checking the sk_state also:
"sk->sk_reuseport && sk->sk_state != TCP_ESTABLISHED".
Powered by blists - more mailing lists