Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2094838pxb; Wed, 9 Feb 2022 10:42:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeWgJmHguQ2GoIyKNs0ZDUOlIBcJPZKUAjNGGjY539jjgJ4UWsmhasaTTp0F3eDt2FX3wA X-Received: by 2002:a05:6a00:194d:: with SMTP id s13mr3619230pfk.22.1644432140251; Wed, 09 Feb 2022 10:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644432140; cv=none; d=google.com; s=arc-20160816; b=UQTbmrEihVc5MRwQUEeydqpw8YHFXDN6KrU+hi9aT9A3tAjZ4marVb3HucF7edAOzA aEHDtJ9f2gQnDhUe4lXVZyWeEwzvUaAyESiOX5c5lvsqX3q7XvjeNORJpxLEZO810OAz rFGP0kzo6ZCbeq94JnwlJ+d36p5yiIjoQFwWdBqV4sTbtWJd5fa/qcIu85ySGoHFGWPz InZyFwWk+oOp5fXYOJ3LNbqLZgj1BT1AMa7f1JQVffBwsBjgc7vJDtJL1Ds7n0fPLbNE Qldas12MZfrr//fX27WtlyD+IyPgag/06OltwmfnL0N20s14TGV107FWg556f431i8Cx gKgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1FNh7pkHY41jFWmZFdVN600EQqaJlF1A+HaHz0XISvI=; b=UBy2TOFUomhqZcEI9UYgTvM61Va0eiJI5W0wsQuwfL0h0Tazn+icYiMpa8HyqE1inu NZRLC4XWDEpBGcaggt0x7+9wsCZ+IxpxYyR3mp+wPOXrDu+/R44bFoowBK+QgwPqeUXw /cwGxmVRSgFjd2aFHjniDRNzk75z0goisD/tRi/aLcMeGzXaC+Mv7446pcAaecr+tRb5 9Fw7Ldra5q29fVZGYUj++ROV7YRqFBOxaDlpttmpvYvRmBQmJlm+JLs/F66wF45KdNQD +xX2xdr5fGlSVZT5siI/aB4OjGPAMRB7g/dJnnaldEnQ1QMO6kChJJtSsUOwFGhnVZLk VUCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g69tFctE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh9si912246pjb.38.2022.02.09.10.42.06; Wed, 09 Feb 2022 10:42:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g69tFctE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237784AbiBIRBI (ORCPT + 99 others); Wed, 9 Feb 2022 12:01:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237672AbiBIRAz (ORCPT ); Wed, 9 Feb 2022 12:00:55 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCFF6C05CB89 for ; Wed, 9 Feb 2022 09:00:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644426057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1FNh7pkHY41jFWmZFdVN600EQqaJlF1A+HaHz0XISvI=; b=g69tFctEqKOBTb+dhc3dxSdte1herpcLLpe/t2UWB3wBQP5/eQDNqULiF2N4IltTSp/CTe 24rvCffgC0sK/V5QjJddFzV/DC1ynZsQW9hcnLxLFL2GvpLAbFucuta+pqjLxBafF1qGu4 mtMCNVjGAAHk7HUdBR4GEsfve+pt5e0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-282-bhh_Xgj_PXqfi1V8wlP2YA-1; Wed, 09 Feb 2022 12:00:54 -0500 X-MC-Unique: bhh_Xgj_PXqfi1V8wlP2YA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7C2718397A7; Wed, 9 Feb 2022 17:00:51 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B8BD7CD66; Wed, 9 Feb 2022 17:00:51 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vkuznets@redhat.com, mlevitsk@redhat.com, dmatlack@google.com, seanjc@google.com Subject: [PATCH 06/12] KVM: MMU: rename kvm_mmu_reload Date: Wed, 9 Feb 2022 12:00:14 -0500 Message-Id: <20220209170020.1775368-7-pbonzini@redhat.com> In-Reply-To: <20220209170020.1775368-1-pbonzini@redhat.com> References: <20220209170020.1775368-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 The name of kvm_mmu_reload is very confusing for two reasons: first, KVM_REQ_MMU_RELOAD actually does not call it; second, it only does anything if there is no valid root. Rename it to kvm_mmu_ensure_valid_root, which matches the actual behavior better. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu.h | 2 +- arch/x86/kvm/x86.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index b9d06a218b2c..c9f1c2162ade 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -104,7 +104,7 @@ void kvm_mmu_unload(struct kvm_vcpu *vcpu); void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu); void kvm_mmu_sync_prev_roots(struct kvm_vcpu *vcpu); -static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu) +static inline int kvm_mmu_ensure_valid_root(struct kvm_vcpu *vcpu) { if (likely(vcpu->arch.mmu->root_hpa != INVALID_PAGE)) return 0; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 98aca0f2af12..2685fb62807e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9976,7 +9976,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) } } - r = kvm_mmu_reload(vcpu); + r = kvm_mmu_ensure_valid_root(vcpu); if (unlikely(r)) { goto cancel_injection; } @@ -12164,7 +12164,7 @@ void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu, struct kvm_async_pf *work) work->wakeup_all) return; - r = kvm_mmu_reload(vcpu); + r = kvm_mmu_ensure_valid_root(vcpu); if (unlikely(r)) return; -- 2.31.1