Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp386753rwe; Wed, 24 Aug 2022 02:45:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7nKerwGHOUe5vgNNNAysFcwRxZMC+bI8Dj61YZQKVA6Ay9lZQo2UXmP5zjl1heHPgqa7Ol X-Received: by 2002:a17:903:4c9:b0:172:f376:e9f1 with SMTP id jm9-20020a17090304c900b00172f376e9f1mr10713165plb.68.1661334339994; Wed, 24 Aug 2022 02:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661334339; cv=none; d=google.com; s=arc-20160816; b=kxkcS415UfuRVrjZ1/6v8/xQ7VcMjvOW3Htf+8VE50coafE7a1BiZ6okbklacTvcDN cfH7vNHwzbQ2Di404PLF8amOmrig/8uehsBOgtqVY7qEx8HC0rMCNbnrKuA1dO+Rwo9i s8au5UEMRdxmdBX4qkjKks6FDPTTeYSw27L+pplGzDC040JAOemMXMtkeg8KdwMEvivD TExGCqXRE4SJUKmM8UFjOdqUnk1INHXsvrimjV7vVWNlRIBXxKdvWBf3u0oHoEuuO1wN OH0W1+L4mUJ02fRwjXvIj7/zADv8NrVf5U8wfcEpCOcHdHk5N7TxEzJiTI6eSE/M6qCL ULLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ws1mCY98d3/I8CNwtB2Ae5IlL8S0qi66aEt2uIp8jt8=; b=Jh21UzBDWSItB+CafpZTDmiwwEuTm1vPt+0x7aBLOeyhKT2VVfWeXSJH4sD7CvoXWL 41HnlTV+Vbl4YY2Q4YTAerZPN8820VN3bHNVtAppEYF/4YP9gjwnzZGZPTzI8ERtq4am Glvb9I97NrqwOROuBfqZr2k8kXCiVFvGI5rYirUJo6ABi3CGXuqLHjL8fx9zYJEJH/gM pO/COmAu4YjofE81A5eS3jcICYe1M/xIYpnA/VATMCC9hCj2Z7U3mlnfPoyvksrlJNF5 4QrRQQhsNEZieKur0ViiUanKIAfGty/OOu1btL5ZnS1mv1aVr3EIwaRhrhjwklTy134f 8L9Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a170902e1cb00b00172f3212febsi5777103pla.89.2022.08.24.02.45.28; Wed, 24 Aug 2022 02:45:39 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236372AbiHXJaF (ORCPT + 99 others); Wed, 24 Aug 2022 05:30:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236242AbiHXJ3e (ORCPT ); Wed, 24 Aug 2022 05:29:34 -0400 Received: from out0-135.mail.aliyun.com (out0-135.mail.aliyun.com [140.205.0.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24DF585AA0; Wed, 24 Aug 2022 02:29:32 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R501e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047201;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---.P-jvWvL_1661333369; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.P-jvWvL_1661333369) by smtp.aliyun-inc.com; Wed, 24 Aug 2022 17:29:29 +0800 From: "Hou Wenlong" To: kvm@vger.kernel.org Cc: David Matlack , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] KVM: x86/mmu: Use 1 as the size of gfn range for tlb flushing in FNAME(invlpg)() Date: Wed, 24 Aug 2022 17:29:23 +0800 Message-Id: <8baa40dad8496abb2adb1096e0cf50dcc5f66802.1661331396.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Only SP with PG_LEVLE_4K level could be unsync, so the size of gfn range must be 1. Signed-off-by: Hou Wenlong --- 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 04149c704d5b..486a3163b1e4 100644 --- a/arch/x86/kvm/mmu/paging_tmpl.h +++ b/arch/x86/kvm/mmu/paging_tmpl.h @@ -937,7 +937,8 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva, hpa_t root_hpa) mmu_page_zap_pte(vcpu->kvm, sp, sptep, NULL); if (is_shadow_present_pte(old_spte)) - kvm_flush_remote_tlbs_sptep(vcpu->kvm, sptep); + kvm_flush_remote_tlbs_gfn(vcpu->kvm, + kvm_mmu_page_get_gfn(sp, sptep - sp->spt), 1); if (!rmap_can_add(vcpu)) break; -- 2.31.1