Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3980541pxb; Fri, 11 Feb 2022 12:07:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4i7rWD91HiVd3P4iMiGo5UcEezIo2zUc7+vvzAj5neiMlQ/yxCz8XHXVLnX+XTxWGjyga X-Received: by 2002:aa7:888b:: with SMTP id z11mr3277612pfe.76.1644610047781; Fri, 11 Feb 2022 12:07:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644610047; cv=none; d=google.com; s=arc-20160816; b=G6udGa2zl8Qb5A9z+th5fzYy2fO4VPYkR+SDUGQla1OP19LMTrJmvWdDPayKAdI7bC dBNKEb8dgv1xntO5bVrFtG2fKfyBz53yWvHNUmw+BD0qh4EUCAd7aDN5eOiQzYwMeWs4 cakF0t2xwXNsLIxEE+fajHzDWQ44KRoBO8Aopce8xoq+ebXm2pMeHOVfvju3q4PmULyi KK6cdmmjNbO//qkqUiwzhirib+OnLOVxuIcZshhT5D0Q0bPJoTOGC+b9Xyp9KNUs9Pu6 Z+byqrHo0/NJSIfNuytGL1Wwq5leFi6zfBx2PgMLi+4r+hDrKH7d/iwQuNe6qxbIPspe c01g== 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:dkim-signature; bh=GR8YI4ZUVVkcMkfN5n/I4ApVj24WcUZ3xy5k7vXwB3c=; b=KxexAnU64XUEUs8XD36MbDY32K8pTRmCk3LT+KLsRoT6/MwJ/KXey+LPJqvoeqIApf MiP4aVqdGFZPwyFhi9JLZbmZFhT3Bnf7ZPcpFcxynX/uIHbxH7A7fmF9mnnLBxIppfsQ M3wNYLHVL0oLYeYOjW38avfxAh8PctCR2huMRsYTMnUUwWkZG4oK+xqMm22OOO/SGGNr 9KMXBwN6KsRr8me4kV+UOeHc4+EtuE0XT7bYWcVOHXFXEwA2IfGnP/uaiIjHHuvQ7WER u5mQWrJVfAkwldwHOzpeicdk8sohe2LWrukNNdyrsBgmOY4F+eQV2JDw8OyM+yG+sLdr sgiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gfNgwwaZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13si10913506pfg.334.2022.02.11.12.07.14; Fri, 11 Feb 2022 12:07:27 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=gfNgwwaZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344793AbiBKRxm (ORCPT + 99 others); Fri, 11 Feb 2022 12:53:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241935AbiBKRxk (ORCPT ); Fri, 11 Feb 2022 12:53:40 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257881AF for ; Fri, 11 Feb 2022 09:53:39 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id y7so5283731plp.2 for ; Fri, 11 Feb 2022 09:53:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GR8YI4ZUVVkcMkfN5n/I4ApVj24WcUZ3xy5k7vXwB3c=; b=gfNgwwaZGmKRhsYpF5xWdH7KWoDCgT6PqXTPoVSQjk7Uae3en5i8wL5l01rY0Tmppo PShnO2uaKQnjE7BV/+gSCyjo6arwMpRc+7lf+MFcK6/Z97uuQQ7rHBoMK/kMWYOvq1J8 pMeqVp0KU0AUdP+yoV+smm6RtZGp3buYqZYX77xk5t/LutQP591p5W/owIkKLg5GkkWM CgELIjfJ3+ICoe+QZe6HDB93aGSRXXntjYV4HC7ujGvtn9JAPgr4di+yKiKoSnnvIzma DZTKT2t0TWEkbfFZNgZDO5LLbpVuHN7j6DkwgMpu9yY5wpTM0mM8YwdMBZ0jNroOMc6P nC/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GR8YI4ZUVVkcMkfN5n/I4ApVj24WcUZ3xy5k7vXwB3c=; b=11zHdJFcBL5r/3rawcpYbe2wjB4aq4dkEEEwSRP3CKnrKjjsa8B/0wPYcAY01cd2yP CzVYS6R3s1XbLFhrlNR8k1v0zmeZ4vTU1EPLzW7AmcPPPXWQ5A/goMaiwEoVPmBKhSQw r1ZJwhjWe60V9U9VkNwqmJusl4oS7ExzB5z277BH1E9KyUfV1JlRegZjY6aDuXUa5B79 CtR/Nh+rzfXpJUN1WegLjkBn210e0IxXgxkFscvI6HxHMRREgo7SS5w9K8t0eRLUPEQv KieK7Y8Gcwgq0w/wNnLI7Rrr5/U4yV6qaqN1qMVtbB5FbuU7pAJ/u/FgDJT3cDMfhrw9 Np7w== X-Gm-Message-State: AOAM533htkgXrWL0wgcs/o0LuKNMXGwbv79Gm7va3hclK4HiDL/tz33O /7UeCKjI74mvc2DcT+E1WPYg3A== X-Received: by 2002:a17:90b:3a82:: with SMTP id om2mr1586423pjb.58.1644602018334; Fri, 11 Feb 2022 09:53:38 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id z13sm27643393pfe.20.2022.02.11.09.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 09:53:37 -0800 (PST) Date: Fri, 11 Feb 2022 17:53:34 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, vkuznets@redhat.com, mlevitsk@redhat.com, dmatlack@google.com Subject: Re: [PATCH 11/12] KVM: MMU: remove kvm_mmu_calc_root_page_role Message-ID: References: <20220209170020.1775368-1-pbonzini@redhat.com> <20220209170020.1775368-12-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220209170020.1775368-12-pbonzini@redhat.com> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 IMO, the shortlog is too literal and doesn't help understand the implications of the change. I prefer something like: KVM: x86/mmu: Always use current mmu's role when loading new PGD On Wed, Feb 09, 2022, Paolo Bonzini wrote: > Since the guest PGD is now loaded after the MMU has been set up > completely, the desired role for a cache hit is simply the current > mmu_role. There is no need to compute it again, so __kvm_mmu_new_pgd > can be folded in kvm_mmu_new_pgd. > > For the !tdp_enabled case, it would also have been possible to use > the role that is already in vcpu->arch.mmu. > > Signed-off-by: Paolo Bonzini > --- With a different shortlog and newline, Reviewed-by: Sean Christopherson > arch/x86/kvm/mmu/mmu.c | 29 ++++------------------------- > 1 file changed, 4 insertions(+), 25 deletions(-) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index df9e0a43513c..38b40ddcaad7 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -190,8 +190,6 @@ struct kmem_cache *mmu_page_header_cache; > static struct percpu_counter kvm_total_used_mmu_pages; > > static void mmu_spte_set(u64 *sptep, u64 spte); > -static union kvm_mmu_page_role > -kvm_mmu_calc_root_page_role(struct kvm_vcpu *vcpu); > > struct kvm_mmu_role_regs { > const unsigned long cr0; > @@ -4172,9 +4170,9 @@ static bool fast_pgd_switch(struct kvm_vcpu *vcpu, gpa_t new_pgd, > return cached_root_find_and_replace(vcpu, new_pgd, new_role); > } > > -static void __kvm_mmu_new_pgd(struct kvm_vcpu *vcpu, gpa_t new_pgd, > - union kvm_mmu_page_role new_role) > +void kvm_mmu_new_pgd(struct kvm_vcpu *vcpu, gpa_t new_pgd) > { > + union kvm_mmu_page_role new_role = vcpu->arch.mmu->mmu_role.base; Newline needed. > if (!fast_pgd_switch(vcpu, new_pgd, new_role)) { > /* kvm_mmu_ensure_valid_pgd will set up a new root. */ > return;