From patchwork Mon Oct 29 18:40:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 195130 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 692CD2C008F for ; Tue, 30 Oct 2012 06:12:14 +1100 (EST) Received: from localhost ([::1]:44855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSuIB-0007ys-M4 for incoming@patchwork.ozlabs.org; Mon, 29 Oct 2012 14:42:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSuHU-0006It-31 for qemu-devel@nongnu.org; Mon, 29 Oct 2012 14:41:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSuHN-0007zs-RY for qemu-devel@nongnu.org; Mon, 29 Oct 2012 14:41:48 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45602 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSuHN-0007za-Ht for qemu-devel@nongnu.org; Mon, 29 Oct 2012 14:41:41 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 0C7B6A2FB8; Mon, 29 Oct 2012 19:41:41 +0100 (CET) From: Alexander Graf To: qemu-devel qemu-devel Date: Mon, 29 Oct 2012 19:40:19 +0100 Message-Id: <1351536024-27536-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1351536024-27536-1-git-send-email-agraf@suse.de> References: <1351536024-27536-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Blue Swirl , Heinz Graalfs , Jens Freimann , Aurelien Jarno Subject: [Qemu-devel] [PATCH 2/7] s390/kvm_stat: correct sys_perf_event_open syscall number X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Signed-off-by: Alexander Graf --- scripts/kvm/kvm_stat | 11 +++++++++-- 1 files 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))