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: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, "Lobakin, Alexandr" <alexandr.lobakin@xxxxxxxxx>
- Subject: RE: [PATCH v2 2/6] bitops: always define asm-generic non-atomic bitops
- From: "Luck, Tony" <tony.luck@xxxxxxxxx>
- Date: Fri, 10 Jun 2022 16:02:03 +0000
- Accept-language: en-US
- Cc: 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>, Marco Elver <elver@xxxxxxxxxx>, 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>
- Dlp-product: dlpe-windows
- Dlp-reaction: no-action
- Dlp-version: 11.6.500.17
- In-reply-to: <YqNMO0ioGzJ1IkoA@smile.fi.intel.com>
- References: <20220610113427.908751-1-alexandr.lobakin@intel.com> <20220610113427.908751-3-alexandr.lobakin@intel.com> <YqNMO0ioGzJ1IkoA@smile.fi.intel.com>
> > +/**
> > + * 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.
But there is no such thing as an atomic test_bit() operation:
if (test_bit(5, addr)) {
/* some other CPU nukes bit 5 */
/* I know it was set when I looked, but now, could be anything */
...
}
-Tony
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]