New: kvm selftests build fail
https://bugzilla.kernel.org/show_bug.cgi?id=216365
Bug ID: 216365
Summary: kvm selftests build fail
Product: Virtualization
Version: unspecified
Kernel Version: 5.20
Hardware: Intel
OS: Linux
Tree: Mainline
Status: NEW
Severity: high
Priority: P1
Component: kvm
Assignee: [email protected]
Reporter: [email protected]
Regression: No
Environment:
Host kernel: 5.19.0-rc8
Host OS: rhel8.3
upstream kvm repo: https://git.kernel.org/pub/scm/virt/kvm/kvm.git
branch: next
commit: 19a7cc817a380f7a412d7d76e145e9e2bc47e52f
GCC version: gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
Bug Detailed Description:
Error happens when trying to compile upstream kvm selftests.
git clone https://git.kernel.org/pub/scm/virt/kvm/kvm.git
git checkout -b next origin/next
cd kvm/tools/testing/selftests/kvm
make
Expected results:
Successfully build
Actual results:
gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 -fno-stack-protector -fno-PIE -I../../../../tools/include -I../../../../tools/arch/x86/include -I../../../../usr/include/ -Iinclude -Ilib
-Iinclude/x86_64 -I ../rseq -I.. -c lib/assert.c -o/home/lxy/kvm/tools/testing/selftests/kvm/lib/assert.o
gcc -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 -fno-stack-protector -fno-PIE -I../../../../tools/include -I../../../../tools/arch/x86/include -I../../../../usr/include/ -Iinclude -Ilib
-Iinclude/x86_64 -I ../rseq -I.. -c lib/elf.c -o/home/lxy/kvm/tools/testing/selftests/kvm/lib/elf.o
In file included from include/kvm_util.h:10,
from lib/elf.c:13:
include/kvm_util_base.h:93:26: error: field ‘stats_header’ has incomplete type
struct kvm_stats_header stats_header;
^~~~~~~~~~~~
In file included from ../../../../tools/include/linux/kernel.h:8,
from ../../../../tools/include/linux/list.h:7,
from ../../../../tools/include/linux/hashtable.h:10,
from include/kvm_util_base.h:13,
from include/kvm_util.h:10,
from lib/elf.c:13:
include/kvm_util_base.h: In function ‘kvm_vm_reset_dirty_ring’:
include/kvm_util_base.h:308:24: error: ‘KVM_RESET_DIRTY_RINGS’ undeclared
(first use in this function); did you mean ‘KVM_GET_DIRTY_LOG’?
return __vm_ioctl(vm, KVM_RESET_DIRTY_RINGS, NULL);
^~~~~~~~~~~~~~~~~~~~~
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:216:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vm)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:308:9: note: in expansion of macro ‘__vm_ioctl’
return __vm_ioctl(vm, KVM_RESET_DIRTY_RINGS, NULL);
^~~~~~~~~~
include/kvm_util_base.h:308:24: note: each undeclared identifier is reported
only once for each function it appears in
return __vm_ioctl(vm, KVM_RESET_DIRTY_RINGS, NULL);
^~~~~~~~~~~~~~~~~~~~~
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:216:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vm)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:308:9: note: in expansion of macro ‘__vm_ioctl’
return __vm_ioctl(vm, KVM_RESET_DIRTY_RINGS, NULL);
^~~~~~~~~~
include/kvm_util_base.h:193:16: error: expression in static assertion is not an
integer
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:216:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vm)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:308:9: note: in expansion of macro ‘__vm_ioctl’
return __vm_ioctl(vm, KVM_RESET_DIRTY_RINGS, NULL);
^~~~~~~~~~
include/kvm_util_base.h: In function ‘vm_get_stats_fd’:
include/kvm_util_base.h:313:26: error: ‘KVM_GET_STATS_FD’ undeclared (first use
in this function); did you mean ‘KVM_GET_SREGS’?
int fd = __vm_ioctl(vm, KVM_GET_STATS_FD, NULL);
^~~~~~~~~~~~~~~~
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:216:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vm)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:313:11: note: in expansion of macro ‘__vm_ioctl’
int fd = __vm_ioctl(vm, KVM_GET_STATS_FD, NULL);
^~~~~~~~~~
include/kvm_util_base.h:193:16: error: expression in static assertion is not an
integer
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:216:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vm)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:313:11: note: in expansion of macro ‘__vm_ioctl’
int fd = __vm_ioctl(vm, KVM_GET_STATS_FD, NULL);
^~~~~~~~~~
In file included from include/kvm_util.h:10,
from lib/elf.c:13:
include/kvm_util_base.h: In function ‘read_stats_header’:
include/kvm_util_base.h:323:38: error: dereferencing pointer to incomplete type
‘struct kvm_stats_header’
ret = read(stats_fd, header, sizeof(*header));
^~~~~~~
include/kvm_util_base.h: In function ‘get_stats_descriptor_size’:
include/kvm_util_base.h:338:16: error: invalid application of ‘sizeof’ to
incomplete type ‘struct kvm_stats_desc’
return sizeof(struct kvm_stats_desc) + header->name_size;
^~~~~~
In file included from ../../../../tools/include/linux/kernel.h:8,
from ../../../../tools/include/linux/list.h:7,
from ../../../../tools/include/linux/hashtable.h:10,
from include/kvm_util_base.h:13,
from include/kvm_util.h:10,
from lib/elf.c:13:
include/kvm_util_base.h: In function ‘vcpu_get_stats_fd’:
include/kvm_util_base.h:517:30: error: ‘KVM_GET_STATS_FD’ undeclared (first use
in this function); did you mean ‘KVM_GET_SREGS’?
int fd = __vcpu_ioctl(vcpu, KVM_GET_STATS_FD, NULL);
^~~~~~~~~~~~~~~~
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:235:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vcpu)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:517:11: note: in expansion of macro ‘__vcpu_ioctl’
int fd = __vcpu_ioctl(vcpu, KVM_GET_STATS_FD, NULL);
^~~~~~~~~~~~
include/kvm_util_base.h:193:16: error: expression in static assertion is not an
integer
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^
../../../../tools/include/linux/build_bug.h:79:56: note: in definition of macro
‘__static_assert’
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^~~~include/kvm_util_base.h:193:2: note: in expansion of macro ‘static_assert’
static_assert(!_IOC_SIZE(cmd) || sizeof(*arg) == _IOC_SIZE(cmd), ""); \
^~~~~~~~~~~~~include/kvm_util_base.h:235:2: note: in expansion of macro ‘kvm_do_ioctl’
kvm_do_ioctl((vcpu)->fd, cmd, arg); \
^~~~~~~~~~~~include/kvm_util_base.h:517:11: note: in expansion of macro ‘__vcpu_ioctl’
int fd = __vcpu_ioctl(vcpu, KVM_GET_STATS_FD, NULL);
^~~~~~~~~~~~
In file included from include/kvm_util.h:10,
from lib/elf.c:13:include/kvm_util_base.h: In function ‘__vm_disable_nx_huge_pages’:include/kvm_util_base.h:834:29: error: ‘KVM_CAP_VM_DISABLE_NX_HUGE_PAGES’ undeclared (first use in this function); did you mean ‘KVM_CAP_X86_DISABLE_EXITS’?
return __vm_enable_cap(vm, KVM_CAP_VM_DISABLE_NX_HUGE_PAGES, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
KVM_CAP_X86_DISABLE_EXITSmake: *** [Makefile:229: /home/lxy/kvm/tools/testing/selftests/kvm/lib/elf.o] Error 1
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 216365] kvm selftests build fail
https://bugzilla.kernel.org/show_bug.cgi?id=216365
Yang Lixiao ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DOCUMENTED--- Comment #1 from Yang Lixiao ([email protected]) ---
The failure is because kernel headers are not installed. Executing "make headers_install" on top level Makefile prior to building selftest can solve this problem. KVM has stoped using KSFT_KHDR_INSTALL after july 8 2022 and can't install kernel headers automatically when build selftest.
Some details could be seen in the following patches :f2745dc0ba3dadd8fa2b2c33f48253d78e133a12 selftests: stop using KSFT_KHDR_INSTALL49de12ba06efcba76332054379830f9d04541492 selftests: drop KSFT_KHDR_INSTALL make target
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.