From patchwork Wed Jun 12 09:08:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zenghui Yu X-Patchwork-Id: 10989117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3ED041708 for ; Wed, 12 Jun 2019 09:15:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27EB128650 for ; Wed, 12 Jun 2019 09:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19D7C28928; Wed, 12 Jun 2019 09:15:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8D5A28650 for ; Wed, 12 Jun 2019 09:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KYZr8TqqQ6taY5ZwNoxmEldC+ZJwYnf0CGhE7S0SuCA=; b=c/inuhoZCVZlOC 22f9A1wU7GaTD1+U3X+RkSmj8IhfJFzJwZ5U9mKctCPqv8nVdx4yZ96gRHvGMw8YbvcocjwaKIztu wBvzc4aSnPYX/6ZdhqMcfuYPoxqKZ/f17N+W92cs0BqldxVPW79YyzZbZPwBMCJC2Wj9o7uuBq0Ml u2l46HCk14jF774OX0JQU+55YN+E2yw6vFp+21roGyeDReQKIbHKO/Rsso0PtSy43G4vEll9iCH5j nUTBEhKpgMpEvPJdJ36O5knwGMPcX7RGEBrYdDkAzkCAT2U9wl3zdP7OUF79IC1yCx7XfzoX+mHQm dximt7qRgIn2HIOL/tcg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hazLq-0002cL-Hc; Wed, 12 Jun 2019 09:15:26 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hazLR-0001CH-Iy for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2019 09:15:03 +0000 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EF3EA12D63526C173D19; Wed, 12 Jun 2019 17:11:50 +0800 (CST) Received: from HGHY2Y004646261.china.huawei.com (10.184.12.158) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Wed, 12 Jun 2019 17:11:42 +0800 From: Zenghui Yu To: , , , , Subject: [PATCH v1 0/5] perf kvm: Add stat support on arm64 Date: Wed, 12 Jun 2019 09:08:41 +0000 Message-ID: <1560330526-15468-1-git-send-email-yuzenghui@huawei.com> X-Mailer: git-send-email 2.6.4.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.184.12.158] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190612_021501_837776_17A2385E X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, christoffer.dall@arm.com, acme@kernel.org, linuxarm@huawei.com, acme@redhat.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, mingo@redhat.com, wanghaibin.wang@huawei.com, ganapatrao.kulkarni@cavium.com, Zenghui Yu , namhyung@kernel.org, jolsa@redhat.com, xiexiangyou@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 'perf kvm stat report/record' generates a statistical analysis of KVM events and can be used to analyze guest exit reasons. This series tries to add stat support on arm64 (Port perf-kvm-stat to arm64 - this is already supported on x86). "record" enables recording of two pair of tracepoints: - "kvm:kvm_entry" and "kvm:kvm_exit" - "kvm:kvm_trap_enter" and "kvm:kvm_trap_exit" "report" reports statistical analysis of guest exit&trap events. To record kvm events on the host: # perf kvm stat record -a To report kvm VM EXIT events: # perf kvm stat report --event=vmexit To report kvm VM TRAP (synchronous exceptions) events: # perf kvm stat report --event=trap More information can be found at tools/perf/Documentation/perf-kvm.txt. * Patch 1-2 touch KVM/ARM side, with #1 is cleanup and #2 is preparation for perf-kvm-stat support. * Patch 3-5 touch perf side. * Patch 3 adds support for get_cpuid() function on arm64. *RFC!* * Patch 4 adds support for perf-kvm-stat on arm64, with VM-EXIT events. * Patch 5 adds support to report TRAP-EVENT events. Any suggestions, comments and test results will be appreciated. Thanks, zenghui --- Zenghui Yu (5): KVM: arm/arm64: Remove kvm_mmio_emulate tracepoint KVM: arm/arm64: Adjust entry/exit and trap related tracepoints perf tools arm64: Add support for get_cpuid() function perf,kvm/arm64: Add stat support on arm64 perf,kvm/arm64: perf-kvm-stat to report VM TRAP arch/arm64/kvm/handle_exit.c | 3 + arch/arm64/kvm/trace.h | 35 +++++++ tools/perf/arch/arm64/Makefile | 2 + tools/perf/arch/arm64/util/Build | 1 + tools/perf/arch/arm64/util/aarch64_guest_exits.h | 91 +++++++++++++++++ tools/perf/arch/arm64/util/header.c | 74 +++++++++----- tools/perf/arch/arm64/util/kvm-stat.c | 125 +++++++++++++++++++++++ virt/kvm/arm/arm.c | 4 +- virt/kvm/arm/trace.h | 42 ++------ 9 files changed, 317 insertions(+), 60 deletions(-) create mode 100644 tools/perf/arch/arm64/util/aarch64_guest_exits.h create mode 100644 tools/perf/arch/arm64/util/kvm-stat.c