From: Jason Xing <kerneljasonxing@gmail.com>
To: Zijie Zhao <zzjas98@gmail.com>
Cc: horms@verge.net.au, ja@ssi.bg, davem@davemloft.net,
dsahern@kernel.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
lvs-devel@vger.kernel.org, chenyuan0y@gmail.com
Subject: Re: [net] Question about ipvs->sysctl_sync_threshold and READ_ONCE
Date: Wed, 20 Mar 2024 10:41:44 +0800 [thread overview]
Message-ID: <CAL+tcoDA2Mf9oxAFsmbfM3JcdSb=Er09R1+=j7CLSpLVcxN38w@mail.gmail.com> (raw)
In-Reply-To: <5fde8ace-a0ac-4870-a7fe-ec2a24697112@gmail.com>
On Wed, Mar 20, 2024 at 6:49 AM Zijie Zhao <zzjas98@gmail.com> wrote:
>
> Dear IPVS maintainers,
>
> We encountered an unusual usage of sysctl parameter while analyzing
> kernel source code.
>
>
> In include/net/ip_vs.h, line 1062 - 1070:
>
> ```
> static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
> {
> return ipvs->sysctl_sync_threshold[0];
> }
>
> static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
> {
> return READ_ONCE(ipvs->sysctl_sync_threshold[1]);
> }
> ```
>
> Here, sysctl_sync_threshold[1] is accessed behind `READ_ONCE`, but
> sysctl_sync_threshold[0] is not. Should sysctl_sync_threshold[0] also be
> guarded by `READ_ONCE`?
I'm not so sure and clear about the detailed history.
AFAIK, readers accessing this sysctl knob (sysctl_sync_threshold)
should be protected by READ_ONCE() because it can be changed
concurrently. Probably the commit 749c42b620a95 missed this point many
years ago and then commit 6aa7de059173a followed that.
Thanks,
Jason
>
> Please kindly let us know if we missed any key information and this is
> actually intended. We appreciate your information and time! Thanks!
>
>
> Links to the code:
> https://elixir.bootlin.com/linux/v6.8.1/source/include/net/ip_vs.h#L1064
> https://elixir.bootlin.com/linux/v6.8.1/source/include/net/ip_vs.h#L1069
>
> Best,
> Zijie
>
next prev parent reply other threads:[~2024-03-20 2:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 22:49 [net] Question about ipvs->sysctl_sync_threshold and READ_ONCE Zijie Zhao
2024-03-20 2:41 ` Jason Xing [this message]
2024-03-20 18:03 ` Julian Anastasov
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='CAL+tcoDA2Mf9oxAFsmbfM3JcdSb=Er09R1+=j7CLSpLVcxN38w@mail.gmail.com' \
--to=kerneljasonxing@gmail.com \
--cc=chenyuan0y@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zzjas98@gmail.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 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).