Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6590188rwl; Thu, 29 Dec 2022 16:09:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXtqRsiJsiNui1JUY2OwyAhzciSE21Q1NqlKSMGLeiddmY61jOxEZF+3KgCmFWBYIj27oy+t X-Received: by 2002:a17:902:b713:b0:190:c550:d295 with SMTP id d19-20020a170902b71300b00190c550d295mr31138374pls.9.1672358983405; Thu, 29 Dec 2022 16:09:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672358983; cv=none; d=google.com; s=arc-20160816; b=g9Hyk1rqbP+WzL6QdK15hA6JgKTcQ84HqJ2LcYP/Uf0Gp5aHpHgk5k8hn/xHFUv2zc gcCnhs+zMN/72gb4locRISe0ZLSltU+SyhM2HuWcFEuivihGt5L5twmQHQ0uTJUMmpYS cuxb6tgvOCu5E0xmBTQ3QyYhCkxTlMNvNObl1WyrUpP3ap3cc6mCZ1VmmXJpLKJOSQPj fsFpiN/756v/zGwkC2MplOSUef/wqMMAujhlg4xFTKX46gzT7BPu7dAtPXm+A2rUKZuO qOMr38CFSZxjHDhDq4+vmWftjFBzXzeUkmKAVI+bTcyzI3gRl4ggGF96+ZWrupnOsD4M 0FLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vWTQqj9fLeMGJngGnyZxH0IxP2qo9acI3FCjYeqg6Bs=; b=qsZD279VLJy6c2NgA7R83PloTetZ1djw3S3WbocFNSRn4Mo0Bj3jBImrLVlZohMlpw X+ahONwBpEEVxWvZ4CYcNr60C+EIH6HoN9hKM/vO6DZDizWQ5YRd2JY22TXHO4nzNfCQ +6yd7pHghtgd7slAQr+Bu+AETTKRMAjbSkTMXq2TSRMesuDEDiCgypQQVMEnfryo6/za YhFmjVizdBony66r/+ARgMP7jfPc7tUEWKBgv6SQAIZZqP4A+TKlZSz02DwZabofInAg q4RUcDCcxYr5cz+Y5IvurnYRztMrrYSvomQN1/ojUOx+Tj29DMjjYPEcCoy3oY9G2tqh bX7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ID2SKEAf; 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 u9-20020a170902b28900b00191108745fesi19389738plr.446.2022.12.29.16.09.18; Thu, 29 Dec 2022 16:09:43 -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=ID2SKEAf; 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 S234199AbiL2XSQ (ORCPT + 61 others); Thu, 29 Dec 2022 18:18:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234079AbiL2XSN (ORCPT ); Thu, 29 Dec 2022 18:18:13 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBEB616582 for ; Thu, 29 Dec 2022 15:18:12 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id k137so8727858pfd.8 for ; Thu, 29 Dec 2022 15:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vWTQqj9fLeMGJngGnyZxH0IxP2qo9acI3FCjYeqg6Bs=; b=ID2SKEAfdHOaLFW3OT0zldsRVWOZF0Z1I0WzWXpBQr7JuHGQSbzVTFFPY89Xh95zl2 ThArPmQ76At+xqL5aXRjf7cgMMTxwst1N6F+BF+63BVZCnZyzzFaeVEiPOa2OgufWVj5 8LdqzblM6Hg/q2sxNN1+RY0hT09x/IKcYnYKzTlq3buUIlY1uA50hYhzByrNgnrSAu80 7MkO+5KG4cRSnZVDDgwo0lJZspb98WgHx3iS6Im1ZRTjKlpiSMj6KR4LHLKhMd5sMwmg onyLOuaG9u1kHp6UxJAmAI7R0pj25xnkVLgVK1bylTomQRuwgiS2AlO0JCrDYnByfsQG Zggw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vWTQqj9fLeMGJngGnyZxH0IxP2qo9acI3FCjYeqg6Bs=; b=gmoa5HtL8b6SRSbSi9Odb+ZgqTEQDa1FN7yhiC8eU53xo2Ljh3qc7wN3dfK8ZS4bSe nh8TdBTRNimTxIiMH0JgEk2We+EyXJw75kx8wrxuly1NMU7PuVRdwSAY6nizyllesKUB Js1acMcxxZiZLBq/AUrUYPwmck3N93TqYP8UVQhcLkG594OTEjY5ZUtJhJ55vcS/60Mk TDATgE1E9ZlCXfUXmJeCLm/zKlMdiXodndVGDofI+s/PkC8y4uSgti2rutjJgenOC8jw uXv2P5koa6GPJQMgi5k27t+bLcFiDWrNSVLU7ilxCN2tWkb69HbqKRBQrHB3dLbT2dtU +jyQ== X-Gm-Message-State: AFqh2kpK74Bf/7eVgO1jlZHiRp6slMRNo1OMtYckFzELTVlrMfcgouc/ X8ZwdG4rCBvkGRud/N+kQ/tp3g== X-Received: by 2002:a62:1791:0:b0:578:8533:9573 with SMTP id 139-20020a621791000000b0057885339573mr26006122pfx.22.1672355892200; Thu, 29 Dec 2022 15:18:12 -0800 (PST) Received: from google.com (223.103.125.34.bc.googleusercontent.com. [34.125.103.223]) by smtp.gmail.com with ESMTPSA id y65-20020a623244000000b00574db8ca00fsm12510101pfy.185.2022.12.29.15.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 15:18:11 -0800 (PST) Date: Thu, 29 Dec 2022 15:18:07 -0800 From: David Matlack To: Vipin Sharma Cc: seanjc@google.com, pbonzini@redhat.com, bgardon@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Patch v3 8/9] KVM: x86/mmu: Make split_shadow_page_cache NUMA aware Message-ID: References: <20221222023457.1764-1-vipinsh@google.com> <20221222023457.1764-9-vipinsh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221222023457.1764-9-vipinsh@google.com> 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=ham 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 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?