From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3A23C43461 for ; Tue, 20 Apr 2021 13:34:10 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 61546613B2 for ; Tue, 20 Apr 2021 13:34:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61546613B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E4E484B3F1; Tue, 20 Apr 2021 09:34:09 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9iID8okFhR+6; Tue, 20 Apr 2021 09:34:08 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6EB714B3CA; Tue, 20 Apr 2021 09:34:07 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6496E4B384 for ; Tue, 20 Apr 2021 09:08:50 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m8pxGGsOnuWo for ; Tue, 20 Apr 2021 09:08:46 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2BDEA4B381 for ; Tue, 20 Apr 2021 09:08:46 -0400 (EDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B23DE1478; Tue, 20 Apr 2021 06:08:45 -0700 (PDT) Received: from yoan-MS-7758.Home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 55ED03F792; Tue, 20 Apr 2021 06:08:44 -0700 (PDT) From: Yoan Picchi To: maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 1/3] KVM: arm64: Add a stage2 page fault counter for kvm_stat Date: Tue, 20 Apr 2021 14:08:23 +0100 Message-Id: <20210420130825.15585-2-yoan.picchi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210420130825.15585-1-yoan.picchi@arm.com> References: <20210420130825.15585-1-yoan.picchi@arm.com> X-Mailman-Approved-At: Tue, 20 Apr 2021 09:34:06 -0400 Cc: catalin.marinas@arm.com, Yoan Picchi , will@kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu This counter is meant to detect stage 2 page fault exits. This is meant to measure how much those page fault influence the performance (by comparing this number of exits to some other exit causes). For now this counter is generic, but some more granularity is planned in the next commits so that one know how much of the page fault are for memory allocation, or for mmio for instance. The idea being that one using this counter can get a better idea of what is trigerring those exits to try to fix it. Signed-off-by: Yoan Picchi --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/guest.c | 1 + arch/arm64/kvm/mmu.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 3d10e6527..02891ce94 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -561,6 +561,7 @@ struct kvm_vcpu_stat { u64 wfi_exit_stat; u64 mmio_exit_user; u64 mmio_exit_kernel; + u64 stage2_abort_exit; u64 exits; }; diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 9bbd30e62..82a4b6275 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -38,6 +38,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { VCPU_STAT("wfi_exit_stat", wfi_exit_stat), VCPU_STAT("mmio_exit_user", mmio_exit_user), VCPU_STAT("mmio_exit_kernel", mmio_exit_kernel), + VCPU_STAT("stage2_abort_exit", stage2_abort_exit), VCPU_STAT("exits", exits), VCPU_STAT("halt_poll_success_ns", halt_poll_success_ns), VCPU_STAT("halt_poll_fail_ns", halt_poll_fail_ns), diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 77cb2d28f..c3527ccf6 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -966,6 +966,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); is_iabt = kvm_vcpu_trap_is_iabt(vcpu); + /* Synchronous External Abort? */ if (kvm_vcpu_abt_issea(vcpu)) { /* @@ -980,6 +981,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_esr(vcpu), kvm_vcpu_get_hfar(vcpu), fault_ipa); + vcpu->stat.stage2_abort_exit++; /* Check the stage-2 fault is trans. fault or write fault */ if (fault_status != FSC_FAULT && fault_status != FSC_PERM && -- 2.17.1 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DBC1C433B4 for ; Tue, 20 Apr 2021 13:11:06 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A79AA613C5 for ; Tue, 20 Apr 2021 13:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A79AA613C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7oQ8r2z3u1n5VIIHnpiPt41GmInSbIBS539tGuZAp9k=; b=Xn18Dqba22KGWxB8SL87qE4Lhv IC4PI5lgrLzB3I3CaygYe0bM6q6tXWcZuS94qTk0d2Dcev2WXvavqPybwW/qnp8gt4ZjELza7Wa/m gKNxpvRUy3NkSMWxHeTcf8+HfUtsfjrg9p/IkTLdhoYHXuYanamTESCrJvODlLy43wczF6jxyeSqL z+2i0xEkO1NVbrcFhU0pp3PhKXjlSYWMVpjT/qJ02LpG402uQ7pVBApiEEb0QUCws5Sk23s0Ct5I+ ikz7aNi3c1vexCts/CO/GZwLpsouQryGr1Vn4ntskNAP9FjCdBjSTR4s4vgPn/t1JObZQsgVFfVXQ MgowaMqA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYq7e-00CA6k-8F; Tue, 20 Apr 2021 13:08:59 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYq7V-00CA5r-1X for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 13:08:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=30shxpscWJOWGJoSTNW74s02xRnaQE/4HEt3D6qTjuU=; b=TykhvfVGni73qAhFbf+intDpWG b6JcLWno6Z13mg05vRN09jBwTpB2tpWJ+PRsCsi48TFnOoHqAHqui3cFTp96h8Z3GxMwaQhEmJgdi uKjMab1+Ur+0Fl5xzAxr2+uwvIBc28JIWVrDpke4xrCLYe9pJz8G/z3rr7k9CgLR2cr3vAS5p3yZl BtMyg0L6/ej2XFjaycdlW16J7WgiSrXvaAebVY9oDIAQzVQpRQLUgy6Bz9tmy1liKbdy2HToinXFl jLisnCz1QUi/OvdhnkmVY6BfajvUcIXpqalttlNY8/FYGJQXLtBWb8/U5gRVE3nQNqb5c2dfMxgXo taXn84mg==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYq7S-00C7tZ-Cl for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 13:08:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B23DE1478; Tue, 20 Apr 2021 06:08:45 -0700 (PDT) Received: from yoan-MS-7758.Home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 55ED03F792; Tue, 20 Apr 2021 06:08:44 -0700 (PDT) From: Yoan Picchi To: maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: catalin.marinas@arm.com, will@kernel.org, Yoan Picchi Subject: [PATCH v2 1/3] KVM: arm64: Add a stage2 page fault counter for kvm_stat Date: Tue, 20 Apr 2021 14:08:23 +0100 Message-Id: <20210420130825.15585-2-yoan.picchi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210420130825.15585-1-yoan.picchi@arm.com> References: <20210420130825.15585-1-yoan.picchi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_060846_502522_3D0E3B4B X-CRM114-Status: GOOD ( 12.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This counter is meant to detect stage 2 page fault exits. This is meant to measure how much those page fault influence the performance (by comparing this number of exits to some other exit causes). For now this counter is generic, but some more granularity is planned in the next commits so that one know how much of the page fault are for memory allocation, or for mmio for instance. The idea being that one using this counter can get a better idea of what is trigerring those exits to try to fix it. Signed-off-by: Yoan Picchi --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/guest.c | 1 + arch/arm64/kvm/mmu.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 3d10e6527..02891ce94 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -561,6 +561,7 @@ struct kvm_vcpu_stat { u64 wfi_exit_stat; u64 mmio_exit_user; u64 mmio_exit_kernel; + u64 stage2_abort_exit; u64 exits; }; diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 9bbd30e62..82a4b6275 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -38,6 +38,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { VCPU_STAT("wfi_exit_stat", wfi_exit_stat), VCPU_STAT("mmio_exit_user", mmio_exit_user), VCPU_STAT("mmio_exit_kernel", mmio_exit_kernel), + VCPU_STAT("stage2_abort_exit", stage2_abort_exit), VCPU_STAT("exits", exits), VCPU_STAT("halt_poll_success_ns", halt_poll_success_ns), VCPU_STAT("halt_poll_fail_ns", halt_poll_fail_ns), diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 77cb2d28f..c3527ccf6 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -966,6 +966,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) fault_ipa = kvm_vcpu_get_fault_ipa(vcpu); is_iabt = kvm_vcpu_trap_is_iabt(vcpu); + /* Synchronous External Abort? */ if (kvm_vcpu_abt_issea(vcpu)) { /* @@ -980,6 +981,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_esr(vcpu), kvm_vcpu_get_hfar(vcpu), fault_ipa); + vcpu->stat.stage2_abort_exit++; /* Check the stage-2 fault is trans. fault or write fault */ if (fault_status != FSC_FAULT && fault_status != FSC_PERM && -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel