* fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used
@ 2024-11-13 17:06 kernel test robot
2024-11-14 23:56 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-11-13 17:06 UTC (permalink / raw)
To: Qi Xi
Cc: oe-kbuild-all, linux-kernel, Andrew Morton, Linux Memory Management List
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f1b785f4c7870c42330b35522c2514e39a1e28e7
commit: b8ee299855f08539e04d6c1a6acb3dc9e5423c00 fs/proc: fix compile warning about variable 'vmcore_mmap_ops'
date: 6 days ago
config: riscv-randconfig-r071-20241113 (https://download.01.org/0day-ci/archive/20241114/202411140156.2o0nS4fl-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241114/202411140156.2o0nS4fl-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/202411140156.2o0nS4fl-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used [-Wunused-function]
424 | static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf)
| ^~~~~~~~~~~~~~~~~
vim +/mmap_vmcore_fault +424 fs/proc/vmcore.c
9cb218131de1c59 Michael Holzheu 2013-09-11 416
9cb218131de1c59 Michael Holzheu 2013-09-11 417 /*
9cb218131de1c59 Michael Holzheu 2013-09-11 418 * The vmcore fault handler uses the page cache and fills data using the
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 419) * standard __read_vmcore() function.
9cb218131de1c59 Michael Holzheu 2013-09-11 420 *
9cb218131de1c59 Michael Holzheu 2013-09-11 421 * On s390 the fault handler is used for memory regions that can't be mapped
9cb218131de1c59 Michael Holzheu 2013-09-11 422 * directly with remap_pfn_range().
9cb218131de1c59 Michael Holzheu 2013-09-11 423 */
36f062042b0fd9f Souptick Joarder 2018-08-21 @424 static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf)
9cb218131de1c59 Michael Holzheu 2013-09-11 425 {
9cb218131de1c59 Michael Holzheu 2013-09-11 426 #ifdef CONFIG_S390
11bac80004499ea Dave Jiang 2017-02-24 427 struct address_space *mapping = vmf->vma->vm_file->f_mapping;
9cb218131de1c59 Michael Holzheu 2013-09-11 428 pgoff_t index = vmf->pgoff;
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 429) struct iov_iter iter;
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 430) struct kvec kvec;
9cb218131de1c59 Michael Holzheu 2013-09-11 431 struct page *page;
9cb218131de1c59 Michael Holzheu 2013-09-11 432 loff_t offset;
9cb218131de1c59 Michael Holzheu 2013-09-11 433 int rc;
9cb218131de1c59 Michael Holzheu 2013-09-11 434
9cb218131de1c59 Michael Holzheu 2013-09-11 435 page = find_or_create_page(mapping, index, GFP_KERNEL);
9cb218131de1c59 Michael Holzheu 2013-09-11 436 if (!page)
9cb218131de1c59 Michael Holzheu 2013-09-11 437 return VM_FAULT_OOM;
9cb218131de1c59 Michael Holzheu 2013-09-11 438 if (!PageUptodate(page)) {
09cbfeaf1a5a67b Kirill A. Shutemov 2016-04-01 439 offset = (loff_t) index << PAGE_SHIFT;
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 440) kvec.iov_base = page_address(page);
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 441) kvec.iov_len = PAGE_SIZE;
de4eda9de2d957e Al Viro 2022-09-15 442 iov_iter_kvec(&iter, ITER_DEST, &kvec, 1, PAGE_SIZE);
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 443)
4a22fd20379ca89 Matthew Wilcox (Oracle 2022-04-29 444) rc = __read_vmcore(&iter, &offset);
9cb218131de1c59 Michael Holzheu 2013-09-11 445 if (rc < 0) {
9cb218131de1c59 Michael Holzheu 2013-09-11 446 unlock_page(page);
09cbfeaf1a5a67b Kirill A. Shutemov 2016-04-01 447 put_page(page);
b5c212374c85353 Souptick Joarder 2018-10-30 448 return vmf_error(rc);
9cb218131de1c59 Michael Holzheu 2013-09-11 449 }
9cb218131de1c59 Michael Holzheu 2013-09-11 450 SetPageUptodate(page);
9cb218131de1c59 Michael Holzheu 2013-09-11 451 }
9cb218131de1c59 Michael Holzheu 2013-09-11 452 unlock_page(page);
9cb218131de1c59 Michael Holzheu 2013-09-11 453 vmf->page = page;
9cb218131de1c59 Michael Holzheu 2013-09-11 454 return 0;
9cb218131de1c59 Michael Holzheu 2013-09-11 455 #else
9cb218131de1c59 Michael Holzheu 2013-09-11 456 return VM_FAULT_SIGBUS;
9cb218131de1c59 Michael Holzheu 2013-09-11 457 #endif
9cb218131de1c59 Michael Holzheu 2013-09-11 458 }
9cb218131de1c59 Michael Holzheu 2013-09-11 459
:::::: The code at line 424 was first introduced by commit
:::::: 36f062042b0fd9f8e41b97a472f52139886ca26f fs/proc/vmcore.c: use new typedef vm_fault_t
:::::: TO: Souptick Joarder <jrdr.linux@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used
2024-11-13 17:06 fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used kernel test robot
@ 2024-11-14 23:56 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2024-11-14 23:56 UTC (permalink / raw)
To: kernel test robot
Cc: Qi Xi, oe-kbuild-all, linux-kernel, Linux Memory Management List
On Thu, 14 Nov 2024 01:06:42 +0800 kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: f1b785f4c7870c42330b35522c2514e39a1e28e7
> commit: b8ee299855f08539e04d6c1a6acb3dc9e5423c00 fs/proc: fix compile warning about variable 'vmcore_mmap_ops'
> date: 6 days ago
> config: riscv-randconfig-r071-20241113 (https://download.01.org/0day-ci/archive/20241114/202411140156.2o0nS4fl-lkp@intel.com/config)
> compiler: riscv32-linux-gcc (GCC) 14.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241114/202411140156.2o0nS4fl-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/202411140156.2o0nS4fl-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used [-Wunused-function]
> 424 | static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf)
> | ^~~~~~~~~~~~~~~~~
Thanks, I did this:
From: Andrew Morton <akpm@linux-foundation.org>
Subject: fs/proc/vmcore.c: fix warning when CONFIG_MMU=n
Date: Thu Nov 14 03:44:21 PM PST 2024
>> fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used [-Wunused-function]
424 | static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf)
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411140156.2o0nS4fl-lkp@intel.com/
Cc: Qi Xi <xiqi2@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/proc/vmcore.c | 56 ++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 28 deletions(-)
--- a/fs/proc/vmcore.c~fs-proc-vmcorec-fix-warning-when-config_mmu=n
+++ a/fs/proc/vmcore.c
@@ -414,6 +414,34 @@ static ssize_t read_vmcore(struct kiocb
return __read_vmcore(iter, &iocb->ki_pos);
}
+/**
+ * vmcore_alloc_buf - allocate buffer in vmalloc memory
+ * @size: size of buffer
+ *
+ * If CONFIG_MMU is defined, use vmalloc_user() to allow users to mmap
+ * the buffer to user-space by means of remap_vmalloc_range().
+ *
+ * If CONFIG_MMU is not defined, use vzalloc() since mmap_vmcore() is
+ * disabled and there's no need to allow users to mmap the buffer.
+ */
+static inline char *vmcore_alloc_buf(size_t size)
+{
+#ifdef CONFIG_MMU
+ return vmalloc_user(size);
+#else
+ return vzalloc(size);
+#endif
+}
+
+/*
+ * Disable mmap_vmcore() if CONFIG_MMU is not defined. MMU is
+ * essential for mmap_vmcore() in order to map physically
+ * non-contiguous objects (ELF header, ELF note segment and memory
+ * regions in the 1st kernel pointed to by PT_LOAD entries) into
+ * virtually contiguous user-space in ELF layout.
+ */
+#ifdef CONFIG_MMU
+
/*
* The vmcore fault handler uses the page cache and fills data using the
* standard __read_vmcore() function.
@@ -457,34 +485,6 @@ static vm_fault_t mmap_vmcore_fault(stru
#endif
}
-/**
- * vmcore_alloc_buf - allocate buffer in vmalloc memory
- * @size: size of buffer
- *
- * If CONFIG_MMU is defined, use vmalloc_user() to allow users to mmap
- * the buffer to user-space by means of remap_vmalloc_range().
- *
- * If CONFIG_MMU is not defined, use vzalloc() since mmap_vmcore() is
- * disabled and there's no need to allow users to mmap the buffer.
- */
-static inline char *vmcore_alloc_buf(size_t size)
-{
-#ifdef CONFIG_MMU
- return vmalloc_user(size);
-#else
- return vzalloc(size);
-#endif
-}
-
-/*
- * Disable mmap_vmcore() if CONFIG_MMU is not defined. MMU is
- * essential for mmap_vmcore() in order to map physically
- * non-contiguous objects (ELF header, ELF note segment and memory
- * regions in the 1st kernel pointed to by PT_LOAD entries) into
- * virtually contiguous user-space in ELF layout.
- */
-#ifdef CONFIG_MMU
-
static const struct vm_operations_struct vmcore_mmap_ops = {
.fault = mmap_vmcore_fault,
};
_
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-14 23:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-13 17:06 fs/proc/vmcore.c:424:19: warning: 'mmap_vmcore_fault' defined but not used kernel test robot
2024-11-14 23:56 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox