From patchwork Thu Nov 10 13:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hoo X-Patchwork-Id: 13038787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC12CC433FE for ; Thu, 10 Nov 2022 13:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbiKJN3L (ORCPT ); Thu, 10 Nov 2022 08:29:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230455AbiKJN3K (ORCPT ); Thu, 10 Nov 2022 08:29:10 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25624B37 for ; Thu, 10 Nov 2022 05:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668086949; x=1699622949; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ysq0MXQrb7cNxqF4pmzNNwfDEiz/w1vbRXmTb56KTJ4=; b=epWwO+PCNkc86gKcoJL1jRcP07Vv5SM+nUc6hgkzqkm9qCsl12GqpUW1 N98dyOSTa+VhnPmqnFtesgW1K7FICs4vBUhwuFC0R95vLHdXY3D5/rAgm 8tsPJjxkxaiISt4RWqnJkxmiwXha0en/hcyIRR94rfYcSTb15Dm6wKcfO UW9NObtRNBuLzx3phH7UZQj2mUo5iMuPCKeNACyWpEWN6pZvEZ3Gd2pht /npFNp4c/vjbNyrm1vKXj7sgEraAfLSBSBjcNXKWvugIjSYD3VcDVl+jr w/ruC9uvhcLZPFJfAvjRSjea5DgSOB/l5d+ETipv8Mrf1BXRul8f3i22C w==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="311306330" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="311306330" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 05:29:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="812038333" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="812038333" Received: from sqa-gate.sh.intel.com (HELO robert-clx2.tsp.org) ([10.239.48.212]) by orsmga005.jf.intel.com with ESMTP; 10 Nov 2022 05:29:07 -0800 From: Robert Hoo To: pbonzini@redhat.com, seanjc@google.com, kirill.shutemov@linux.intel.com Cc: kvm@vger.kernel.org, Robert Hoo Subject: [PATCH v2 4/9] [Trivial] KVM: x86: MMU: Commets update Date: Thu, 10 Nov 2022 21:28:43 +0800 Message-Id: <20221110132848.330793-5-robert.hu@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221110132848.330793-1-robert.hu@linux.intel.com> References: <20221110132848.330793-1-robert.hu@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org kvm_mmu_ensure_valid_pgd() is stale. Update the comments according to latest code. No function changes. P.S. Sean firstly noticed this in https://lore.kernel.org/kvm/Yg%2FguAXFLJBmDflh@google.com/. Signed-off-by: Robert Hoo --- arch/x86/kvm/mmu/mmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 04e4b38fe73a..7ee6c84934b9 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4451,8 +4451,12 @@ void kvm_mmu_new_pgd(struct kvm_vcpu *vcpu, gpa_t new_pgd) struct kvm_mmu *mmu = vcpu->arch.mmu; union kvm_mmu_page_role new_role = mmu->root_role; + /* + * If no root is found in cache, current active root.hpa will be (set) + * INVALID_PAGE, a new root will be set up during vcpu_enter_guest() + * --> kvm_mmu_reload(). + */ if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) { - /* kvm_mmu_ensure_valid_pgd will set up a new root. */ return; }