Skip to contentSkip to conversation

linux/compiler.h: fix stale comment on {READ,WRITE}_ONCE

PATCH Superseded Rasmus Villemoes 3 participants 4 messages Oct 12, 2015 – Mar 10, 2016 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/compiler.h: fix stale comment on {READ,WRITE}_ONCE

Commit 7bd3e239d6c6 ("locking: Remove atomicy checks from {READ,WRITE}_ONCE") removed said warning.

---
 include/linux/compiler.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/compiler.h +1 -2
index c836eb2dc44d..1dd0034e15e2 100644
@@ -237,8 +237,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * In contrast to ACCESS_ONCE these two macros will also work on aggregate
  * data types like structs or unions. If the size of the accessed data
  * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
- * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy and print a
- * compile-time warning.
+ * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy.
  *
  * Their two major use cases are: (1) Mediating communication between
  * process-level code and irq/NMI handlers, all running on the same CPU,
Signature · 1 line
2.1.3
Acked-by on v1 1/1
#1 lore raw

Am 12.10.2015 um 09:46 schrieb Rasmus Villemoes:

Quoted 14 lines

Commit 7bd3e239d6c6 ("locking: Remove atomicy checks from {READ,WRITE}_ONCE") removed said warning.

---
 include/linux/compiler.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/compiler.h +0 -0
index c836eb2dc44d..1dd0034e15e2 100644

include/linux/compiler.h static __always_inline void __write_once_size(volatile void *p, void *res, int s · line 243

Quoted 9 lines
include/linux/compiler.h +1 -2
@@ -237,8 +237,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * In contrast to ACCESS_ONCE these two macros will also work on aggregate
  * data types like structs or unions. If the size of the accessed data
  * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
- * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy and print a
- * compile-time warning.
+ * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy.
  *
  * Their two major use cases are: (1) Mediating communication between
  * process-level code and irq/NMI handlers, all running on the same CPU,
#2 lore raw

PATCH RESEND 1/1 linux/compiler.h: fix stale comment on {READ,WRITE}_ONCE

In reply to Rasmus Villemoes

Commit 7bd3e239d6c6 ("locking: Remove atomicy checks from {READ,WRITE}_ONCE") removed said warning.

---
Andrew, can you pick this up please?

 include/linux/compiler.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/compiler.h +1 -2
index 48f5aab117ae..062b6ad95276 100644
@@ -263,8 +263,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * In contrast to ACCESS_ONCE these two macros will also work on aggregate
  * data types like structs or unions. If the size of the accessed data
  * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
- * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy and print a
- * compile-time warning.
+ * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy.
  *
  * Their two major use cases are: (1) Mediating communication between
  * process-level code and irq/NMI handlers, all running on the same CPU,
Signature · 1 line
2.1.4
#3 lore raw
Quoted 16 lines · On Thu, 10 Mar 2016 01:16:57 +0100 Rasmus Villemoes <[email protected]>…

Commit 7bd3e239d6c6 ("locking: Remove atomicy checks from {READ,WRITE}_ONCE") removed said warning.

---
Andrew, can you pick this up please?

 include/linux/compiler.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/compiler.h +0 -0
index 48f5aab117ae..062b6ad95276 100644

include/linux/compiler.h static __always_inline void __write_once_size(volatile void *p, void *res, int s · line 269

Quoted 9 lines
include/linux/compiler.h +1 -2
@@ -263,8 +263,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * In contrast to ACCESS_ONCE these two macros will also work on aggregate
  * data types like structs or unions. If the size of the accessed data
  * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
- * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy and print a
- * compile-time warning.
+ * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy.
  *
  * Their two major use cases are: (1) Mediating communication between
  * process-level code and irq/NMI handlers, all running on the same CPU,

Conflicts with Konrad's patch in linux-next (from an IngoTree), below.

I'll drop your patch - Konrad covers the same info and more.

(grammar nazi: s/There's/There are/)

commit fed0764fafd8e2e629a033c0f7df4106b0dcb7f0

Author:     Konrad Rzeszutek Wilk <[email protected]>
AuthorDate: Mon Jan 25 16:33:20 2016 -0500
Commit:     Ingo Molnar <[email protected]>
CommitDate: Tue Feb 9 14:50:16 2016 +0100

locking/atomics: Update comment about READ_ONCE() and structures

The comment is out of data. Also point out the performance drawback of the barrier();__builtin_memcpy(); barrier() followed by another copy from stack (__u) to lvalue;

Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sasha Levin <[email protected]>
Cc Thomas Gleixner <[email protected]>
[ Made it a bit more readable. ]
include/linux/compiler.h +3 -2
index 00b042c..4291592 100644
@@ -263,8 +263,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * In contrast to ACCESS_ONCE these two macros will also work on aggregate
  * data types like structs or unions. If the size of the accessed data
  * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
- * READ_ONCE() and WRITE_ONCE()  will fall back to memcpy and print a
- * compile-time warning.
+ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy(). There's at
+ * least two memcpy()s: one for the __builtin_memcpy() and then one for
+ * the macro doing the copy of variable - '__u' allocated on the stack.
  *
  * Their two major use cases are: (1) Mediating communication between
  * process-level code and irq/NMI handlers, all running on the same CPU,