linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
@ 2021-05-12 14:45 kernel test robot
  2021-05-12 16:19 ` Axel Rasmussen
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2021-05-12 14:45 UTC (permalink / raw)
  To: Axel Rasmussen
  Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
	Peter Xu, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 19036 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ec85c95b0c90a17413901b018e8ade7b9eae7cad
commit: 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 [2078/2633] userfaultfd/hugetlbfs: avoid including userfaultfd_k.h in hugetlb.h
config: s390-randconfig-r023-20210512 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a0fed635fe1701470062495a6ffee1c608f3f1bc)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/s390/mm/fault.c:33:
>> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
                                                   enum mcopy_atomic_mode mode,
                                                                          ^
   include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
   enum mcopy_atomic_mode;
        ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from arch/s390/mm/fault.c:35:
   In file included from arch/s390/include/asm/diag.h:12:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   12 warnings and 1 error generated.
--
   In file included from arch/s390/mm/vmem.c:8:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from arch/s390/mm/vmem.c:8:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from arch/s390/mm/vmem.c:8:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   In file included from arch/s390/mm/vmem.c:13:
>> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
                                                   enum mcopy_atomic_mode mode,
                                                                          ^
   include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
   enum mcopy_atomic_mode;
        ^
   arch/s390/mm/vmem.c:521:6: warning: no previous prototype for function 'vmemmap_free' [-Wmissing-prototypes]
   void vmemmap_free(unsigned long start, unsigned long end,
        ^
   arch/s390/mm/vmem.c:521:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void vmemmap_free(unsigned long start, unsigned long end,
   ^
   static 
   13 warnings and 1 error generated.
--
   In file included from arch/s390/mm/pageattr.c:6:
>> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
                                                   enum mcopy_atomic_mode mode,
                                                                          ^
   include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
   enum mcopy_atomic_mode;
        ^
   1 error generated.
--
   In file included from arch/s390/kernel/setup.c:25:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from arch/s390/kernel/setup.c:25:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from arch/s390/kernel/setup.c:25:
   In file included from include/linux/memblock.h:14:
   In file included from arch/s390/include/asm/dma.h:5:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   In file included from arch/s390/kernel/setup.c:52:
>> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
                                                   enum mcopy_atomic_mode mode,
                                                                          ^
   include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
   enum mcopy_atomic_mode;
        ^
   12 warnings and 1 error generated.


vim +340 include/linux/hugetlb.h

1f9dccb25b8fb4 Mike Kravetz   2019-11-30  333  
714c189108244f Axel Rasmussen 2021-05-04  334  #ifdef CONFIG_USERFAULTFD
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  335  static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  336  						pte_t *dst_pte,
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  337  						struct vm_area_struct *dst_vma,
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  338  						unsigned long dst_addr,
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  339  						unsigned long src_addr,
f619147104c8ea Axel Rasmussen 2021-05-04 @340  						enum mcopy_atomic_mode mode,
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  341  						struct page **pagep)
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  342  {
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  343  	BUG();
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  344  	return 0;
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  345  }
714c189108244f Axel Rasmussen 2021-05-04  346  #endif /* CONFIG_USERFAULTFD */
1f9dccb25b8fb4 Mike Kravetz   2019-11-30  347  

:::::: The code at line 340 was first introduced by commit
:::::: f619147104c8ea71e120e4936d2b68ec11a1e527 userfaultfd: add UFFDIO_CONTINUE ioctl

:::::: TO: Axel Rasmussen <axelrasmussen@google.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 18833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
  2021-05-12 14:45 [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode' kernel test robot
@ 2021-05-12 16:19 ` Axel Rasmussen
  2021-05-12 18:55   ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Rasmussen @ 2021-05-12 16:19 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
	Peter Xu, Andrew Morton, Hugh Dickins

Andrew, the straightforward fix is just to drop this commit, which is
currently in the mm tree (not in v5.13-rc1):

09ff184a3eb1c9 userfaultfd/hugetlbfs: avoid including userfaultfd_k.h
in hugetlb.h

(Happy to send a revert patch, but I suspect it's easier for you to
drop than to revert + squash later?)

Adding Hugh as well, since he suggested this cleanup and might prefer
doing something else instead.

On Wed, May 12, 2021 at 7:45 AM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   ec85c95b0c90a17413901b018e8ade7b9eae7cad
> commit: 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 [2078/2633] userfaultfd/hugetlbfs: avoid including userfaultfd_k.h in hugetlb.h
> config: s390-randconfig-r023-20210512 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a0fed635fe1701470062495a6ffee1c608f3f1bc)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install s390 cross compiling tool for clang build
>         # apt-get install binutils-s390x-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>    In file included from arch/s390/mm/fault.c:33:
> >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
>                                                    enum mcopy_atomic_mode mode,
>                                                                           ^
>    include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
>    enum mcopy_atomic_mode;
>         ^
>    In file included from arch/s390/mm/fault.c:35:
>    In file included from arch/s390/include/asm/diag.h:12:
>    In file included from include/linux/if_ether.h:19:
>    In file included from include/linux/skbuff.h:31:
>    In file included from include/linux/dma-mapping.h:10:
>    In file included from include/linux/scatterlist.h:9:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __raw_readb(PCI_IOBASE + addr);
>                              ~~~~~~~~~~ ^
>    include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
>                                                            ~~~~~~~~~~ ^
>    include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
>    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
>                                                              ^
>    include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
>    #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
>                                                         ^
>    In file included from arch/s390/mm/fault.c:35:
>    In file included from arch/s390/include/asm/diag.h:12:
>    In file included from include/linux/if_ether.h:19:
>    In file included from include/linux/skbuff.h:31:
>    In file included from include/linux/dma-mapping.h:10:
>    In file included from include/linux/scatterlist.h:9:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
>                                                            ~~~~~~~~~~ ^
>    include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
>    #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
>                                                              ^
>    include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
>    #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
>                                                         ^
>    In file included from arch/s390/mm/fault.c:35:
>    In file included from arch/s390/include/asm/diag.h:12:
>    In file included from include/linux/if_ether.h:19:
>    In file included from include/linux/skbuff.h:31:
>    In file included from include/linux/dma-mapping.h:10:
>    In file included from include/linux/scatterlist.h:9:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writeb(value, PCI_IOBASE + addr);
>                                ~~~~~~~~~~ ^
>    include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
>                                                          ~~~~~~~~~~ ^
>    include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
>                                                          ~~~~~~~~~~ ^
>    include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsb(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsw(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsl(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesb(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesw(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesl(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    12 warnings and 1 error generated.
> --
>    In file included from arch/s390/mm/vmem.c:8:
>    In file included from include/linux/memblock.h:14:
>    In file included from arch/s390/include/asm/dma.h:5:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __raw_readb(PCI_IOBASE + addr);
>                              ~~~~~~~~~~ ^
>    include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
>                                                            ~~~~~~~~~~ ^
>    include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
>    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
>                                                              ^
>    include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
>    #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
>                                                         ^
>    In file included from arch/s390/mm/vmem.c:8:
>    In file included from include/linux/memblock.h:14:
>    In file included from arch/s390/include/asm/dma.h:5:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
>                                                            ~~~~~~~~~~ ^
>    include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
>    #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
>                                                              ^
>    include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
>    #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
>                                                         ^
>    In file included from arch/s390/mm/vmem.c:8:
>    In file included from include/linux/memblock.h:14:
>    In file included from arch/s390/include/asm/dma.h:5:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writeb(value, PCI_IOBASE + addr);
>                                ~~~~~~~~~~ ^
>    include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
>                                                          ~~~~~~~~~~ ^
>    include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
>                                                          ~~~~~~~~~~ ^
>    include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsb(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsw(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsl(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesb(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesw(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesl(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    In file included from arch/s390/mm/vmem.c:13:
> >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
>                                                    enum mcopy_atomic_mode mode,
>                                                                           ^
>    include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
>    enum mcopy_atomic_mode;
>         ^
>    arch/s390/mm/vmem.c:521:6: warning: no previous prototype for function 'vmemmap_free' [-Wmissing-prototypes]
>    void vmemmap_free(unsigned long start, unsigned long end,
>         ^
>    arch/s390/mm/vmem.c:521:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>    void vmemmap_free(unsigned long start, unsigned long end,
>    ^
>    static
>    13 warnings and 1 error generated.
> --
>    In file included from arch/s390/mm/pageattr.c:6:
> >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
>                                                    enum mcopy_atomic_mode mode,
>                                                                           ^
>    include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
>    enum mcopy_atomic_mode;
>         ^
>    1 error generated.
> --
>    In file included from arch/s390/kernel/setup.c:25:
>    In file included from include/linux/memblock.h:14:
>    In file included from arch/s390/include/asm/dma.h:5:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __raw_readb(PCI_IOBASE + addr);
>                              ~~~~~~~~~~ ^
>    include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
>                                                            ~~~~~~~~~~ ^
>    include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
>    #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
>                                                              ^
>    include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
>    #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
>                                                         ^
>    In file included from arch/s390/kernel/setup.c:25:
>    In file included from include/linux/memblock.h:14:
>    In file included from arch/s390/include/asm/dma.h:5:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
>                                                            ~~~~~~~~~~ ^
>    include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
>    #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
>                                                              ^
>    include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
>    #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
>                                                         ^
>    In file included from arch/s390/kernel/setup.c:25:
>    In file included from include/linux/memblock.h:14:
>    In file included from arch/s390/include/asm/dma.h:5:
>    In file included from arch/s390/include/asm/io.h:75:
>    include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writeb(value, PCI_IOBASE + addr);
>                                ~~~~~~~~~~ ^
>    include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
>                                                          ~~~~~~~~~~ ^
>    include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
>                                                          ~~~~~~~~~~ ^
>    include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsb(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsw(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            readsl(PCI_IOBASE + addr, buffer, count);
>                   ~~~~~~~~~~ ^
>    include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesb(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesw(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>            writesl(PCI_IOBASE + addr, buffer, count);
>                    ~~~~~~~~~~ ^
>    In file included from arch/s390/kernel/setup.c:52:
> >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
>                                                    enum mcopy_atomic_mode mode,
>                                                                           ^
>    include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
>    enum mcopy_atomic_mode;
>         ^
>    12 warnings and 1 error generated.
>
>
> vim +340 include/linux/hugetlb.h
>
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  333
> 714c189108244f Axel Rasmussen 2021-05-04  334  #ifdef CONFIG_USERFAULTFD
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  335  static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  336                                           pte_t *dst_pte,
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  337                                           struct vm_area_struct *dst_vma,
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  338                                           unsigned long dst_addr,
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  339                                           unsigned long src_addr,
> f619147104c8ea Axel Rasmussen 2021-05-04 @340                                           enum mcopy_atomic_mode mode,
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  341                                           struct page **pagep)
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  342  {
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  343   BUG();
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  344   return 0;
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  345  }
> 714c189108244f Axel Rasmussen 2021-05-04  346  #endif /* CONFIG_USERFAULTFD */
> 1f9dccb25b8fb4 Mike Kravetz   2019-11-30  347
>
> :::::: The code at line 340 was first introduced by commit
> :::::: f619147104c8ea71e120e4936d2b68ec11a1e527 userfaultfd: add UFFDIO_CONTINUE ioctl
>
> :::::: TO: Axel Rasmussen <axelrasmussen@google.com>
> :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
  2021-05-12 16:19 ` Axel Rasmussen
@ 2021-05-12 18:55   ` Hugh Dickins
  2021-05-12 19:29     ` Axel Rasmussen
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2021-05-12 18:55 UTC (permalink / raw)
  To: Axel Rasmussen
  Cc: kernel test robot, kbuild-all, clang-built-linux,
	Linux Memory Management List, Peter Xu, Andrew Morton,
	Hugh Dickins, Mike Kravetz

On Wed, 12 May 2021, Axel Rasmussen wrote:

> Andrew, the straightforward fix is just to drop this commit, which is
> currently in the mm tree (not in v5.13-rc1):

Yes, that's easiest.

> 
> 09ff184a3eb1c9 userfaultfd/hugetlbfs: avoid including userfaultfd_k.h
> in hugetlb.h
> 
> (Happy to send a revert patch, but I suspect it's easier for you to
> drop than to revert + squash later?)
> 
> Adding Hugh as well, since he suggested this cleanup and might prefer
> doing something else instead.

Yes, sorry for dropping you in it.

> 
> On Wed, May 12, 2021 at 7:45 AM kernel test robot <lkp@intel.com> wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   ec85c95b0c90a17413901b018e8ade7b9eae7cad
> > commit: 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 [2078/2633] userfaultfd/hugetlbfs: avoid including userfaultfd_k.h in hugetlb.h
> > config: s390-randconfig-r023-20210512 (attached as .config)
> > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a0fed635fe1701470062495a6ffee1c608f3f1bc)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # install s390 cross compiling tool for clang build

I was puzzled, thinking it was something special to s390 or to clang;
until noticing that it says s390-randconfig above.

> >         # apt-get install binutils-s390x-linux-gnu
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> >         git fetch --no-tags linux-next master
> >         git checkout 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> >    In file included from arch/s390/mm/fault.c:33:
> > >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
> >                                                    enum mcopy_atomic_mode mode,
> >                                                                           ^
> >    include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
> >    enum mcopy_atomic_mode;
> >         ^

And line 340 is not the first, usual use of mcopy_atomic_mode in hugetlb.h,
but its use in the CONFIG_USERFAULTFD=y CONFIG_HUGETLB_PAGE=n static inline
stub.  Right, the compiler would probably want to compile that before
optimizing it away; and want to know more about the enum to do so.

My actual preference would be to keep the "enum mcopy_atomic_mode;"
patch, and fix it with the patch below: since the only call to
hugetlb_mcopy_atomic_pte() is under #ifdef CONFIG_HUGETLB_PAGE anyway.

But since I have not even tried building with this patch on x86_64 gcc,
in any configuration at all, I expect you all to be rather wary of my
suggestions by now, and prefer to just drop the troublesome patch.
But in case anyone is tempted, now or later,

--- mmotm/include/linux/hugetlb.h	2021-05-11 08:33:39.987553392 -0700
+++ linux/include/linux/hugetlb.h	2021-05-12 11:20:52.385063935 -0700
@@ -331,20 +331,6 @@ static inline void hugetlb_free_pgd_rang
 	BUG();
 }
 
-#ifdef CONFIG_USERFAULTFD
-static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
-						pte_t *dst_pte,
-						struct vm_area_struct *dst_vma,
-						unsigned long dst_addr,
-						unsigned long src_addr,
-						enum mcopy_atomic_mode mode,
-						struct page **pagep)
-{
-	BUG();
-	return 0;
-}
-#endif /* CONFIG_USERFAULTFD */
-
 static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,
 					unsigned long sz)
 {


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
  2021-05-12 18:55   ` Hugh Dickins
@ 2021-05-12 19:29     ` Axel Rasmussen
  0 siblings, 0 replies; 4+ messages in thread
From: Axel Rasmussen @ 2021-05-12 19:29 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: kernel test robot, kbuild-all, clang-built-linux,
	Linux Memory Management List, Peter Xu, Andrew Morton,
	Mike Kravetz

On Wed, May 12, 2021 at 11:56 AM Hugh Dickins <hughd@google.com> wrote:
>
> On Wed, 12 May 2021, Axel Rasmussen wrote:
>
> > Andrew, the straightforward fix is just to drop this commit, which is
> > currently in the mm tree (not in v5.13-rc1):
>
> Yes, that's easiest.
>
> >
> > 09ff184a3eb1c9 userfaultfd/hugetlbfs: avoid including userfaultfd_k.h
> > in hugetlb.h
> >
> > (Happy to send a revert patch, but I suspect it's easier for you to
> > drop than to revert + squash later?)
> >
> > Adding Hugh as well, since he suggested this cleanup and might prefer
> > doing something else instead.
>
> Yes, sorry for dropping you in it.
>
> >
> > On Wed, May 12, 2021 at 7:45 AM kernel test robot <lkp@intel.com> wrote:
> > >
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > > head:   ec85c95b0c90a17413901b018e8ade7b9eae7cad
> > > commit: 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 [2078/2633] userfaultfd/hugetlbfs: avoid including userfaultfd_k.h in hugetlb.h
> > > config: s390-randconfig-r023-20210512 (attached as .config)
> > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a0fed635fe1701470062495a6ffee1c608f3f1bc)
> > > reproduce (this is a W=1 build):
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         # install s390 cross compiling tool for clang build
>
> I was puzzled, thinking it was something special to s390 or to clang;
> until noticing that it says s390-randconfig above.
>
> > >         # apt-get install binutils-s390x-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
> > >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > >         git fetch --no-tags linux-next master
> > >         git checkout 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > >    In file included from arch/s390/mm/fault.c:33:
> > > >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode'
> > >                                                    enum mcopy_atomic_mode mode,
> > >                                                                           ^
> > >    include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode'
> > >    enum mcopy_atomic_mode;
> > >         ^
>
> And line 340 is not the first, usual use of mcopy_atomic_mode in hugetlb.h,
> but its use in the CONFIG_USERFAULTFD=y CONFIG_HUGETLB_PAGE=n static inline
> stub.  Right, the compiler would probably want to compile that before
> optimizing it away; and want to know more about the enum to do so.
>
> My actual preference would be to keep the "enum mcopy_atomic_mode;"
> patch, and fix it with the patch below: since the only call to
> hugetlb_mcopy_atomic_pte() is under #ifdef CONFIG_HUGETLB_PAGE anyway.
>
> But since I have not even tried building with this patch on x86_64 gcc,
> in any configuration at all, I expect you all to be rather wary of my
> suggestions by now, and prefer to just drop the troublesome patch.
> But in case anyone is tempted, now or later,

Yeah, I would want to do some more testing first on various compilers
and things. My understanding is that the C standard says enums may be
as small as a char or as big as an int depending on the value(s) they
can have, so with just a forward declaration we can't know the size
which I think is needed even for just a function signature. But, GCC
seems to do something to make this "work" (at least without
-pedantic).

Another small cleanup I'd like to do is, after our other code review,
I think "enum mcopy_atomic_mode" should rather be named "enum
mfill_atomic_mode" - since Andrea intended "mcopy" to refer
specifically to copy_from_user, and "mfill" to refer to the more
general operation. So, I think we drop this patch for now, and I'll
keep this in mind for some future cleanup series.

>
> --- mmotm/include/linux/hugetlb.h       2021-05-11 08:33:39.987553392 -0700
> +++ linux/include/linux/hugetlb.h       2021-05-12 11:20:52.385063935 -0700
> @@ -331,20 +331,6 @@ static inline void hugetlb_free_pgd_rang
>         BUG();
>  }
>
> -#ifdef CONFIG_USERFAULTFD
> -static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
> -                                               pte_t *dst_pte,
> -                                               struct vm_area_struct *dst_vma,
> -                                               unsigned long dst_addr,
> -                                               unsigned long src_addr,
> -                                               enum mcopy_atomic_mode mode,
> -                                               struct page **pagep)
> -{
> -       BUG();
> -       return 0;
> -}
> -#endif /* CONFIG_USERFAULTFD */
> -
>  static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,
>                                         unsigned long sz)
>  {


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-12 19:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 14:45 [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode' kernel test robot
2021-05-12 16:19 ` Axel Rasmussen
2021-05-12 18:55   ` Hugh Dickins
2021-05-12 19:29     ` Axel Rasmussen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).