aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-01-26 11:50:29 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-01-26 11:50:29 +0000
commit0c28d0d07fbcd7aa44d231241d444d00882256e2 (patch)
tree3809f083ca1a33cb570304067d3f512fa624297d /scripts
parentd109f80af3ad5c64c8c30e7ab21f2e342b5e9a8d (diff)
parentfc116efad0aadb2f8a49d51240bddbfe21b631a0 (diff)
downloadqemu-0c28d0d07fbcd7aa44d231241d444d00882256e2.zip
qemu-0c28d0d07fbcd7aa44d231241d444d00882256e2.tar.gz
qemu-0c28d0d07fbcd7aa44d231241d444d00882256e2.tar.bz2
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
- Many fixes from the floor as usual - New "edu" device (v1->v2: fix 32-bit compilation) - Disabling HLE and RTM on Haswell & Broadwell - kvm_stat updates - Added --enable-modules to Travis, in preparation for switching the default # gpg: Signature made Mon 26 Jan 2015 11:44:40 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: kvm_stat: Add RESET support for perf event ioctl target-i386: Disable HLE and RTM on Haswell & Broadwell sparse: Fix build with sparse on .S files exec: fix madvise of NULL pointer .travis.yml: Add "--enable-modules" apic: do not dereference pointer before it is checked for NULL kvm_stat: Print errno when syscall to perf_event_open() fails kvm_stat: Update exit reasons to the latest defintion kvm_stat: Add aarch64 support hw: misc, add educational driver vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* qemu-timer: introduce timer_deinit qemu-timer: add timer_init and timer_init_ns/us/ms target-i386: make xmm_regs 512-bit wide target-i386: use vmstate_offset_sub_array for AVX registers tests/multiboot: Add test for modules multiboot: Fix offset of bootloader name tests/multiboot: Update reference output pc: fix KVM features in pc-1.3 and earlier machine types Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kvm/kvm_stat24
1 files changed, 23 insertions, 1 deletions
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index 7b1437c..c0c4ff0 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -13,6 +13,7 @@
import curses
import sys, os, time, optparse, ctypes
+from ctypes import *
class DebugfsProvider(object):
def __init__(self):
@@ -65,6 +66,8 @@ vmx_exit_reasons = {
49: 'EPT_MISCONFIG',
54: 'WBINVD',
55: 'XSETBV',
+ 56: 'APIC_WRITE',
+ 58: 'INVPCID',
}
svm_exit_reasons = {
@@ -138,6 +141,7 @@ svm_exit_reasons = {
0x08a: 'MONITOR',
0x08b: 'MWAIT',
0x08c: 'MWAIT_COND',
+ 0x08d: 'XSETBV',
0x400: 'NPF',
}
@@ -167,6 +171,7 @@ userspace_exit_reasons = {
21: 'WATCHDOG',
22: 'S390_TSCH',
23: 'EPR',
+ 24: 'SYSTEM_EVENT',
}
x86_exit_reasons = {
@@ -181,6 +186,7 @@ ioctl_numbers = {
'SET_FILTER' : 0x40082406,
'ENABLE' : 0x00002400,
'DISABLE' : 0x00002401,
+ 'RESET' : 0x00002403,
}
def x86_init(flag):
@@ -204,10 +210,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'):
@@ -235,6 +249,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),
@@ -318,7 +335,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)
@@ -329,6 +347,9 @@ class Event(object):
def disable(self):
import fcntl
fcntl.ioctl(self.fd, ioctl_numbers['DISABLE'], 0)
+ def reset(self):
+ import fcntl
+ fcntl.ioctl(self.fd, ioctl_numbers['RESET'], 0)
class TracepointProvider(object):
def __init__(self):
@@ -388,6 +409,7 @@ class TracepointProvider(object):
for group in self.group_leaders:
for event in group.events:
if event.name in fields:
+ event.reset()
event.enable()
else:
event.disable()