Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12256247rwl; Tue, 3 Jan 2023 11:20:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXv/QRXNw6RMvwK9JurUm844Hn2qAb2tSMlIif/NEMmPPZzwLq2yHTf9umBnac/PcaLYVGba X-Received: by 2002:a17:90b:905:b0:225:dfb6:e8a0 with SMTP id bo5-20020a17090b090500b00225dfb6e8a0mr37293393pjb.38.1672773651715; Tue, 03 Jan 2023 11:20:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672773651; cv=none; d=google.com; s=arc-20160816; b=j1qisRgcyGra3NjQRPfXcUmJ29U8dMdcLpjTL2S44cGrXTmNE4EzehZ6xWDdGefjoY jdsLfU9tHlSsl8SArmJqj4Pu6D7wWaNN0R55DKaqa6ReEL9aYwF/BQwG4VG7/YqRE57z jhz9a6nzYWab7hqmwZoVHCeNjb8ttK0JJvdU5F/3/axmLe0uPQRbgB72BXT/DrYTAS/O 0tr+sDtFxfzQX1t7C+WYUjQMAiaOvJplA8GqHb40tMVM9lPN8DCBgLmylMu1wRZXazCz 5WgPgrLjKTmDkTZIn4DCuuMXm6yJVNis37YU5Ei1hbdppnB89A75Z9evh3nvo+77NlQj jRoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kD5iCtmMtoY9zsUWZCFp6s8wajpgXbqSKtnkj2WC3Sw=; b=WlYf3Im29ugaJ4yxJFjmbrIEjxxwU9pGNhMxgDdN5/DRYM8W1rDo9CRXk/MaC3Iw3O ZGvyGOtqzUTmCL7HK6iCJeSFagnxLVosQZMPIFF3JYqqFYX9y6SgRZytPs5i0zDj9K0o YG1AxY3I7Y97MQWRDtGdpn+Bd6bSvOd5XDZuV8O6gdDv7HcNFQVqzQWPni7EdvTDSp9x 6cAsipH6uKlWf6HZCBtavK79qynCgCgThrFwVnrkQGs55vpJoQBW8+sVdynaDvNBqRqS lnbF0yiTUi33TF0yushnMakopWQYDB3yTKbvu77qZffNgc/aoxe0iABPibfVY8/VQj1P TV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L69g2USY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a17090ad34f00b0020a47a4c951si31415088pjx.147.2023.01.03.11.20.44; Tue, 03 Jan 2023 11:20:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L69g2USY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238644AbjACSur (ORCPT + 59 others); Tue, 3 Jan 2023 13:50:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238802AbjACSt6 (ORCPT ); Tue, 3 Jan 2023 13:49:58 -0500 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D424C13F36 for ; Tue, 3 Jan 2023 10:49:47 -0800 (PST) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-4a263c4ddbaso110854327b3.0 for ; Tue, 03 Jan 2023 10:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kD5iCtmMtoY9zsUWZCFp6s8wajpgXbqSKtnkj2WC3Sw=; b=L69g2USYZkrgZ0NBPPovmuZzIm0GkBKlaw7kOr6MsNMHL5yfYxZmdW8n/WZo7h27Ov a8wEcdkm3ACX7AMviZn5cczTFZDZnd6E1mjtn0dAIBg0VO89RYGO5P50EX12+cKD0rMf GOxXDEL1e2WxSEU1X3DRI2dllts9D+GJWtDtrTHdUshkFyJQMbWC985rnA4b/DbPanJX wC+oZneFvhy8Er8/9waMD7X8gLM54afCq3eEQUEY6q/sOzMIhKMLGdquLvJkWl9BOrq6 6Kl69DbvaddqEQoaLmOPy+JBkF8Wjf7dXKaH5O6F6uQs5t4Ii4ATiIpsuE5oz/GL4m04 jl3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kD5iCtmMtoY9zsUWZCFp6s8wajpgXbqSKtnkj2WC3Sw=; b=sSI8JGPtP106I6ZjyPinlif85mBTktG/KmMd3eDNBP3mBtQIj3Vn4dZDWaYdA4KyZv NUfQeelqXUHF/U2xuG6gqGcbi8lyiLFVSkM/BhWpEhJJjvcEypowOoRo893ifNwZ6Hs8 VMHs/+yulPtPnBkKUH2v1kfo5h8k7HtscemQ9LF3SCevDefjxBwmDiHO/rDRmg165FmE PkwMZGoLE181jmNmqfDjwsdzegP/7HpotKVhypdztd/eM579eMWK0VRRTHNAzMGhndiz bRp8Tp34rUB8i9IPQJDI5mOC+js3zQIgYTUld0ugsLHU+StnJLBd69HZCkYiEWlot+6H Pcgg== X-Gm-Message-State: AFqh2ko3BCOFBiGALHXiQ3sWQM5dVayEkb5OYW5fcSMyVDEeMZNvRTAq MDtPfV43JlCfI63e9J0ZLnxVy1yjFep+iGi+YFl/ig== X-Received: by 2002:a0d:e2c1:0:b0:474:1969:ed89 with SMTP id l184-20020a0de2c1000000b004741969ed89mr3051604ywe.175.1672771786812; Tue, 03 Jan 2023 10:49:46 -0800 (PST) MIME-Version: 1.0 References: <20221222023457.1764-1-vipinsh@google.com> <20221222023457.1764-9-vipinsh@google.com> In-Reply-To: From: Vipin Sharma Date: Tue, 3 Jan 2023 10:49:11 -0800 Message-ID: Subject: Re: [Patch v3 8/9] KVM: x86/mmu: Make split_shadow_page_cache NUMA aware To: David Matlack Cc: seanjc@google.com, pbonzini@redhat.com, bgardon@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 29, 2022 at 3:18 PM David Matlack wrote: > > On Wed, Dec 21, 2022 at 06:34:56PM -0800, Vipin Sharma wrote: > > Make split_shadow_page_cache NUMA aware and allocate page table's pages > > during the split based on the underlying physical page's NUMA node. > > > > Signed-off-by: Vipin Sharma > > --- > > arch/x86/include/asm/kvm_host.h | 2 +- > > arch/x86/kvm/mmu/mmu.c | 50 ++++++++++++++++++--------------- > > 2 files changed, 29 insertions(+), 23 deletions(-) > > > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index b1f319ad6f89..7b3f36ae37a4 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1410,7 +1410,7 @@ struct kvm_arch { > > * > > * Protected by kvm->slots_lock. > > */ > > - struct kvm_mmu_memory_cache split_shadow_page_cache; > > + struct kvm_mmu_memory_cache split_shadow_page_cache[MAX_NUMNODES]; > > struct kvm_mmu_memory_cache split_page_header_cache; > > > > /* > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index 511c6ef265ee..7454bfc49a51 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -6126,7 +6126,7 @@ static void kvm_mmu_invalidate_zap_pages_in_memslot(struct kvm *kvm, > > int kvm_mmu_init_vm(struct kvm *kvm) > > { > > struct kvm_page_track_notifier_node *node = &kvm->arch.mmu_sp_tracker; > > - int r; > > + int r, nid; > > > > INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); > > INIT_LIST_HEAD(&kvm->arch.possible_nx_huge_pages); > > @@ -6145,8 +6145,9 @@ int kvm_mmu_init_vm(struct kvm *kvm) > > INIT_KVM_MMU_MEMORY_CACHE(&kvm->arch.split_page_header_cache, > > mmu_page_header_cache, NUMA_NO_NODE); > > > > - INIT_KVM_MMU_MEMORY_CACHE(&kvm->arch.split_shadow_page_cache, > > - NULL, NUMA_NO_NODE); > > + for_each_node(nid) > > + INIT_KVM_MMU_MEMORY_CACHE(&kvm->arch.split_shadow_page_cache[nid], > > + NULL, NUMA_NO_NODE); > ^^^^^^^^^^^^ > Should this be nid? Yes, I will fix it in the next version. Thanks