s390/kvm_stat: correct sys_perf_event_open syscall number
Correct sys_perf_event_open syscall number for s390 architecture - the hardcoded syscall number 298 is for x86 but should be different for other architectures. In case we figure out via /proc/cpuinfo that we are running on s390 the appropriate syscall number is used from map syscall_numbers; other architectures can extend this. Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
235a3f0bed
commit
1b3e6f88dc
|
@ -170,6 +170,12 @@ vendor_exit_reasons = {
|
||||||
'IBM/S390': s390_exit_reasons,
|
'IBM/S390': s390_exit_reasons,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syscall_numbers = {
|
||||||
|
'IBM/S390': 331,
|
||||||
|
}
|
||||||
|
|
||||||
|
sc_perf_evt_open = 298
|
||||||
|
|
||||||
exit_reasons = None
|
exit_reasons = None
|
||||||
|
|
||||||
for line in file('/proc/cpuinfo').readlines():
|
for line in file('/proc/cpuinfo').readlines():
|
||||||
|
@ -177,7 +183,8 @@ for line in file('/proc/cpuinfo').readlines():
|
||||||
for flag in line.split():
|
for flag in line.split():
|
||||||
if flag in vendor_exit_reasons:
|
if flag in vendor_exit_reasons:
|
||||||
exit_reasons = vendor_exit_reasons[flag]
|
exit_reasons = vendor_exit_reasons[flag]
|
||||||
|
if flag in syscall_numbers:
|
||||||
|
sc_perf_evt_open = syscall_numbers[flag]
|
||||||
filters = {
|
filters = {
|
||||||
'kvm_exit': ('exit_reason', exit_reasons)
|
'kvm_exit': ('exit_reason', exit_reasons)
|
||||||
}
|
}
|
||||||
|
@ -206,7 +213,7 @@ class perf_event_attr(ctypes.Structure):
|
||||||
('bp_len', ctypes.c_uint64),
|
('bp_len', ctypes.c_uint64),
|
||||||
]
|
]
|
||||||
def _perf_event_open(attr, pid, cpu, group_fd, flags):
|
def _perf_event_open(attr, pid, cpu, group_fd, flags):
|
||||||
return syscall(298, ctypes.pointer(attr), ctypes.c_int(pid),
|
return syscall(sc_perf_evt_open, ctypes.pointer(attr), ctypes.c_int(pid),
|
||||||
ctypes.c_int(cpu), ctypes.c_int(group_fd),
|
ctypes.c_int(cpu), ctypes.c_int(group_fd),
|
||||||
ctypes.c_long(flags))
|
ctypes.c_long(flags))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue