Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2415849rwb; Thu, 17 Nov 2022 10:24:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XiIH0NGa2KlzxUghFQkAbUmi1qB/YmT0UqwEZnoyVO8tHQFrH8ZPKvBjnMoyoGCbkJS+i X-Received: by 2002:a17:907:767a:b0:7ad:e518:13fd with SMTP id kk26-20020a170907767a00b007ade51813fdmr3160943ejc.323.1668709467746; Thu, 17 Nov 2022 10:24:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668709467; cv=none; d=google.com; s=arc-20160816; b=WzM0gmuiKmtE9wo2JByPGXNifiJ8rzVVGng/VSVuvMy2uriwijpXezUH93WwQSak33 3sN4FvL/8rhnu9BBwZ5NmhN49k+He39/464znRDkc6ABWj3AAoYCJKc56w0fB1r56L/P y8cEOFORE2dbM2Co5/sfkMwyX81Xyi47AYG2bQRc2Xjwy9ioj4rRR/nFlX6qIaG0Ezt8 yqvhx5OeTz/48dxZvOrdmN2dBwLYW/6FyJ/VTlrZL56fA1O6dxTku1MsJzPrRFsck8/t zUuqZJDet0KDrGAnaRr/C7VhczOMJrYKm+Lv3nAqLVqRLYuVFzqBX/QmAtc2xHxRozlI qbaQ== 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=1GKnYydXCYqxqW9dR7aXjYaf7V42K6rqe1svrcwQLNA=; b=Lqb9nIPlcxBkXIVE52K0+wx98K270wingizwu8pCt8/kgza1VaWbh3iYM7EP6LQlzU gAkmsBrhDFlGfvktfcx8mRG1Sf/Aauq3op9/DNd4bUSr2ArJmWdbawDFrLk/sTQkCo2w Htbd1hfTPvlH8QWURrg+KniseibzIcZLw5he0JXUzUYOgWDBM698+X3Z5y3gzaCW4l5k 5YVDU1/alJ/A849iSa/YIpXkt/TIb6HbhWk5HMVlHGKwOVw3ydk8Luud2/H71UiHx0Qw wM/bcMVn1nrRNBMO49GcT0ryLMkNSpvueMvdmdHOv8DoFfzleTO+xOAXUFQUs0JSbLpq ZfYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="SsPhA+/z"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr12-20020a170906d54c00b0078db517075fsi1120695ejc.659.2022.11.17.10.24.03; Thu, 17 Nov 2022 10:24:27 -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=@gmail.com header.s=20210112 header.b="SsPhA+/z"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233270AbiKQRz5 (ORCPT + 92 others); Thu, 17 Nov 2022 12:55:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240291AbiKQRzs (ORCPT ); Thu, 17 Nov 2022 12:55:48 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D6EF7FF2E; Thu, 17 Nov 2022 09:55:48 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id h193so2615344pgc.10; Thu, 17 Nov 2022 09:55:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=1GKnYydXCYqxqW9dR7aXjYaf7V42K6rqe1svrcwQLNA=; b=SsPhA+/zwr2soeEEaWB0iEXVlj2pRXy3T+5MRNkg3gA5bYnDEY76LeiMkjnH6Gtuek VQBK8qn5HlwgpU7JZk31s67cl0oqPFk3/+E+STN+mOv1n0rSuGKwz4ufNl96yyvb+ehm aR16ZhBgByLcqtxYalWYt3DhzqpWD1xk7B/ERhHy5UROjXSA2O4WT484NF1gnxYt2zLo VhlagvXdWvqrnTC1Vpr/nXSDV94IDRsmmPKjuIzbKfxVwlbZ700ttpYm5thGIaufzUrk HWDdterCqcq4ySav4311fVhhOLzfuYpSaYvQzNRfmNvAt+J1fYmNxyHxf+meEu+3PzVd YRFQ== 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=1GKnYydXCYqxqW9dR7aXjYaf7V42K6rqe1svrcwQLNA=; b=TkOn/q0TYypgvcItYVwdYw9qRENVqNoMzOyCXJV/l1sjxWsfcAhYbafpwg3gwEyEuX I94sNPdmxKAJQ8P0+6ww9LuTpeJ+o0mzwOOpmmF4pIql8cjSEYYkbSYUWVuK0iT9x3A+ dtFSAgArJE6z8YtbuG0C6n45vmrv7m2Et/fbjI5/8GIMoDLp5jFgv6aaCAMQHysevL8I 5gnVxqD5t0hEWjSUCXnPdOVyfxjsKtSaOBJC33ZIzgAXbfALIFYF76k8F6bo09ynwqw5 fwbUo3jJ5/HdNVkV9MA8SEqCOjTj6P2aJJWfjyN+zZ5P+cjKGnuTyMN8+dGKZu4Ty0xU X71g== X-Gm-Message-State: ANoB5pmldrGwdlerUPJA8ojU7sBUF+DxMpT1LwYQkhxoDiTsVxMIhWTA feqrtWaqwKTsF9uzONXaZBVVoN4Tsy4= X-Received: by 2002:a63:165d:0:b0:473:f7cd:6603 with SMTP id 29-20020a63165d000000b00473f7cd6603mr3055977pgw.336.1668707747710; Thu, 17 Nov 2022 09:55:47 -0800 (PST) Received: from localhost ([192.55.54.55]) by smtp.gmail.com with ESMTPSA id h4-20020a170902680400b001870dc3b4c0sm1705264plk.74.2022.11.17.09.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 09:55:47 -0800 (PST) Date: Thu, 17 Nov 2022 09:55:46 -0800 From: Isaku Yamahata To: "Huang, Kai" Cc: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Yamahata, Isaku" , "pbonzini@redhat.com" , "Shahar, Sagi" , "Aktas, Erdem" , "isaku.yamahata@gmail.com" , "dmatlack@google.com" , "Christopherson,, Sean" Subject: Re: [PATCH v10 032/108] KVM: x86/mmu: Make sync_page not use hard-coded 0 as the initial SPTE value Message-ID: <20221117175546.GH2350331@ls.amr.corp.intel.com> References: <3f805b540780494c4a5b068287c37e40d71d7ba4.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3f805b540780494c4a5b068287c37e40d71d7ba4.camel@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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, Nov 09, 2022 at 11:24:44AM +0000, "Huang, Kai" wrote: > On Sat, 2022-10-29 at 23:22 -0700, isaku.yamahata@intel.com wrote: > > From: Isaku Yamahata > > > > FNAME(sync_page) in arch/x86/kvm/mmu/paging_tmpl.h assumes that the initial > > shadow page table entry (SPTE) is zero. Remove the assumption by using > > SHADOW_NONPRESENT_VALUE that will be updated from 0 to non-zero value. > > > > Signed-off-by: Isaku Yamahata > > --- > > arch/x86/kvm/mmu/paging_tmpl.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h > > index 5ab5f94dcb6f..6db3f2b5563a 100644 > > --- a/arch/x86/kvm/mmu/paging_tmpl.h > > +++ b/arch/x86/kvm/mmu/paging_tmpl.h > > @@ -1036,7 +1036,8 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) > > gpa_t pte_gpa; > > gfn_t gfn; > > > > - if (!sp->spt[i]) > > + /* spt[i] has initial value of shadow page table allocation */ > > + if (sp->spt[i] == SHADOW_NONPRESENT_VALUE) > > continue; > > > > pte_gpa = first_pte_gpa + i * sizeof(pt_element_t); > > I think this patch can be merged to previous one? Looks there's no good reason > to keep it as standalone. Yes, will squash it. -- Isaku Yamahata