Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp13971641rwb; Sun, 27 Nov 2022 15:06:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf7DBwAlQuoFqlW5ajEryBhUy4IEsANiPwT3w8zrJDFQWUEZEfkVU/Qh74ZGxZisrypqHcEq X-Received: by 2002:a17:906:1d14:b0:7ad:79c0:46f4 with SMTP id n20-20020a1709061d1400b007ad79c046f4mr40605249ejh.363.1669590405824; Sun, 27 Nov 2022 15:06:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669590405; cv=none; d=google.com; s=arc-20160816; b=TTCz85Jy4DehG4quY43gnjD/6sl2n/nMRRYMPYY6NL25aTqS28M45+IfBVCc4IrGMx I/RY1bZoFaYc0vFmLndCzANSNnSX8DI/Y3eFcDkPJxOvojYp4caONpigVBVdgFsDuz8J E8wtFpquBIN1WxJGf3doRlftKjn5EdT8SQ6IWyzbF5AIHA0f+11LKSa/PQBsZtg4y5r6 wtbCZtx2zr7Gvqrrs2uiNC89NiOU1rDoAmq5ZdPYuuUuUD+CJpwYPMVNzvZHLYdwHC8I 1kuaYRn7d44mCpA/u7ZqqBBYOwmrQCiBKqgSouANFEoH2J2ULtTdA66uNQjFpoiDaVEl BBAw== 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=H93P/+btHMmnUHfAxiUxxWr+DgQtxwEFifMZUFb22Lo=; b=VEyQ7SB5zQbbze3uVM+b2sl3LZsIueoDSmtg/AOHHG8v7NlsF03eowcv16p6V3o1Ht j5qSS0qbxlCBS7DHx8aYvlM4PIvoMLinejTu9bGhq8mw1n3IjOZV6zKrWIrPXxA97/R7 5WL4vlM9tnaYQJPu+9rlnG7S8czvOEkCq9jA6YSIVarU3hDUJk4ge13aNjULMdDACgN0 XkQhBvlSeq3raTcRPFDXeX2dn0u2Cz64Pij50TIoU1k/eU7iE9oRXOOt1HE4r1UF4dKM hjUr6qv6SRXtAlNpBbC+QIvbFcWCTYTlc82mAB0qjw79jyY0H6CtHC3kS5W/IrFvBGDP 6uUg== 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 m16-20020a056402511000b00468b9d932c6si10184528edd.258.2022.11.27.15.06.25; Sun, 27 Nov 2022 15:06:45 -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 S229664AbiK0WNB (ORCPT + 85 others); Sun, 27 Nov 2022 17:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbiK0WM7 (ORCPT ); Sun, 27 Nov 2022 17:12:59 -0500 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E0BDF00; Sun, 27 Nov 2022 14:12:58 -0800 (PST) Received: by mail-wr1-f47.google.com with SMTP id w15so917322wrl.9; Sun, 27 Nov 2022 14:12:58 -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=H93P/+btHMmnUHfAxiUxxWr+DgQtxwEFifMZUFb22Lo=; b=lVayMRecf2VR+UhFlsGcD8Z1eVqCI4RexZRzJ0tSxSfuI09yi1s6Llh330SCaGkDWR xQY2WdVHa3f3Fv6vmgohqXugBu4ghOT20gcoPHwS6BbaftOVzbGTku3PPhS4p9FfIGkE E1sDq5VCl2klUpEXCtJVLUBlY0Fat8Z375gg7jld8jN+P79p7T049Opka+axjvaGsi69 3rpyJVJ4Nc4FUfC8HxQu4ejeEup55KAo04mdmizUAnC/FqNxsRId3ZNnjugCeqnG7MWZ yQSzqxZ6k/qnvssaoU47J83CoeCoQfdlOfd9ZmFmI8BYbgxmwHd1bq2S6Vsm34R/trrz wibw== X-Gm-Message-State: ANoB5ploOPPpe4U2rli0TP662rxvgi+WrqlR+PGq9tUwbgDieK8hZAey H3bMG1wUER+KsdelPKC3syDb1WpMgaM= X-Received: by 2002:a05:6000:783:b0:241:bc34:3149 with SMTP id bu3-20020a056000078300b00241bc343149mr23821253wrb.351.1669587176312; Sun, 27 Nov 2022 14:12:56 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id m16-20020a05600c3b1000b003cfd0bd8c0asm14232298wms.30.2022.11.27.14.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 14:12:55 -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] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd Date: Sun, 27 Nov 2022 22:12:45 +0000 Message-Id: <20221127221245.204208-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 --- 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..361574124fbe 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 is found. A new root will be + * set up in vcpu_enter_guest prior to the next vmenter. + */ + 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