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 AAD4AC433C1 for ; Tue, 23 Mar 2021 17:19:45 +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 3DE3961924 for ; Tue, 23 Mar 2021 17:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DE3961924 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=OafMmAzdvWfqnXNUPQvsF7/sShcTDb8Ak8i3R4tJxsM=; b=dr5flmFLcHQDIfNju9ICoEkvm is2ftAZaS2Z+gQhLzwWuKIvLkKTDbgqdgMb2sdrh50URFioXMCUYCC5OezP8iWJ8ZGZHdetKlm71r HPbFAO6QndEkaWv0s8t9xMISFunPVRNwr/3GcpyjdZ1sNwe229C4mOsbzTTCNE01QKmcs1nCab2Ob ClUhq1Mm39Xt8m2bUiMV6R7QKaE8iAwtP/OQ+e64BSpLLdNnosnMEzmyjW/das8rITQS+U0kD8TBj mGnOesk8ATihhOD4IruCYCpIH8YmrL5ZJygsdnJaZqk6j4YwmtYVOipDJFcHqZQoUkIeMTIB49ss7 kFbrqfKSQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOkfK-00FNkC-83; Tue, 23 Mar 2021 17:18:02 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOkfF-00FNjN-Ue for linux-arm-kernel@lists.infradead.org; Tue, 23 Mar 2021 17:18:00 +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 6554C619C0; Tue, 23 Mar 2021 17:17:56 +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 1lOkfC-003M1B-94; Tue, 23 Mar 2021 17:17:54 +0000 Date: Tue, 23 Mar 2021 17:17:53 +0000 Message-ID: <87r1k5kcvy.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 3/7] KVM: arm64: Add cached_page_invalidated counter for kvm_stat In-Reply-To: <20210319161711.24972-4-yoan.picchi@arm.com> References: <20210319161711.24972-1-yoan.picchi@arm.com> <20210319161711.24972-4-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_171758_355821_5B96FEA1 X-CRM114-Status: GOOD ( 28.53 ) 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:07 +0000, Yoan Picchi wrote: > > Add some counter for when a dpage get invalidated. The counter isn't > in the function that actually do it though because it doesn't have > either a kvm or vcpu argument, so we would have no way to access the > counters. For this reason, the counter have been added to the calling > functions instead. > > Signed-off-by: Yoan Picchi > --- > arch/arm64/include/asm/kvm_host.h | 1 + > arch/arm64/kvm/guest.c | 1 + > arch/arm64/kvm/mmu.c | 5 ++++- > 3 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 863603285..3609aa89d 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -547,6 +547,7 @@ static inline bool __vcpu_write_sys_reg_to_cpu(u64 val, int reg) > > struct kvm_vm_stat { > ulong remote_tlb_flush; > + ulong cached_page_invalidated; > }; > > struct kvm_vcpu_stat { > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c > index 1029976ca..f6b1f0b63 100644 > --- a/arch/arm64/kvm/guest.c > +++ b/arch/arm64/kvm/guest.c > @@ -41,6 +41,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { > VCPU_STAT("regular_page_mapped", regular_page_mapped), > VCPU_STAT("huge_page_mapped", huge_page_mapped), > VM_STAT("remote_tlb_flush", remote_tlb_flush), > + VM_STAT("cached_page_invalidated", cached_page_invalidated), > 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 55d7fe63b..d6ddf5ab8 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -893,8 +893,10 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > if (writable) > prot |= KVM_PGTABLE_PROT_W; > > - if (fault_status != FSC_PERM && !device) > + if (fault_status != FSC_PERM && !device) { > clean_dcache_guest_page(pfn, vma_pagesize); > + kvm->stat.cached_page_invalidated++; > + } > > if (exec_fault) { > prot |= KVM_PGTABLE_PROT_X; > @@ -1166,6 +1168,7 @@ int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) > * just like a translation fault and clean the cache to the PoC. > */ > clean_dcache_guest_page(pfn, PAGE_SIZE); > + kvm->stat.cached_page_invalidated++; > handle_hva_to_gpa(kvm, hva, end, &kvm_set_spte_handler, &pfn); > return 0; > } Given that PoC flushing is only done on translation fault, what are the odds that this would report a different number than that of translation faults (assuming it was actually implemented)? It is also interesting that you attribute the same cost to flushing a 4kB page or a 1GB block. And what does this mean when either FWB or IDC are available? 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