Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp812990ioo; Thu, 26 May 2022 15:49:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye6+G0XtmOhmUUN2l4GUc8zp18LGWNxZauwpFymbJyN9RS+o0HaEHH2wx21ZcnTSInMxKM X-Received: by 2002:a17:907:1c94:b0:6fe:8d29:7d8a with SMTP id nb20-20020a1709071c9400b006fe8d297d8amr35060732ejc.346.1653605391701; Thu, 26 May 2022 15:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653605391; cv=none; d=google.com; s=arc-20160816; b=d7FYUKoEDaLnDfh1gC2ouSe0QDKDxRrmXbiCCkSVTtyBnTEyDt9LTMotQtCxAFip7C x41Q8eeK/7TN0JcHoMkgzXwJiMhaDd/o7vaGSfQN4CV0unTbylCc1mxB+NGkNHJEwhV6 yRtz/54EwOrbfHnsIHv/qXjnCjlr2Iz318CW/J1dVJDEowydKDo5r5WTq6BbvphML51N 529ZFhcBEAD2rRjhRvD46G6lKx6dvC/4ODGvLAGuzmtf2nUDbNawtP+tLCxyiQX9Pdlr qZ0NmqN355Nl74+ghzAjIvV+9pycrZwaGFSFgX2CS4s54YGo1fwq3BjOdyDcYYbf3oqd 28YQ== 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=3mB+0L5ZW4xRVA9Uby65kPSBoLCd3GkHd7PmK18bo5s=; b=cfVaSZoH2l2BY6zR+WKlJbHS3gDBotYKX8HF1IrzuZWa/LNEDbMTtBNuNyNQ9Wxr4n Lzbv1cRxXFZVQywScm4YsZ28+aDgA8LWeGU190Pe9pjkKdItGrXHx3YhfomJKhEsf1Jq imXc84f0dnW5WJFQS3jy2gfAlBSWyBtOwkL9DKihqS+IPGvxMIndQ4xwHv8Zm0o2FDNY UKXGVayC6rJPbZsRRESOQLV9A2sg9uHotWYh2CzJB7UtNrw99Pv4yXi70cZitWPGEau/ ptsy+f/87G1/8H/9DZ8CrmWPdl5NWI5uwamBjOhC91yB8em0n9k+MXpd25pBXId/8/eL WMvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AzsF3dlC; 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 y9-20020a50ce09000000b00420a7fdbdd0si2441161edi.594.2022.05.26.15.49.24; Thu, 26 May 2022 15:49:51 -0700 (PDT) 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=AzsF3dlC; 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 S239684AbiEZVi6 (ORCPT + 99 others); Thu, 26 May 2022 17:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236442AbiEZVi4 (ORCPT ); Thu, 26 May 2022 17:38:56 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACDCBD9E84 for ; Thu, 26 May 2022 14:38:55 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id 137so2344784pgb.5 for ; Thu, 26 May 2022 14:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3mB+0L5ZW4xRVA9Uby65kPSBoLCd3GkHd7PmK18bo5s=; b=AzsF3dlCrQwtiic1o/h4Js8usYbXf8/d8Q2SUPSntQ2M1/QaYMPdv7jFssitqpOw1Z S7EIgiLUSZ978HBRxyPzqPUXFfyOVvlL2dMr+8s/rMLqcjk42HOvxn8n2yEn58YAgdR1 xAit8gEN5LokvDy2vLBSf8Dg4nPOhNTUXMC0fy/K7bwml14jXG2oCIp9mQCyPai+Kn/A u/JKcFelLI4eJORfKobzq11ZYbSOwID+Zfq5f5zeFDAcYb0dnprBNOPvoMKb8ByRePKK 2p+Kn7DueZHjKCIbiyWKBaneR5jR5w2E1qWV9jwCW3qgv/vCJ+65JNsU8tFPyf+GPqga AB+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3mB+0L5ZW4xRVA9Uby65kPSBoLCd3GkHd7PmK18bo5s=; b=LRbSfuglNPFJqi1Cra23v3XcxvLXicTsp7luhOjajlsItf22db/LSlGaCasJ8umQq9 dNyGKPXJ5J/S63PadHb74DVTxImas0UxQL5IRPWJKPjEJJU6XkMVAciaNq/iVSPObotE UBKtP6vi7xXkRWvxshFZMpXE9Yr9DTs8Ruoo4Hj9Npuu/Ke7VCO7KfGeDIVuauRRkyDi AnjSUOM9wXDISs4IBGAbO7pKgUF9rxrvxTYvoMh04JOgX79Bi1nQRVVsxi7Cn5R+ReFQ 0IP7WavodE2tGjiLPeJr1rrQnTzQcZKWftQjxy/KrTqMDTW0b4V65ImPsg7Y8pjQDIAG PLYg== X-Gm-Message-State: AOAM531wlph9Kddx6JUoAk0fVh5b9/BOciTp0kUcrChXC4R5F986OugA GdgrM6c3lnsusktfqFgbyuZaJg== X-Received: by 2002:a63:4525:0:b0:3db:8a4d:8a77 with SMTP id s37-20020a634525000000b003db8a4d8a77mr35189688pga.542.1653601134986; Thu, 26 May 2022 14:38:54 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id p19-20020a17090ad31300b001d97f7fca06sm121659pju.24.2022.05.26.14.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 14:38:54 -0700 (PDT) Date: Thu, 26 May 2022 21:38:51 +0000 From: Sean Christopherson To: David Matlack Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov , Maxim Levitsky , Lai Jiangshan Subject: Re: [PATCH V3 02/12] KVM: X86/MMU: Add using_local_root_page() Message-ID: References: <20220521131700.3661-1-jiangshanlai@gmail.com> <20220521131700.3661-3-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, T_SCC_BODY_TEXT_LINE,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 Thu, May 26, 2022, David Matlack wrote: > On Sat, May 21, 2022 at 09:16:50PM +0800, Lai Jiangshan wrote: > > From: Lai Jiangshan > > > > In some cases, local root pages are used for MMU. It is often using > > to_shadow_page(mmu->root.hpa) to check if local root pages are used. > > > > Add using_local_root_page() to directly check if local root pages are > > used or needed to be used even mmu->root.hpa is not set. > > > > Prepare for making to_shadow_page(mmu->root.hpa) returns non-NULL via > > using local shadow [root] pages. > > > > Signed-off-by: Lai Jiangshan > > --- > > arch/x86/kvm/mmu/mmu.c | 40 +++++++++++++++++++++++++++++++++++++--- > > 1 file changed, 37 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index efe5a3dca1e0..624b6d2473f7 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -1690,6 +1690,39 @@ static void drop_parent_pte(struct kvm_mmu_page *sp, > > mmu_spte_clear_no_track(parent_pte); > > } > > > > +/* > > + * KVM uses the VCPU's local root page (vcpu->mmu->pae_root) when either the > > + * shadow pagetable is using PAE paging or the host is shadowing nested NPT for > > + * 32bit L1 hypervisor. > > How about using the terms "private" and "shared" instead of "local" and > "non-local"? I think that more accurately conveys what is special about > these pages: they are private to the vCPU using them. And then "shared" > is more intuitive to understand than "non-local" (which is used > elsewhere in this series). Please avoid "private" and "shared". I haven't read the full context of the discussion, but those terms have already been claimed by confidential VMs. FWIW, I believe similar discussions happened around mm/ and kmap(), and they ended up with thread_local and kmap_local(). Maybe "vCPU local" and "common"?