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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 95671C433C1 for ; Tue, 23 Mar 2021 17:34:57 +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 1697F619C1 for ; Tue, 23 Mar 2021 17:34:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1697F619C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Subject:Cc:To: From:Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5PPC3846Ct7SZUPmptBFWCLdLgzZltTjjzTbyanyLd0=; b=pn4lvXOnkbwrTtGbNiwxNVePJ hYUNCGA0os7gUoNYlXTISSRnkX+BWavUTQCA+rzSkxjWllW36WVchzZA/SlRDqJ+qgW/BtDOYEWg2 S0Zr+f2EHh9AzU7Op2WSVgjgZgeBgd0sxo+ElUzlXvzd53Iy9nSl2d9Fowyjn+anhVAnSPQrtMOSN hKKct+OnfdyeGTWtSIGGeb7MZ4SzcdN8xAy91A6K6mW3OFI5ui9saltRrum395FBI1s2zA8bgB8Gp 7MMCxSLQjw7yTA5xqfVV7XPl9jmWy8RIrlDObV5CSr6p68MFutoO199QzhKiRnw/zguc47NH3tvW0 O8h4uz9Hw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOku0-00FPQ6-C5; Tue, 23 Mar 2021 17:33:12 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOktv-00FPOr-Sc for linux-arm-kernel@lists.infradead.org; Tue, 23 Mar 2021 17:33:10 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CA55619B7; Tue, 23 Mar 2021 17:33:06 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lOkts-003MBA-P5; Tue, 23 Mar 2021 17:33:04 +0000 Date: Tue, 23 Mar 2021 17:33:04 +0000 Message-ID: <87o8f9kc6n.wl-maz@kernel.org> From: Marc Zyngier To: Yoan Picchi Cc: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, catalin.marinas@arm.com, will@kernel.org Subject: Re: [PATCH 5/7] KVM: arm64: Add memory_slot_unmaped counter for kvm_stat In-Reply-To: <20210319161711.24972-6-yoan.picchi@arm.com> References: <20210319161711.24972-1-yoan.picchi@arm.com> <20210319161711.24972-6-yoan.picchi@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: yoan.picchi@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, catalin.marinas@arm.com, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_173308_629185_F103D115 X-CRM114-Status: GOOD ( 24.47 ) 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: , 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 On Fri, 19 Mar 2021 16:17:09 +0000, Yoan Picchi wrote: > > 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. No. It just means it is unmapped from the guest. The VMM still has the pages. > 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++; Why is that a relevant thing to track? You even increment the counter before even checking whether this will unmap anything... :-( M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel