Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15605624rwb; Mon, 28 Nov 2022 13:47:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Fupu5PqJGxetoz8QGzhO7kx+xzrF48UUik7jAGFJ3EFwjPiqgxnb56EAIX2e0K+8DOISI X-Received: by 2002:a17:906:f19a:b0:7be:fb5c:1885 with SMTP id gs26-20020a170906f19a00b007befb5c1885mr7904153ejb.310.1669672076124; Mon, 28 Nov 2022 13:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669672076; cv=none; d=google.com; s=arc-20160816; b=GCIlwTfuqiY3/J4RBG4e5+zv2ZjcrdZUodyPcdK7MVqpbAczWKyceZ9FxuDnwy3b14 dfIUB3DWrkVQbC09NO6UOiCLwAD20m1nQOdN8oD24MhUhzn7FvufDJp6JYsL9pFdKQDI KhNfZ8zNp14mIPvH7D+m/uy2AFeijWFM75Sq95Z24OE99WvbXfNzDbxOk0vH9CfF/r8M siVb1I0Eh1efNAUxChoIpx47Ni/0yoygWArR9yNFKQviHmDitUmQK7mIkf5hhYwKirP9 z5j4iLRCzsXk5w/yeujRxLqeIFd6xpvyqOaV52GhWWsVgV/kE9w9jXwe5NUM9JFbr1qo QFGw== 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; bh=PuADqb5ObhzEay83Rgmmr1DjvxatfIL6idtDUz9yxI4=; b=Dd0JQKtuwu/j3KxOOKIIGqjIv8etWekgkUBQNvlBQ6Pu7MWsiMU+zJtNl8tityLWaa vzO+NN0CltWESWqCUBp+YedJKwgeVZdwkdiJGwW4F2A88tpdN9F7ijv0aHk9Wr8lDDZt /SH47fagdX7fA4+XbvHd4t21xGIhHD27eXyzy8xkt2tWPzxbOXiRZlpRHDKRzZHoJkw+ 0lwbW/VnQvkouXR8o6m0DuRE66OTwbyEHYxHwGHblxCLDxokrQyVAvidzJZog4aUq69c a7wdylXpQMTAo/ZmTtmUlE9wZL5VvBtwPYg5WLuwQ9YfFsqT0YEEGwnUI4fHdcEVTwfO UxTQ== 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 qf2-20020a1709077f0200b00741a18d4a5asi11326646ejc.994.2022.11.28.13.47.34; Mon, 28 Nov 2022 13:47:56 -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 S234316AbiK1VkZ (ORCPT + 83 others); Mon, 28 Nov 2022 16:40:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234276AbiK1VkD (ORCPT ); Mon, 28 Nov 2022 16:40:03 -0500 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 636772B615; Mon, 28 Nov 2022 13:40:02 -0800 (PST) Received: by mail-wm1-f50.google.com with SMTP id 83-20020a1c0256000000b003d03017c6efso12125652wmc.4; Mon, 28 Nov 2022 13:40:02 -0800 (PST) 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=PuADqb5ObhzEay83Rgmmr1DjvxatfIL6idtDUz9yxI4=; b=C6xpSCTW3Z/VKrA8D6cruFuz5UfhIHi6yVPyt/AgaKPj5gjYRJrXnDw1+Wm5fpmeGE 1HZ9FCKOSQWiZy8PHs/dxK7GXE0Y4vEhvrLm7qOpTIZz+T7uDBnM6bhJWzkLNxhfTrt5 G22oI6ox2js94+/wHp9XlIf67yK09Sv9ftmjdjzIszYziOGn0El8bznDcuGY1LPk9jcv 48ZoJny5J0Op7ocjXj5Nja5ByWMh25wSU1UBW9Dzr3cwI+Vd8zz6LRwbQcHaonDCHFSy cW1p42UrvzqIXbfgDZowdwdD6bYJTyBOxa6EilJjITIWqo7kZfvBcSlnWOR5GBRBxigX MlhA== X-Gm-Message-State: ANoB5pk3KDLS450cOTK1Qf5T55LlNSJBzf3Pg1AR8sPQxVphcAa5nqKe cKybZGj5tESLANxaEtUIeYk= X-Received: by 2002:a05:600c:5388:b0:3cf:37b1:e581 with SMTP id hg8-20020a05600c538800b003cf37b1e581mr37853395wmb.96.1669671600900; Mon, 28 Nov 2022 13:40:00 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id i11-20020a5d438b000000b00241b5af8697sm11614853wrq.85.2022.11.28.13.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 13:40:00 -0800 (PST) Date: Mon, 28 Nov 2022 21:39:58 +0000 From: Wei Liu To: Sean Christopherson Cc: Wei Liu , kvm@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH] KVM: x86/mmu: fix an incorrect comment in kvm_mmu_new_pgd Message-ID: References: <20221127221245.204208-1-wei.liu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Mon, Nov 28, 2022 at 06:02:46PM +0000, Sean Christopherson wrote: > On Sun, Nov 27, 2022, Wei Liu wrote: > > There is no function named kvm_mmu_ensure_valid_pgd. > > () when referecing functions, here and in the comment. > > > 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 > > s/is/was > > And technically, it may not be a "new" root, e.g. if a different vCPU creates a > usable root between now and kvm_mmu_reload(). > > > + * set up in vcpu_enter_guest prior to the next vmenter. > > s/vmenter/VM-Enter > > Pointing a reader at vcpu_enter_guest() isn't very helpful since that's a massive > function; kvm_mmu_reload() is where the real magic happens. I generally prefer to > avoid referencing functions in comments unless doing so is absolutely "necessary" > because such comments always seem to become stale, but in this case I think it's > worthwhile. > > /* > * Return immediately if no usable was found, kvm_mmu_reload() will > * establish a valid root prior to the next VM-Enter. > */ > Thanks for the feedback. v2 coming shortly. Thanks, Wei.