From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSoM5-0002hO-IT for qemu-devel@nongnu.org; Mon, 29 Oct 2012 08:22:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSoM0-0000Yk-JZ for qemu-devel@nongnu.org; Mon, 29 Oct 2012 08:22:09 -0400 Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:60399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSoM0-0000YR-Av for qemu-devel@nongnu.org; Mon, 29 Oct 2012 08:22:04 -0400 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Oct 2012 12:22:03 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9TCLsFU61604010 for ; Mon, 29 Oct 2012 12:21:54 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9TCLxTn008471 for ; Mon, 29 Oct 2012 06:22:00 -0600 From: Jens Freimann Date: Mon, 29 Oct 2012 13:13:20 +0100 Message-Id: <1351512805-42964-2-git-send-email-jfrei@linux.vnet.ibm.com> In-Reply-To: <1351512805-42964-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1351512805-42964-1-git-send-email-jfrei@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/6] s390/kvm_stat: correct sys_perf_event_open syscall number List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Heinz Graalfs , qemu-devel , Christian Borntraeger , Jens Freimann , Cornelia Huck , Einar Lueck From: Heinz Graalfs 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 Signed-off-by: Jens Freimann --- scripts/kvm/kvm_stat | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index e8d68f0..762544b 100755 --- a/scripts/kvm/kvm_stat +++ b/scripts/kvm/kvm_stat @@ -170,6 +170,12 @@ vendor_exit_reasons = { 'IBM/S390': s390_exit_reasons, } +syscall_numbers = { + 'IBM/S390': 331, +} + +sc_perf_evt_open = 298 + exit_reasons = None for line in file('/proc/cpuinfo').readlines(): @@ -177,7 +183,8 @@ for line in file('/proc/cpuinfo').readlines(): for flag in line.split(): if flag in vendor_exit_reasons: exit_reasons = vendor_exit_reasons[flag] - + if flag in syscall_numbers: + sc_perf_evt_open = syscall_numbers[flag] filters = { 'kvm_exit': ('exit_reason', exit_reasons) } @@ -206,7 +213,7 @@ class perf_event_attr(ctypes.Structure): ('bp_len', ctypes.c_uint64), ] 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_long(flags)) -- 1.7.12.4