kvm_stat update
PATCH 1/3 kvm_stat: Add aarch64 support
In reply to Wei HuangThis patch enables aarch64 support for kvm_stat. The platform detection is based on OS uname.
--- scripts/kvm/kvm_stat | 8 ++++++++ 1 file changed, 8 insertions(+)
scripts/kvm/kvm_stat +8 -0
@@ -204,10 +204,18 @@ def ppc_init(): } }) +def aarch64_init(): + globals().update({ + 'sc_perf_evt_open' : 241 + }) + def detect_platform(): if os.uname()[4].startswith('ppc'): ppc_init() return + elif os.uname()[4].startswith('aarch64'): + aarch64_init() + return for line in file('/proc/cpuinfo').readlines(): if line.startswith('flags'):
Signature · 1 line
1.8.3.1
cover kvm_stat update
This patch set updates kvm_stat with the following new features:
* support for ARM aarch64
* the latest exit reasons (vmx, svm and userspace)
* print errno when syscall fails
Thanks,
-Wei
*** BLURB HERE ***
Wei Huang (3):
kvm_stat: Add aarch64 support
kvm_stat: Update exit reasons to the latest defintion
kvm_stat: Print errno when syscall to perf_event_open() fails
scripts/kvm/kvm_stat | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
PATCH 2/3 kvm_stat: Update exit reasons to the latest defintion
This patch updates the exit reasons for x86_vmx, x86_svm, and userspace to the latest definition.
--- scripts/kvm/kvm_stat | 4 ++++ 1 file changed, 4 insertions(+)
scripts/kvm/kvm_stat +4 -0
@@ -65,6 +65,8 @@ vmx_exit_reasons = { 49: 'EPT_MISCONFIG', 54: 'WBINVD', 55: 'XSETBV', + 56: 'ACPI_WRITE', + 58: 'INVPCID', } svm_exit_reasons = {
@@ -138,6 +140,7 @@ svm_exit_reasons = { 0x08a: 'MONITOR', 0x08b: 'MWAIT', 0x08c: 'MWAIT_COND', + 0x08d: 'XSETBV', 0x400: 'NPF', }
@@ -167,6 +170,7 @@ userspace_exit_reasons = { 21: 'WATCHDOG', 22: 'S390_TSCH', 23: 'EPR', + 24: 'SYSTEM_EVENT', } x86_exit_reasons = {
Signature · 1 line
1.8.3.1
PATCH 3/3 kvm_stat: Print errno when syscall to perf_event_open() fails
In reply to Wei Huangkvm_stat uses syscall() to call perf_event_open(). If this function call fails, the returned value is -1, which doesn't tell the details of such failure (i.e. ENOSYS or EINVAL). This patch retrieves errno and prints it when syscall() fails. The error message will look like "Exception: perf_event_open failed, errno = 38".
--- scripts/kvm/kvm_stat | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/kvm/kvm_stat +6 -1
@@ -13,6 +13,7 @@ import curses import sys, os, time, optparse, ctypes +from ctypes import * class DebugfsProvider(object): def __init__(self):
@@ -247,6 +248,9 @@ import struct, array libc = ctypes.CDLL('libc.so.6') syscall = libc.syscall +get_errno = libc.__errno_location +get_errno.restype = POINTER(c_int) + class perf_event_attr(ctypes.Structure): _fields_ = [('type', ctypes.c_uint32), ('size', ctypes.c_uint32),
@@ -330,7 +334,8 @@ class Event(object): group_leader = group.events[0].fd fd = _perf_event_open(attr, -1, group.cpu, group_leader, 0) if fd == -1: - raise Exception('perf_event_open failed') + err = get_errno()[0] + raise Exception('perf_event_open failed, errno = ' + err.__str__()) if filter: import fcntl fcntl.ioctl(fd, ioctl_numbers['SET_FILTER'], filter)
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 2/3] kvm_stat: Update exit reasons to the latest defintion
In reply to Wei HuangQuoted 1 line · Wei Huang
+ 56: '
ACPI_WRITE',
APIC_WRITE. :)
Will fix when committing.
Paolo
Quoted 3 lines
+ 58: 'INVPCID',
}
Re: [Qemu-devel] [PATCH 2/3] kvm_stat: Update exit reasons to the latest defintion
Quoted 8 lines · Paolo Bonzini
Quoted 1 line · Wei Huang
+ 56: '
ACPI_WRITE',
APIC_WRITE. :)Will fix when committing.
Gerr... thanks!
-Wei
Quoted 7 lines
Paolo
Quoted 3 lines
+ 58: 'INVPCID',
}
Re: [Qemu-devel] [PATCH 2/3] kvm_stat: Update exit reasons to the latest defintion
Hi Paolo,
I just sent out the second revision. You can cherry-pick the patch 04 if you have already queued my previous 3 patches.
Thanks for your review.
-Wei
Quoted 20 lines · Wei Huang
Quoted 8 lines · Paolo Bonzini
Quoted 1 line · Wei Huang
+ 56: '
ACPI_WRITE',
APIC_WRITE. :)Will fix when committing.
Gerr... thanks!
-Wei
Quoted 7 lines
Paolo
Quoted 3 lines
+ 58: 'INVPCID',
}