kernel/events/core.c:6524:41: error: 'VMALLOC_END' undeclared; did you mean 'VM_LOCKED'?

From: kbuild test robot
Date: Sun Feb 09 2020 - 21:23:01 EST


Hi Christoph,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fdfa3a6778b194974df77b384cc71eb2e503639a
commit: 6bd33e1ece528f67646db33bf97406b747dafda0 riscv: add nommu support
date: 3 months ago
config: riscv-randconfig-a001-20200210 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 7.5.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 6bd33e1ece528f67646db33bf97406b747dafda0
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=riscv

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from include/linux/perf_event.h:25:0,
from include/linux/trace_events.h:10,
from include/trace/syscall.h:7,
from include/linux/syscalls.h:85,
from kernel/events/core.c:33:
arch/riscv/include/asm/perf_event.h:26:2: error: #error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
^~~~~
arch/riscv/include/asm/perf_event.h:54:28: error: 'RISCV_MAX_COUNTERS' undeclared here (not in a function); did you mean 'RISCV_BASE_COUNTERS'?
struct perf_event *events[RISCV_MAX_COUNTERS];
^~~~~~~~~~~~~~~~~~
RISCV_BASE_COUNTERS
kernel/events/core.c: In function 'perf_virt_to_phys':
>> kernel/events/core.c:6524:41: error: 'VMALLOC_END' undeclared (first use in this function); did you mean 'VM_LOCKED'?
!(virt >= VMALLOC_START && virt < VMALLOC_END))
^~~~~~~~~~~
VM_LOCKED
kernel/events/core.c:6524:41: note: each undeclared identifier is reported only once for each function it appears in

vim +6524 kernel/events/core.c

5622f295b53fb60 kernel/perf_counter.c Markus Metzger 2009-09-15 6512
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6513 static u64 perf_virt_to_phys(u64 virt)
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6514 {
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6515 u64 phys_addr = 0;
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6516 struct page *p = NULL;
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6517
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6518 if (!virt)
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6519 return 0;
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6520
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6521 if (virt >= TASK_SIZE) {
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6522 /* If it's vmalloc()d memory, leave phys_addr as 0 */
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6523 if (virt_addr_valid((void *)(uintptr_t)virt) &&
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 @6524 !(virt >= VMALLOC_START && virt < VMALLOC_END))
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6525 phys_addr = (u64)virt_to_phys((void *)(uintptr_t)virt);
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6526 } else {
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6527 /*
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6528 * Walking the pages tables for user address.
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6529 * Interrupts are disabled, so it prevents any tear down
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6530 * of the page tables.
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6531 * Try IRQ-safe __get_user_pages_fast first.
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6532 * If failed, leave phys_addr as 0.
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6533 */
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6534 if ((current->mm != NULL) &&
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6535 (__get_user_pages_fast(virt, 1, 0, &p) == 1))
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6536 phys_addr = page_to_phys(p) + virt % PAGE_SIZE;
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6537
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6538 if (p)
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6539 put_page(p);
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6540 }
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6541
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6542 return phys_addr;
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6543 }
fc7ce9c74c3ad23 kernel/events/core.c Kan Liang 2017-08-28 6544

:::::: The code at line 6524 was first introduced by commit
:::::: fc7ce9c74c3ad232b084d80148654f926d01ece7 perf/core, x86: Add PERF_SAMPLE_PHYS_ADDR

:::::: TO: Kan Liang <kan.liang@xxxxxxxxx>
:::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip