Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1965868ybt; Thu, 2 Jul 2020 19:36:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJvOSqBEPQtuh/lxZ7hDQEFig0Rlt/ibXNptHvTsNKPyw+VpSW9JT3f1VfVBGXD6T0rZv1 X-Received: by 2002:a17:906:c44c:: with SMTP id ck12mr31331428ejb.145.1593743797212; Thu, 02 Jul 2020 19:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593743797; cv=none; d=google.com; s=arc-20160816; b=JYCxR1EOyfPonpNdm8iWX+LbCAPK/5HeAUKHGzNPBvg2rAFXLNmIGmdySMLALlI7O7 vd3neeeAwVGvkoA8/gzOKZVA0z+Ko97xUKW9E8YSZVB8nEfSE89zG2VYr5TnK9vKcXON ETzeVSJTvDNUtcLOA33Zr5sHz5D90TFUYigWSwshZqcGkyXonc4I3Uu9oUYINrhVYU30 Ga6CjM5mph2cE+Y5XXy8Fn+alD+Rz7EDDDvEU6SWnNZjdviEU3WSkvVLQmH7D0S6xuZk IgC5udFY30a1Ry0Lhjb1w0XEGSecec1HFTTvrecKhsWzO4TJHxKTJ+Pg5MeTzNSfZ0Yt vmmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=xYy7+mhFh05JDqDBkjcHs3IVI5MeDT6Ysxbq+zDpz6E=; b=tYLdFasc/hfTZbMx3pSWq+YNuWTfto4NmaEbAXaWss8JtBz+g0Ilbx8uGnHtUiaJDr O0iITwxnDVvwN5wel9tFswSvzSqGWVENlckdFlO6VEOSO1JUthgEbCq7DDSSJw/1OBKW ua/y/X9BX6idrmmVX6TjjWvrUxcklfKhx5AiH7rWo77OmGjyqhTuP79aFXjpJxpjEVHg VqfnBhnebayGwklTkBfkHZUKHxO/rfOsQH/Jamp65jIgE2boDGjyT0XoN1q4Bm9HCHUu furHHTZgKleGMuTPI+yG3LfVLFCwZ7bc40El/FtqeP369th6dEo9/kxZPkerA748CPDY qmkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s5si6988973eja.431.2020.07.02.19.36.13; Thu, 02 Jul 2020 19:36:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726150AbgGCCgG (ORCPT + 99 others); Thu, 2 Jul 2020 22:36:06 -0400 Received: from mga11.intel.com ([192.55.52.93]:52027 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbgGCCgF (ORCPT ); Thu, 2 Jul 2020 22:36:05 -0400 IronPort-SDR: T9V2w7ZbFRO40T3LLRpSOHxsZuBJ58XiXiy9R/Yl6xwsikJaW6bqJHuy6lKFwshGaAghMr9UW0 mXu/VoZHx3Iw== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="145213957" X-IronPort-AV: E=Sophos;i="5.75,306,1589266800"; d="scan'208";a="145213957" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 19:36:04 -0700 IronPort-SDR: T2DxoJ+6pDgQH7e5SIxXyTgQ9QkegMOBSCNjFHu7YUc0H8gIQqRN5KQHpGrfYlDlqtc8ESDZ15 OICltGe0pc2w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,306,1589266800"; d="scan'208";a="278295716" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.152]) by orsmga003.jf.intel.com with ESMTP; 02 Jul 2020 19:36:04 -0700 From: Sean Christopherson To: Marc Zyngier , Paolo Bonzini , Arnd Bergmann Cc: James Morse , Julien Thierry , Suzuki K Poulose , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Gardon , Peter Feiner , Peter Shier , Junaid Shahid , Christoffer Dall Subject: [PATCH v3 00/21] KVM: Cleanup and unify kvm_mmu_memory_cache usage Date: Thu, 2 Jul 2020 19:35:24 -0700 Message-Id: <20200703023545.8771-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only interesting delta from v2 is that patch 18 is updated to handle a conflict with arm64's p4d rework. Resolution was straightforward (famous last words). This series resurrects Christoffer Dall's series[1] to provide a common MMU memory cache implementation that can be shared by x86, arm64 and MIPS. It also picks up a suggested change from Ben Gardon[2] to clear shadow page tables during initial allocation so as to avoid clearing entire pages while holding mmu_lock. The front half of the patches do house cleaning on x86's memory cache implementation in preparation for moving it to common code, along with a fair bit of cleanup on the usage. The middle chunk moves the patches to common KVM, and the last two chunks convert arm64 and MIPS to the common implementation. Fully tested on x86 only. Compile tested patches 14-21 on arm64, MIPS, s390 and PowerPC. v3: - Rebased to kvm/queue, commit a037ff353ba6 ("Merge ... into HEAD") - Collect more review tags. [Ben] v2: - Rebase to kvm-5.8-2, commit 49b3deaad345 ("Merge tag ..."). - Use an asm-generic kvm_types.h for s390 and PowerPC instead of an empty arch-specific file. [Marc] - Explicit document "GFP_PGTABLE_USER == GFP_KERNEL_ACCOUNT | GFP_ZERO" in the arm64 conversion patch. [Marc] - Collect review tags. [Ben] Sean Christopherson (21): KVM: x86/mmu: Track the associated kmem_cache in the MMU caches KVM: x86/mmu: Consolidate "page" variant of memory cache helpers KVM: x86/mmu: Use consistent "mc" name for kvm_mmu_memory_cache locals KVM: x86/mmu: Remove superfluous gotos from mmu_topup_memory_caches() KVM: x86/mmu: Try to avoid crashing KVM if a MMU memory cache is empty KVM: x86/mmu: Move fast_page_fault() call above mmu_topup_memory_caches() KVM: x86/mmu: Topup memory caches after walking GVA->GPA KVM: x86/mmu: Clean up the gorilla math in mmu_topup_memory_caches() KVM: x86/mmu: Separate the memory caches for shadow pages and gfn arrays KVM: x86/mmu: Make __GFP_ZERO a property of the memory cache KVM: x86/mmu: Zero allocate shadow pages (outside of mmu_lock) KVM: x86/mmu: Skip filling the gfn cache for guaranteed direct MMU topups KVM: x86/mmu: Prepend "kvm_" to memory cache helpers that will be global KVM: Move x86's version of struct kvm_mmu_memory_cache to common code KVM: Move x86's MMU memory cache helpers to common KVM code KVM: arm64: Drop @max param from mmu_topup_memory_cache() KVM: arm64: Use common code's approach for __GFP_ZERO with memory caches KVM: arm64: Use common KVM implementation of MMU memory caches KVM: MIPS: Drop @max param from mmu_topup_memory_cache() KVM: MIPS: Account pages used for GPA page tables KVM: MIPS: Use common KVM implementation of MMU memory caches arch/arm64/include/asm/kvm_host.h | 11 --- arch/arm64/include/asm/kvm_types.h | 8 ++ arch/arm64/kvm/arm.c | 2 + arch/arm64/kvm/mmu.c | 56 +++---------- arch/mips/include/asm/kvm_host.h | 11 --- arch/mips/include/asm/kvm_types.h | 7 ++ arch/mips/kvm/mmu.c | 44 ++-------- arch/powerpc/include/asm/Kbuild | 1 + arch/s390/include/asm/Kbuild | 1 + arch/x86/include/asm/kvm_host.h | 14 +--- arch/x86/include/asm/kvm_types.h | 7 ++ arch/x86/kvm/mmu/mmu.c | 129 +++++++++-------------------- arch/x86/kvm/mmu/paging_tmpl.h | 10 +-- include/asm-generic/kvm_types.h | 5 ++ include/linux/kvm_host.h | 7 ++ include/linux/kvm_types.h | 19 +++++ virt/kvm/kvm_main.c | 55 ++++++++++++ 17 files changed, 176 insertions(+), 211 deletions(-) create mode 100644 arch/arm64/include/asm/kvm_types.h create mode 100644 arch/mips/include/asm/kvm_types.h create mode 100644 arch/x86/include/asm/kvm_types.h create mode 100644 include/asm-generic/kvm_types.h -- 2.26.0