[PATCH v2 1/3] kvm: decode the argument of KVM_SET_CPUID2 and KVM_GET_*_CPUID ioctl command
Dmitry V. Levin
ldv at altlinux.org
Mon Jul 2 22:34:38 UTC 2018
On Thu, Jun 28, 2018 at 03:37:43AM +0100, Pierre Marsais wrote:
> * configure.ac (AC_CHECK_TYPES): Add struct kvm_cpuid2.
> * kvm.c [HAVE_STRUCT_KVM_CPUID2]: Include "xlat/kvm_cpuid_flags.h".
> [HAVE_STRUCT_KVM_CPUID2] (print_kvm_cpuid_entry, kvm_ioctl_decode_cpuid2):
> New functions.
> (kvm_ioctl) [HAVE_STRUCT_KVM_CPUID2]: Use kvm_ioctl_decode_cpuid2.
> * xlat/kvm_cpuid_flags.in: New file.
>
> Signed-off-by: Pierre Marsais <pierre.marsais at lse.epita.fr>
> ---
> Changes in v2:
> * Follow the GNU ChangeLog style for commit message
> * Improve code style in kvm.c
>
> configure.ac | 1 +
> kvm.c | 61 +++++++++++++++++++++++++++++++++++++++++
> xlat/kvm_cpuid_flags.in | 3 ++
> 3 files changed, 65 insertions(+)
> create mode 100644 xlat/kvm_cpuid_flags.in
>
> diff --git a/configure.ac b/configure.ac
> index 9dec1b23..c1eeb578 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -575,6 +575,7 @@ AC_CHECK_TYPES(m4_normalize([
> ]),,, [#include <linux/ptp_clock.h>])
>
> AC_CHECK_TYPES(m4_normalize([
> + struct kvm_cpuid2,
> struct kvm_regs,
> struct kvm_sregs,
> struct kvm_userspace_memory_region
> diff --git a/kvm.c b/kvm.c
> index 86fd9e50..15beedca 100644
> --- a/kvm.c
> +++ b/kvm.c
> @@ -85,6 +85,60 @@ kvm_ioctl_decode_regs(struct tcb *const tcp, const unsigned int code,
> }
> # endif /* HAVE_STRUCT_KVM_REGS */
>
> +# ifdef HAVE_STRUCT_KVM_CPUID2
> +# include "xlat/kvm_cpuid_flags.h"
[...]
> --- /dev/null
> +++ b/xlat/kvm_cpuid_flags.in
> @@ -0,0 +1,3 @@
> +KVM_CPUID_FLAG_SIGNIFCANT_INDEX
> +KVM_CPUID_FLAG_STATEFUL_FUNC
> +KVM_CPUID_FLAG_STATE_READ_NEXT
Unfortunately, this fails to build with kernel headers that do not contain
linux commit v4.7-rc1~32^2~42; see e.g.
https://travis-ci.org/strace/strace/builds/399322530
Another portability issue is KVM_GET_EMULATED_CPUID constant introduced
by linux commit v3.13-rc1~80^2~32, much later than the current value of
KVM_GET_SUPPORTED_CPUID constant introduced by linux commit
v2.6.25-rc4~97^2~10, see e.g.
https://build.opensuse.org/package/live_build_log/home:ldv_alt/strace/RHEL_7/x86_64
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180703/2b707fcb/attachment.bin>
More information about the Strace-devel
mailing list