[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220706161536.46956-1-kuniyu@amazon.com>
Date: Wed, 6 Jul 2022 09:15:36 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <edumazet@...gle.com>
CC: <davem@...emloft.net>, <keescook@...omium.org>, <kuba@...nel.org>,
<kuni1840@...il.com>, <kuniyu@...zon.com>,
<linux-kernel@...r.kernel.org>, <mcgrof@...nel.org>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>, <yzaikin@...gle.com>
Subject: Re: [PATCH v1 net 03/16] sysctl: Add proc_dointvec_lockless().
From: Eric Dumazet <edumazet@...gle.com>
Date: Wed, 6 Jul 2022 09:00:11 +0200
> On Wed, Jul 6, 2022 at 7:22 AM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
> >
> > A sysctl variable is accessed concurrently, and there is always a chance of
> > data-race. So, all readers and writers need some basic protection to avoid
> > load/store-tearing.
> >
> > This patch changes proc_dointvec() to use READ_ONCE()/WRITE_ONCE()
> > internally to fix a data-race on the sysctl side. For now, proc_dointvec()
> > itself is tolerant to a data-race, but we still need to add annotations on
> > the other subsystem's side.
> >
> > In case we miss such fixes, this patch converts proc_dointvec() to a
> > wrapper of proc_dointvec_lockless(). When we fix a data-race in the other
> > subsystem, we can explicitly set it as a handler.
> >
> > Also, this patch removes proc_dointvec()'s document and adds
> > proc_dointvec_lockless()'s one so that no one will use proc_dointvec()
> > anymore.
> >
> > While we are on it, we remove some trailing spaces.
>
>
> I do not see why you add more functions.
It was not to miss where we still need fixes and to be taken care of
by newly added sysctl knob.
> Really all sysctls can change locklessly by nature, as I pointed out.
>
> So I would simply add WRITE_ONCE() whenever they are written, and
> READ_ONCE() when they are read.
>
> If stable teams care enough, they will have to backport these changes,
> so I would rather not have to change
> proc_dointvec() to proc_dointvec_lockless() in many files, with many
> conflicts, that ultimately will either
> add bugs, or ask extra work for maintainers.
Indeed, I will drop such changes and just add annotations in *_conv().
Thank you!
Powered by blists - more mailing lists