~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/asm-generic/rwonce.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/asm-generic/rwonce.h (Version linux-6.11.5) and /include/asm-ppc/rwonce.h (Version linux-6.8.12)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 /*                                                
  3  * Prevent the compiler from merging or refetc    
  4  * compiler is also forbidden from reordering     
  5  * READ_ONCE and WRITE_ONCE, but only when the    
  6  * particular ordering. One way to make the co    
  7  * put the two invocations of READ_ONCE or WRI    
  8  * statements.                                    
  9  *                                                
 10  * These two macros will also work on aggregat    
 11  * unions.                                        
 12  *                                                
 13  * Their two major use cases are: (1) Mediatin    
 14  * process-level code and irq/NMI handlers, al    
 15  * and (2) Ensuring that the compiler does not    
 16  * mutilate accesses that either do not requir    
 17  * with an explicit memory barrier or atomic i    
 18  * required ordering.                             
 19  */                                               
 20 #ifndef __ASM_GENERIC_RWONCE_H                    
 21 #define __ASM_GENERIC_RWONCE_H                    
 22                                                   
 23 #ifndef __ASSEMBLY__                              
 24                                                   
 25 #include <linux/compiler_types.h>                 
 26 #include <linux/kasan-checks.h>                   
 27 #include <linux/kcsan-checks.h>                   
 28                                                   
 29 /*                                                
 30  * Yes, this permits 64-bit accesses on 32-bit    
 31  * actually be atomic in some cases (namely Ar    
 32  * rely on the access being split into 2x32-bi    
 33  * (e.g. a virtual address) and a strong preva    
 34  */                                               
 35 #define compiletime_assert_rwonce_type(t)         
 36         compiletime_assert(__native_word(t) ||    
 37                 "Unsupported access size for {    
 38                                                   
 39 /*                                                
 40  * Use __READ_ONCE() instead of READ_ONCE() if    
 41  * atomicity. Note that this may result in tea    
 42  */                                               
 43 #ifndef __READ_ONCE                               
 44 #define __READ_ONCE(x)  (*(const volatile __un    
 45 #endif                                            
 46                                                   
 47 #define READ_ONCE(x)                              
 48 ({                                                
 49         compiletime_assert_rwonce_type(x);        
 50         __READ_ONCE(x);                           
 51 })                                                
 52                                                   
 53 #define __WRITE_ONCE(x, val)                      
 54 do {                                              
 55         *(volatile typeof(x) *)&(x) = (val);      
 56 } while (0)                                       
 57                                                   
 58 #define WRITE_ONCE(x, val)                        
 59 do {                                              
 60         compiletime_assert_rwonce_type(x);        
 61         __WRITE_ONCE(x, val);                     
 62 } while (0)                                       
 63                                                   
 64 static __no_sanitize_or_inline                    
 65 unsigned long __read_once_word_nocheck(const v    
 66 {                                                 
 67         return __READ_ONCE(*(unsigned long *)a    
 68 }                                                 
 69                                                   
 70 /*                                                
 71  * Use READ_ONCE_NOCHECK() instead of READ_ONC    
 72  * word from memory atomically but without tel    
 73  * usually used by unwinding code when walking    
 74  */                                               
 75 #define READ_ONCE_NOCHECK(x)                      
 76 ({                                                
 77         compiletime_assert(sizeof(x) == sizeof    
 78                 "Unsupported access size for R    
 79         (typeof(x))__read_once_word_nocheck(&(    
 80 })                                                
 81                                                   
 82 static __no_kasan_or_inline                       
 83 unsigned long read_word_at_a_time(const void *    
 84 {                                                 
 85         kasan_check_read(addr, 1);                
 86         return *(unsigned long *)addr;            
 87 }                                                 
 88                                                   
 89 #endif /* __ASSEMBLY__ */                         
 90 #endif  /* __ASM_GENERIC_RWONCE_H */              
 91                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php