Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15668502rwb; Mon, 28 Nov 2022 14:40:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf7pJTViGF71aoQI3acxmNT8Coiene2l29sWoKhEBCPZunvcI7zqe0CFvf5kSwQTV1Nl4AoX X-Received: by 2002:a17:902:b20f:b0:188:d4ea:251f with SMTP id t15-20020a170902b20f00b00188d4ea251fmr46623344plr.36.1669675238962; Mon, 28 Nov 2022 14:40:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669675238; cv=none; d=google.com; s=arc-20160816; b=VnrCfOK4WD9UGf+0uqwqhI/t+y0iD6djYNT2z+h6/Ns+jYASqMsjWNiXwM0SPPX/Ed mJ4R3y7t+1w3MXxGSNMMgCi2lQTaxY7lvmRzUsDVnwuR9Fp5OU+I1zoan8Gu2yqJgBH+ sgGZtDRhUb+fAvG+mv6Uf+sX6uv5LwxY8+e7jJat8+i5VDxrWtVRrcJdE3f4ldCULF0Q Ra4nA0/LZPAuMQkECsst3CH6sZyYEkf7l79WnO4hTslGvkJ378/XxoMNRG1EPIilT/pw 0zhJdqq4aNPM3vGkLSF1qFPwMj/lpsbERV/ep6a5v13OnHEPE1BRiwtYlctHSy7iWdIp 0wKA== 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 :message-id:date:subject:cc:to:from; bh=0q+pi2LlFPiueuPI6vQdyfzoD0KMzMDwbTWkzbbDN0o=; b=D9vcRpwbC87Sbru0M5yjMraB43afoHZVhTPjLIwSR5Hkq3sRuDhqt43VHVKkEij2af Jly4HCO3bN+2ZbGEEIrq3wW1ATJt+p1sjvxRINRhJZavduObm6YbL/6cR6aDvWCvFzGA 3lr1/loKpyRxlbUoDdC3m/jHSDt8jW0Z63bNM/Xg4um8JEGVNXin1Ir1Csb023dV1kbf N1l2U+Eg4CpF1u+PBZHCzdxa14vFsUNtoh0KPp1EzCDbA0yzlfKlcGgxmxqq9lr82+FQ LVFGFnxDEjgjnYiLVYNZ6D1bgKgzKPcIJW2ZRfsmiyYo1IVoD2LHMPMnWsFUpR01+Oq7 C7Bw== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a170902d50800b00188f9e1e07csi14801883plg.525.2022.11.28.14.40.28; Mon, 28 Nov 2022 14:40:38 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234279AbiK1VrR (ORCPT + 83 others); Mon, 28 Nov 2022 16:47:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbiK1VrP (ORCPT ); Mon, 28 Nov 2022 16:47:15 -0500 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A12782FFF9; Mon, 28 Nov 2022 13:47:14 -0800 (PST) Received: by mail-wm1-f47.google.com with SMTP id v7so9536014wmn.0; Mon, 28 Nov 2022 13:47:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0q+pi2LlFPiueuPI6vQdyfzoD0KMzMDwbTWkzbbDN0o=; b=V5ZPJdPKU+61pZgMR2H41oYInBCg0BJcNVRByEE47KxmMP8EsKYu6dyAJaGKWnuMPO 3Y1fNi0K/vuaLlyBgbBLJEdXboWH/dgEP51ruiN7Kx3AL419ixdM59klyXmMaQbdpmP5 mBdasHX2nQcBz1qnzdn7P9tMObOih4weMuWq7MZpTIcwCk4WDY8rRnXPXKQAFMdPv+wS xCMF2Ma5DqHMWkB01Z9JOJ3EL/bYlFPLfdXZMLbUbZtEa+u0hZ/ZmURRfzxcgRWrtycD gi2etHsQ9770+5vdNuHqecWgsny/iwyhm3Q9QwBOsBIyXcNwZGQb4UnIce4GNRrSdKA6 noYg== X-Gm-Message-State: ANoB5plLBouEd+lDRWM+9YeUKMo/UplqZYUEYsI/OTsihyccayGeUwVX 1V7REUDozZ7ul7G/qhx7sQcoiG5FTcU= X-Received: by 2002:a05:600c:3d8f:b0:3cf:6b14:1033 with SMTP id bi15-20020a05600c3d8f00b003cf6b141033mr39832096wmb.103.1669672032880; Mon, 28 Nov 2022 13:47:12 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id c15-20020adfe70f000000b00241e8d00b79sm13909433wrm.54.2022.11.28.13.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 13:47:12 -0800 (PST) From: Wei Liu To: kvm@vger.kernel.org Cc: Wei Liu , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), "H. Peter Anvin" , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH v2] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd() Date: Mon, 28 Nov 2022 21:47:09 +0000 Message-Id: <20221128214709.224710-1-wei.liu@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 There is no function named kvm_mmu_ensure_valid_pgd(). Fix the comment and remove the pair of braces to conform to Linux kernel coding style. Signed-off-by: Wei Liu --- v2: incorporate Sean's suggestions --- arch/x86/kvm/mmu/mmu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index b6f96d47e596..a1895fd9eaf4 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4452,10 +4452,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 (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) { - /* kvm_mmu_ensure_valid_pgd will set up a new root. */ + /* + * Return immediately if no usable root was found, kvm_mmu_reload() + * will establish a valid root prior to the next VM-Enter. + */ + if (!fast_pgd_switch(vcpu->kvm, mmu, new_pgd, new_role)) return; - } /* * It's possible that the cached previous root page is obsolete because -- 2.35.1