[kvm:queue 23/29] kernel/events/uprobes.c:160:35: warning: unused variable 'range'

kernel test robot
2024-04-12T04:53:34Z

tree: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head: 415efaaf0d973684af5fa7c9ddccf111485f9f1b
commit: b06d4c260e93214808f9dd6031226b1b0e2937f1 [23/29] mm: replace set_pte_at_notify() with just set_pte_at()
config: sparc64-defconfig (https://download.01.org/0day-ci/archive/20240412/202404121232.XDzoCByZ-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240412/202404121232.XDzoCByZ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404121232.XDzoCByZ-lkp@intel.com/

All warnings (new ones prefixed by >>):

kernel/events/uprobes.c: In function '__replace_page':
kernel/events/uprobes.c:160:35: error: storage size of 'range' isn't known
160 | struct mmu_notifier_range range;
| ^~~~~
kernel/events/uprobes.c:162:9: error: implicit declaration of function 'mmu_notifier_range_init' [-Werror=implicit-function-declaration]
162 | mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, addr,
| ^~~~~~~~~~~~~~~~~~~~~~~
kernel/events/uprobes.c:162:41: error: 'MMU_NOTIFY_CLEAR' undeclared (first use in this function)
162 | mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, addr,
| ^~~~~~~~~~~~~~~~
kernel/events/uprobes.c:162:41: note: each undeclared identifier is reported only once for each function it appears in
kernel/events/uprobes.c:175:9: error: implicit declaration of function 'mmu_notifier_invalidate_range_start' [-Werror=implicit-function-declaration]
175 | mmu_notifier_invalidate_range_start(&range);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/events/uprobes.c:208:9: error: implicit declaration of function 'mmu_notifier_invalidate_range_end' [-Werror=implicit-function-declaration]
208 | mmu_notifier_invalidate_range_end(&range);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/events/uprobes.c:160:35: warning: unused variable 'range' [-Wunused-variable]
160 | struct mmu_notifier_range range;
| ^~~~~
cc1: some warnings being treated as errors

vim +/range +160 kernel/events/uprobes.c

cb113b47d09818 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 138
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 139 /**
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 140 * __replace_page - replace page in vma by new page.
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 141 * based on replace_page in mm/ksm.c
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 142 *
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 143 * @vma: vma that holds the pte pointing to page
c517ee744b96e4 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 144 * @addr: address the old @page is mapped at
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 145 * @old_page: the page we are replacing by new_page
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 146 * @new_page: the modified page we replace page by
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 147 *
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 148 * If @new_page is NULL, only unmap @old_page.
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 149 *
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 150 * Returns 0 on success, negative error code otherwise.
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 151 */
c517ee744b96e4 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 152 static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
bdfaa2eecd5f6c kernel/events/uprobes.c Oleg Nesterov 2016-08-17 153 struct page *old_page, struct page *new_page)
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 154 {
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 155) struct folio *old_folio = page_folio(old_page);
82e66bf76173a1 kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 156) struct folio *new_folio;
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 157 struct mm_struct *mm = vma->vm_mm;
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 158) DEFINE_FOLIO_VMA_WALK(pvmw, old_folio, vma, addr, 0);
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 159 int err;
ac46d4f3c43241 kernel/events/uprobes.c Jérôme Glisse 2018-12-28 @160 struct mmu_notifier_range range;
00501b531c4723 kernel/events/uprobes.c Johannes Weiner 2014-08-08 161
7d4a8be0c4b2b7 kernel/events/uprobes.c Alistair Popple 2023-01-10 162 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, addr,
6f4f13e8d9e27c kernel/events/uprobes.c Jérôme Glisse 2019-05-13 163 addr + PAGE_SIZE);
ac46d4f3c43241 kernel/events/uprobes.c Jérôme Glisse 2018-12-28 164
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 165 if (new_page) {
82e66bf76173a1 kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 166) new_folio = page_folio(new_page);
82e66bf76173a1 kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 167) err = mem_cgroup_charge(new_folio, vma->vm_mm, GFP_KERNEL);
00501b531c4723 kernel/events/uprobes.c Johannes Weiner 2014-08-08 168 if (err)
00501b531c4723 kernel/events/uprobes.c Johannes Weiner 2014-08-08 169 return err;
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 170 }
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 171
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 172) /* For folio_free_swap() below */
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 173) folio_lock(old_folio);
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 174
ac46d4f3c43241 kernel/events/uprobes.c Jérôme Glisse 2018-12-28 175 mmu_notifier_invalidate_range_start(&range);
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 176 err = -EAGAIN;
9d82c69438d0df kernel/events/uprobes.c Johannes Weiner 2020-06-03 177 if (!page_vma_mapped_walk(&pvmw))
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 178 goto unlock;
14fa2daa15887f kernel/events/uprobes.c Kirill A. Shutemov 2017-02-24 179 VM_BUG_ON_PAGE(addr != pvmw.address, old_page);
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 180
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 181 if (new_page) {
82e66bf76173a1 kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 182) folio_get(new_folio);
2853b66b601a26 kernel/events/uprobes.c Matthew Wilcox (Oracle 2023-12-11 183) folio_add_new_anon_rmap(new_folio, vma, addr);
82e66bf76173a1 kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 184) folio_add_lru_vma(new_folio, vma);
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 185 } else
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 186 /* no new page, just dec_mm_counter for old_page */
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 187 dec_mm_counter(mm, MM_ANONPAGES);
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 188
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 189) if (!folio_test_anon(old_folio)) {
6b27cc6c66abf0 kernel/events/uprobes.c Kefeng Wang 2024-01-11 190 dec_mm_counter(mm, mm_counter_file(old_folio));
7396fa818d6278 kernel/events/uprobes.c Srikar Dronamraju 2012-04-11 191 inc_mm_counter(mm, MM_ANONPAGES);
7396fa818d6278 kernel/events/uprobes.c Srikar Dronamraju 2012-04-11 192 }
7396fa818d6278 kernel/events/uprobes.c Srikar Dronamraju 2012-04-11 193
c33c794828f212 kernel/events/uprobes.c Ryan Roberts 2023-06-12 194 flush_cache_page(vma, addr, pte_pfn(ptep_get(pvmw.pte)));
ec8832d007cb7b kernel/events/uprobes.c Alistair Popple 2023-07-25 195 ptep_clear_flush(vma, addr, pvmw.pte);
fb4fb04ff4dd37 kernel/events/uprobes.c Song Liu 2019-09-23 196 if (new_page)
b06d4c260e9321 kernel/events/uprobes.c Paolo Bonzini 2024-04-05 197 set_pte_at(mm, addr, pvmw.pte,
14fa2daa15887f kernel/events/uprobes.c Kirill A. Shutemov 2017-02-24 198 mk_pte(new_page, vma->vm_page_prot));
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 199
5cc9695f06b065 kernel/events/uprobes.c David Hildenbrand 2023-12-20 200 folio_remove_rmap_pte(old_folio, old_page, vma);
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 201) if (!folio_mapped(old_folio))
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 202) folio_free_swap(old_folio);
14fa2daa15887f kernel/events/uprobes.c Kirill A. Shutemov 2017-02-24 203 page_vma_mapped_walk_done(&pvmw);
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 204) folio_put(old_folio);
194f8dcbe9629d kernel/events/uprobes.c Oleg Nesterov 2012-07-29 205
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 206 err = 0;
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 207 unlock:
ac46d4f3c43241 kernel/events/uprobes.c Jérôme Glisse 2018-12-28 208 mmu_notifier_invalidate_range_end(&range);
5fcd079af9ed4e kernel/events/uprobes.c Matthew Wilcox (Oracle 2022-09-02 209) folio_unlock(old_folio);
9f92448ceeea53 kernel/events/uprobes.c Oleg Nesterov 2012-07-29 210 return err;
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 211 }
2b144498350860 kernel/uprobes.c Srikar Dronamraju 2012-02-09 212

:::::: The code at line 160 was first introduced by commit
:::::: ac46d4f3c43241ffa23d5bf36153a0830c0e02cc mm/mmu_notifier: use structure for invalidate_range_start/end calls v2

:::::: TO: Jérôme Glisse <jglisse@redhat.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

--
0-DAY CI Kernel Test Service