tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
WIP.x86/pti.entry
head:   6891282dd3ab7fead975ed52d0f7f8da37ab96a5
commit: c2bc66082e1048c7573d72e62f597bdc5ce13fea [10/39] locking/barriers: Add 
implicit smp_read_barrier_depends() to READ_ONCE()
config: h8300-h8300h-sim_defconfig (attached as .config)
compiler: h8300-linux-gcc (GCC) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout c2bc66082e1048c7573d72e62f597bdc5ce13fea
        # save the attached .config to linux build tree
        make.cross ARCH=h8300 

All error/warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:2:0,
                    from include/linux/stddef.h:5,
                    from arch/h8300/kernel/asm-offsets.c:12:
   include/linux/list.h: In function 'list_empty':
>> include/linux/compiler.h:344:2: error: implicit declaration of function 
>> 'smp_read_barrier_depends' [-Werror=implicit-function-declaration]
     smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
     ^
>> include/linux/compiler.h:347:22: note: in expansion of macro '__READ_ONCE'
    #define READ_ONCE(x) __READ_ONCE(x, 1)
                         ^~~~~~~~~~~
>> include/linux/list.h:203:9: note: in expansion of macro 'READ_ONCE'
     return READ_ONCE(head->next) == head;
            ^~~~~~~~~
   cc1: some warnings being treated as errors
   make[2]: *** [arch/h8300/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/smp_read_barrier_depends +344 include/linux/compiler.h

   313  
   314  /*
   315   * Prevent the compiler from merging or refetching reads or writes. The
   316   * compiler is also forbidden from reordering successive instances of
   317   * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the
   318   * compiler is aware of some particular ordering.  One way to make the
   319   * compiler aware of ordering is to put the two invocations of 
READ_ONCE,
   320   * WRITE_ONCE or ACCESS_ONCE() in different C statements.
   321   *
   322   * In contrast to ACCESS_ONCE these two macros will also work on 
aggregate
   323   * data types like structs or unions. If the size of the accessed data
   324   * type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
   325   * READ_ONCE() and WRITE_ONCE() will fall back to memcpy(). There's at
   326   * least two memcpy()s: one for the __builtin_memcpy() and then one for
   327   * the macro doing the copy of variable - '__u' allocated on the stack.
   328   *
   329   * Their two major use cases are: (1) Mediating communication between
   330   * process-level code and irq/NMI handlers, all running on the same CPU,
   331   * and (2) Ensuring that the compiler does not  fold, spindle, or 
otherwise
   332   * mutilate accesses that either do not require ordering or that 
interact
   333   * with an explicit memory barrier or atomic instruction that provides 
the
   334   * required ordering.
   335   */
   336  
   337  #define __READ_ONCE(x, check)                                           
\
   338  ({                                                                      
\
   339          union { typeof(x) __val; char __c[1]; } __u;                    
\
   340          if (check)                                                      
\
   341                  __read_once_size(&(x), __u.__c, sizeof(x));             
\
   342          else                                                            
\
   343                  __read_once_size_nocheck(&(x), __u.__c, sizeof(x));     
\
 > 344          smp_read_barrier_depends(); /* Enforce dependency ordering from 
 > x */ \
   345          __u.__val;                                                      
\
   346  })
 > 347  #define READ_ONCE(x) __READ_ONCE(x, 1)
   348  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to