Re: [rcu:mmap_sem.2017.08.09a 6/16] mm/mmap.c:162:1: error: type defaults to 'int' in declaration of 'DEFINE_SRCU'
From: Paul E. McKenney
Date: Wed Aug 09 2017 - 18:25:38 EST
On Thu, Aug 10, 2017 at 06:09:22AM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git mmap_sem.2017.08.09a
> head: 39782fbd9252a3ace9b49a55f4dd2a41a6ced31f
> commit: 1b801585f6b03276db9722dc725a50ca11439467 [6/16] mm: RCU free VMAs
> config: parisc-allnoconfig (attached as .config)
> compiler: hppa-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 1b801585f6b03276db9722dc725a50ca11439467
> # save the attached .config to linux build tree
> make.cross ARCH=parisc
>
> All error/warnings (new ones prefixed by >>):
>
> In file included from mm/mmap.c:53:0:
> mm/internal.h: In function 'vma_has_changed':
> mm/internal.h:59:26: error: 'struct vm_fault' has no member named 'sequence'
> return ret || seq != vmf->sequence;
> ^~
> mm/mmap.c: At top level:
> >> mm/mmap.c:162:1: warning: data definition has no type or storage class
> DEFINE_SRCU(vma_srcu);
> ^~~~~~~~~~~
I am going to guess that this is because hppa does not select SRCU?
Thanx, Paul
> >> mm/mmap.c:162:1: error: type defaults to 'int' in declaration of 'DEFINE_SRCU' [-Werror=implicit-int]
> >> mm/mmap.c:162:1: warning: parameter names (without types) in function declaration
> cc1: some warnings being treated as errors
>
> vim +162 mm/mmap.c
>
> 52
> > 53 #include "internal.h"
> 54
> 55 #ifndef arch_mmap_check
> 56 #define arch_mmap_check(addr, len, flags) (0)
> 57 #endif
> 58
> 59 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
> 60 const int mmap_rnd_bits_min = CONFIG_ARCH_MMAP_RND_BITS_MIN;
> 61 const int mmap_rnd_bits_max = CONFIG_ARCH_MMAP_RND_BITS_MAX;
> 62 int mmap_rnd_bits __read_mostly = CONFIG_ARCH_MMAP_RND_BITS;
> 63 #endif
> 64 #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
> 65 const int mmap_rnd_compat_bits_min = CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN;
> 66 const int mmap_rnd_compat_bits_max = CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX;
> 67 int mmap_rnd_compat_bits __read_mostly = CONFIG_ARCH_MMAP_RND_COMPAT_BITS;
> 68 #endif
> 69
> 70 static bool ignore_rlimit_data;
> 71 core_param(ignore_rlimit_data, ignore_rlimit_data, bool, 0644);
> 72
> 73 static void unmap_region(struct mm_struct *mm,
> 74 struct vm_area_struct *vma, struct vm_area_struct *prev,
> 75 unsigned long start, unsigned long end);
> 76
> 77 /* description of effects of mapping type and prot in current implementation.
> 78 * this is due to the limited x86 page protection hardware. The expected
> 79 * behavior is in parens:
> 80 *
> 81 * map_type prot
> 82 * PROT_NONE PROT_READ PROT_WRITE PROT_EXEC
> 83 * MAP_SHARED r: (no) no r: (yes) yes r: (no) yes r: (no) yes
> 84 * w: (no) no w: (no) no w: (yes) yes w: (no) no
> 85 * x: (no) no x: (no) yes x: (no) yes x: (yes) yes
> 86 *
> 87 * MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes
> 88 * w: (no) no w: (no) no w: (copy) copy w: (no) no
> 89 * x: (no) no x: (no) yes x: (no) yes x: (yes) yes
> 90 *
> 91 * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and
> 92 * MAP_PRIVATE:
> 93 * r: (no) no
> 94 * w: (no) no
> 95 * x: (yes) yes
> 96 */
> 97 pgprot_t protection_map[16] __ro_after_init = {
> 98 __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
> 99 __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
> 100 };
> 101
> 102 pgprot_t vm_get_page_prot(unsigned long vm_flags)
> 103 {
> 104 return __pgprot(pgprot_val(protection_map[vm_flags &
> 105 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> 106 pgprot_val(arch_vm_get_page_prot(vm_flags)));
> 107 }
> 108 EXPORT_SYMBOL(vm_get_page_prot);
> 109
> 110 static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
> 111 {
> 112 return pgprot_modify(oldprot, vm_get_page_prot(vm_flags));
> 113 }
> 114
> 115 /* Update vma->vm_page_prot to reflect vma->vm_flags. */
> 116 void vma_set_page_prot(struct vm_area_struct *vma)
> 117 {
> 118 unsigned long vm_flags = vma->vm_flags;
> 119 pgprot_t vm_page_prot;
> 120
> 121 vm_page_prot = vm_pgprot_modify(vma->vm_page_prot, vm_flags);
> 122 if (vma_wants_writenotify(vma, vm_page_prot)) {
> 123 vm_flags &= ~VM_SHARED;
> 124 vm_page_prot = vm_pgprot_modify(vm_page_prot, vm_flags);
> 125 }
> 126 /* remove_protection_ptes reads vma->vm_page_prot without mmap_sem */
> 127 WRITE_ONCE(vma->vm_page_prot, vm_page_prot);
> 128 }
> 129
> 130 /*
> 131 * Requires inode->i_mapping->i_mmap_rwsem
> 132 */
> 133 static void __remove_shared_vm_struct(struct vm_area_struct *vma,
> 134 struct file *file, struct address_space *mapping)
> 135 {
> 136 if (vma->vm_flags & VM_DENYWRITE)
> 137 atomic_inc(&file_inode(file)->i_writecount);
> 138 if (vma->vm_flags & VM_SHARED)
> 139 mapping_unmap_writable(mapping);
> 140
> 141 flush_dcache_mmap_lock(mapping);
> 142 vma_interval_tree_remove(vma, &mapping->i_mmap);
> 143 flush_dcache_mmap_unlock(mapping);
> 144 }
> 145
> 146 /*
> 147 * Unlink a file-based vm structure from its interval tree, to hide
> 148 * vma from rmap and vmtruncate before freeing its page tables.
> 149 */
> 150 void unlink_file_vma(struct vm_area_struct *vma)
> 151 {
> 152 struct file *file = vma->vm_file;
> 153
> 154 if (file) {
> 155 struct address_space *mapping = file->f_mapping;
> 156 i_mmap_lock_write(mapping);
> 157 __remove_shared_vm_struct(vma, file, mapping);
> 158 i_mmap_unlock_write(mapping);
> 159 }
> 160 }
> 161
> > 162 DEFINE_SRCU(vma_srcu);
> 163
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation