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=-17.0 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,URIBL_BLOCKED, 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 E095AC433C1 for ; Fri, 19 Mar 2021 16:20:18 +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 7A9116194A for ; Fri, 19 Mar 2021 16:20:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A9116194A 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=dgY7Ni333GdJCBc94jIMaco6NL8CrpnfFLy7U3AEC4o=; b=kUPr4H4kaGjQ0BH3Tu4ndvxFsR 0/zOyFvBT9bxoU9gTsH6KMay1PRVy/KJyyyda41uHWQd/z/PNxtOkKU0/ooFgb9IfXSLeNhN7gD51 5dpHuL8uVMrEuLm/iDnKdJr9sAY6MH2aYXQ3cRDwHiZ6s1SL43d/gIZy+/z45mBi3BJXN+jPmYJ/h tk4KfMAfNHCNkSPbOQQeKptR5JPOuXKRpC4a3peTnQmBTt/urQQm1zMtDoXT+WsH7RIQpfUl3eOI/ JgBjLlSh+nwlLCxyP7GUa4A1LFlo40BsOvE6gVOC1jRA2wzCRb3xm1+iUUb83TBt3RgScDBsioBgv l/NruZQw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNHps-007gEA-Rb; Fri, 19 Mar 2021 16:18:52 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNHpC-007g6Y-Lq for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 16:18:12 +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 0247911FB; Fri, 19 Mar 2021 09:18:06 -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 8CF693F718; Fri, 19 Mar 2021 09:18:04 -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 5/7] KVM: arm64: Add memory_slot_unmaped counter for kvm_stat Date: Fri, 19 Mar 2021 16:17:09 +0000 Message-Id: <20210319161711.24972-6-yoan.picchi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210319161711.24972-1-yoan.picchi@arm.com> References: <20210319161711.24972-1-yoan.picchi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_161810_926532_6755D26B X-CRM114-Status: GOOD ( 10.61 ) 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 Add a counter for when a memory slot is unmapped, meaning that all memory belonging to a specific VM is made available to be mapped for anoother VM. A memory slot is the memory that can be used to hold a guest's pages and can be made available by Qemu for instance. For now the memory slot are only unmapped when a vm restarts. Signed-off-by: Yoan Picchi --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/guest.c | 1 + arch/arm64/kvm/mmu.c | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index e6967951f..76c81aa79 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -548,6 +548,7 @@ static inline bool __vcpu_write_sys_reg_to_cpu(u64 val, int reg) struct kvm_vm_stat { ulong remote_tlb_flush; ulong flush_all_cache_lines; + ulong memory_slot_unmaped; ulong cached_page_invalidated; }; diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index d948c3bd2..cd227136e 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -42,6 +42,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { VCPU_STAT("huge_page_mapped", huge_page_mapped), VM_STAT("remote_tlb_flush", remote_tlb_flush), VM_STAT("flush_all_cache_lines", flush_all_cache_lines), + VM_STAT("memory_slot_unmaped", memory_slot_unmaped), VM_STAT("cached_page_invalidated", cached_page_invalidated), VCPU_STAT("exits", exits), VCPU_STAT("halt_poll_success_ns", halt_poll_success_ns), diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 985b048df..1e8aeafc2 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -419,6 +419,7 @@ static void stage2_unmap_memslot(struct kvm *kvm, phys_addr_t addr = memslot->base_gfn << PAGE_SHIFT; phys_addr_t size = PAGE_SIZE * memslot->npages; hva_t reg_end = hva + size; + kvm->stat.memory_slot_unmaped++; /* * A memory region could potentially cover multiple VMAs, and any holes -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel