[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/19] kvm_stat: Add RESET support for perf event ioc
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 19/19] kvm_stat: Add RESET support for perf event ioctl |
Date: |
Mon, 26 Jan 2015 10:24:30 +0100 |
From: Wei Huang <address@hidden>
While running kvm_stat using tracepoint on ARM64 hardware (e.g. "kvm_stat
-1 -t"), the initial values of some kvm_userspace_exit counters were found
to be very suspecious. For instance the tracing tool showed that S390_TSCH
was called many times on ARM64 machine, which apparently was wrong.
This patch adds RESET ioctl support for perf monitoring. Before calling
ioctl to enable a perf event, this patch resets the counter first. With
this patch, the init counter values become correct on ARM64 hardware.
Example:
==== before patch ====
kvm_userspace_exit(S390_SIEIC) 1426 0
kvm_userspace_exit(S390_TSCH) 339 0
==== after patch ====
kvm_userspace_exit(S390_SIEIC) 0 0
kvm_userspace_exit(S390_TSCH) 0 0
Signed-off-by: Wei Huang <address@hidden>
---
scripts/kvm/kvm_stat | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index 8f6f007..c0c4ff0 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -186,6 +186,7 @@ ioctl_numbers = {
'SET_FILTER' : 0x40082406,
'ENABLE' : 0x00002400,
'DISABLE' : 0x00002401,
+ 'RESET' : 0x00002403,
}
def x86_init(flag):
@@ -346,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):
@@ -405,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()
--
1.8.3.1
- [Qemu-devel] [PULL 01/19] pc: fix KVM features in pc-1.3 and earlier machine types, (continued)
- [Qemu-devel] [PULL 01/19] pc: fix KVM features in pc-1.3 and earlier machine types, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 07/19] qemu-timer: add timer_init and timer_init_ns/us/ms, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 09/19] vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR*, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 02/19] tests/multiboot: Update reference output, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 11/19] kvm_stat: Add aarch64 support, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 14/19] apic: do not dereference pointer before it is checked for NULL, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 10/19] hw: misc, add educational driver, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 15/19] .travis.yml: Add "--enable-modules", Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 08/19] qemu-timer: introduce timer_deinit, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 17/19] sparse: Fix build with sparse on .S files, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 19/19] kvm_stat: Add RESET support for perf event ioctl,
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/19] kvm_stat: Update exit reasons to the latest defintion, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 16/19] exec: fix madvise of NULL pointer, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 13/19] kvm_stat: Print errno when syscall to perf_event_open() fails, Paolo Bonzini, 2015/01/26
- [Qemu-devel] [PULL 18/19] target-i386: Disable HLE and RTM on Haswell & Broadwell, Paolo Bonzini, 2015/01/26
- Re: [Qemu-devel] [PULL 00/19] i386, KVM, misc changes for 2015-01-26, Peter Maydell, 2015/01/26