Re: [PATCH v2 2/6] bitops: always define asm-generic non-atomic bitops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
- Subject: Re: [PATCH v2 2/6] bitops: always define asm-generic non-atomic bitops
- From: Marco Elver <elver@xxxxxxxxxx>
- Date: Mon, 13 Jun 2022 16:33:17 +0200
- Cc: Tony Luck <tony.luck@xxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Yury Norov <yury.norov@xxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, Brian Cain <bcain@xxxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>, Borislav Petkov <bp@xxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, "linux-alpha@xxxxxxxxxxxxxxx" <linux-alpha@xxxxxxxxxxxxxxx>, "linux-hexagon@xxxxxxxxxxxxxxx" <linux-hexagon@xxxxxxxxxxxxxxx>, "linux-ia64@xxxxxxxxxxxxxxx" <linux-ia64@xxxxxxxxxxxxxxx>, "linux-m68k@xxxxxxxxxxxxxxxxxxxx" <linux-m68k@xxxxxxxxxxxxxxx>, "linux-sh@xxxxxxxxxxxxxxx" <linux-sh@xxxxxxxxxxxxxxx>, "sparclinux@xxxxxxxxxxxxxxx" <sparclinux@xxxxxxxxxxxxxxx>, "linux-arch@xxxxxxxxxxxxxxx" <linux-arch@xxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>
- In-reply-to: <20220613141947.1176100-1-alexandr.lobakin@intel.com>
- References: <20220610113427.908751-1-alexandr.lobakin@intel.com> <20220610113427.908751-3-alexandr.lobakin@intel.com> <YqNMO0ioGzJ1IkoA@smile.fi.intel.com> <22042c14bc6a437d9c6b235fbfa32c8a@intel.com> <CANpmjNNZAeMQjzNyXLeKY4cp_m-xJBU1vs7PgT+7_sJwxtEEAg@mail.gmail.com> <20220613141947.1176100-1-alexandr.lobakin@intel.com>
On Mon, 13 Jun 2022 at 16:21, Alexander Lobakin
<alexandr.lobakin@xxxxxxxxx> wrote:
>
> From: Marco Elver <elver@xxxxxxxxxx>
> Date: Fri, 10 Jun 2022 18:32:36 +0200
>
> > On Fri, 10 Jun 2022 at 18:02, Luck, Tony <tony.luck@xxxxxxxxx> wrote:
> > >
> > > > > +/**
> > > > > + * generic_test_bit - Determine whether a bit is set
> > > > > + * @nr: bit number to test
> > > > > + * @addr: Address to start counting from
> > > > > + */
> > > >
> > > > Shouldn't we add in this or in separate patch a big NOTE to explain that this
> > > > is actually atomic and must be kept as a such?
> > >
> > > "atomic" isn't really the right word. The volatile access makes sure that the
> > > compiler does the test at the point that the source code asked, and doesn't
> > > move it before/after other operations.
> >
> > It's listed in Documentation/atomic_bitops.txt.
>
> Oh, so my memory was actually correct that I saw it in the docs
> somewhere.
> WDYT, should I mention this here in the code (block comment) as well
> that it's atomic and must not lose `volatile` as Andy suggested or
> it's sufficient to have it in the docs (+ it's not underscored)?
Perhaps a quick comment in the code (not kerneldoc above) will be
sufficient, with reference to Documentation/atomic_bitops.txt.
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]