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=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 8DC44C433DF for ; Thu, 11 Jun 2020 16:00:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5BC0F206A4 for ; Thu, 11 Jun 2020 16:00:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VXsWJTWC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BC0F206A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GKvuQIjE4Jw3FG60FjSyRtnLRnAq+myqXNAWxvLApAM=; b=VXsWJTWCoi2Sk7 bFN3vknTpEgM+bMvVQvobCq7lKsaZpYp5iRU7etteWIBR8pm2qcaGKKV2A1hNyJtBz8J+8l8WipYB Lk4bTw3cClOlK408hgyaOC8MvIJQCXK2Tihpkw1i+Px/xoTvnSeph0Mqxott6zY+I1PRFmJb4fWja bwflwPK86QcPYxia9hgleHSi25u+WUXLi4D05LKjnYSt4Iw7HylQ3mbex0sbapyUgp1lP7cUCTVKU zdpU/AEHzu4oTYU0Jb6Nti/S+y/NUyQasHcGitla+8dLktscsnG72NxnMmQtkKqXWxczrS9kNPC8s fNS+jnKIZmg2vafIvEMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjPcV-0007yD-S3; Thu, 11 Jun 2020 15:59:59 +0000 Received: from mga05.intel.com ([192.55.52.43]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjPcS-0007xZ-3e for linux-arm-kernel@lists.infradead.org; Thu, 11 Jun 2020 15:59:57 +0000 IronPort-SDR: dP1XD5sYJeW+nIb/ufdmVvdwnBFHJF3/UW5E7ImQ3tX7B5DOVnesmJA4QzCioKjCpJJ5uGqjnH rVdiWpX/EK6w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 08:59:55 -0700 IronPort-SDR: vlQ6xqosUXqm2IK2atrupqAhPka9ERniiyAolofQ9QLnlgU84Ttdpz9HijVivDLr/IVeArXiV+ xSQxjn+bUQsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,499,1583222400"; d="scan'208";a="306964950" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga008.jf.intel.com with ESMTP; 11 Jun 2020 08:59:54 -0700 Date: Thu, 11 Jun 2020 08:59:54 -0700 From: Sean Christopherson To: Ben Gardon Subject: Re: [PATCH 16/21] KVM: arm64: Drop @max param from mmu_topup_memory_cache() Message-ID: <20200611155954.GH29918@linux.intel.com> References: <20200605213853.14959-1-sean.j.christopherson@intel.com> <20200605213853.14959-17-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200611_085956_165805_DB3BB730 X-CRM114-Status: GOOD ( 19.23 ) 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: Christoffer Dall , Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Paul Mackerras , Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Janosch Frank , Marc Zyngier , Joerg Roedel , Christian Borntraeger , Julien Thierry , Junaid Shahid , Suzuki K Poulose , kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , Peter Shier , linux-mips@vger.kernel.org, James Morse , Paolo Bonzini , Vitaly Kuznetsov , Peter Feiner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 10, 2020 at 03:00:47PM -0700, Ben Gardon wrote: > On Fri, Jun 5, 2020 at 2:39 PM Sean Christopherson > wrote: > > > > Replace the @max param in mmu_topup_memory_cache() and instead use > > ARRAY_SIZE() to terminate the loop to fill the cache. This removes a > > BUG_ON() and sets the stage for moving arm64 to the common memory cache > > implementation. > > > > No functional change intended. > > > > Signed-off-by: Sean Christopherson > > --- > > arch/arm64/kvm/mmu.c | 12 ++++-------- > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > > index a1f6bc70c4e4..9398b66f8a87 100644 > > --- a/arch/arm64/kvm/mmu.c > > +++ b/arch/arm64/kvm/mmu.c > > @@ -124,15 +124,13 @@ static void stage2_dissolve_pud(struct kvm *kvm, phys_addr_t addr, pud_t *pudp) > > put_page(virt_to_page(pudp)); > > } > > > > -static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, > > - int min, int max) > > +static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, int min) > > { > > void *page; > > > > - BUG_ON(max > KVM_NR_MEM_OBJS); > KVM_NR_MEM_OBJS should be undefined as of patch 14 in this series. I'd > recommend changing this to use the new constant you defined in that > patch. My intent was to leave KVM_NR_MEM_OBJS defined by arm64 and MIPS until they move to the common implementation, e.g. this should be defined in arch/arm64/include/asm/kvm_host.h until patch 18. I'll get cross-compiling setup so I can properly test bisection before sending v2. > > if (cache->nobjs >= min) > > return 0; > > - while (cache->nobjs < max) { > > + while (cache->nobjs < ARRAY_SIZE(cache->objects)) { > > page = (void *)__get_free_page(GFP_PGTABLE_USER); > > if (!page) > > return -ENOMEM; > > @@ -1356,8 +1354,7 @@ int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, > > pte = kvm_s2pte_mkwrite(pte); > > > > ret = mmu_topup_memory_cache(&cache, > > - kvm_mmu_cache_min_pages(kvm), > > - KVM_NR_MEM_OBJS); > See above, KVM_NR_MEM_OBJS is undefined as of patch 14. > > + kvm_mmu_cache_min_pages(kvm)); > > if (ret) > > goto out; > > spin_lock(&kvm->mmu_lock); > > @@ -1737,8 +1734,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > > up_read(¤t->mm->mmap_sem); > > > > /* We need minimum second+third level pages */ > > - ret = mmu_topup_memory_cache(memcache, kvm_mmu_cache_min_pages(kvm), > > - KVM_NR_MEM_OBJS); > See above, KVM_NR_MEM_OBJS is undefined as of patch 14. > > + ret = mmu_topup_memory_cache(memcache, kvm_mmu_cache_min_pages(kvm)); > > if (ret) > > return ret; > > > > -- > > 2.26.0 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel