Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp651598pxb; Tue, 5 Apr 2022 17:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4hrzxYmDiCW+UQh0QqnbwYOPVinrqNytHtJpgbA632qYNe/GNrcga+HjymuGMABpMlKbP X-Received: by 2002:a17:906:4cd8:b0:6db:372:c4ba with SMTP id q24-20020a1709064cd800b006db0372c4bamr5726808ejt.57.1649204503813; Tue, 05 Apr 2022 17:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649204503; cv=none; d=google.com; s=arc-20160816; b=EPeJ/MnWxKFKsO++UhY1uMoOJ5rHQ3KKBKzse24daiByRPy+zwTAkeIlxRvdmynhRJ 047NsCGMfBsFPhdZ+hvusyCj5w5cVFkHhY/Nhhe7ppcmUnySmTwhZoNUXCW+Wcyea19C XEUJn6u4x2hDy4oyyqySbatQQngRF/fvlFfH0yPptQ0ThO5fePZxCpYB3v3P9UHgG4qo n+/HLZXfoCEichoPrGzI/LaSeHP9/CJn4MfaoWiLrXhw+JLapblc5kK8ihyfwuAhkx8G +vGDIW+wmFxpDH2639zCTIEloHu0JTYQM7/wc44xDlDjI48TOc0XottpLETpjxQr7XBs GPFg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4ujVcCT1V6iQJObk2qD69wqaa0gR+9pHScrRXb3jszM=; b=xAYyBXeWoPc4hE8uNZ4UYiI645qLDohlK01L4FaluQmWWpvO+qmYpWkBOM+lZsmboH GrRxVVZrawrtMLxVJcziqx/21ewaeKtv0nd4vpbg57gHK4TlnAjrcpucLXmqMgASdzoD SMjJvek0TgoOEz/9VgNvSgxjUZ5DfOBeRAmQIGBq9aZI+C+Ze/xDokivDXS+Vbd9TZtI mil4mFIjX3NebRcUpJiHjNnjbU+Aimg9w+wb8LjpxmanRBGv2+kgMLlahspo4PhXTT3N S/gM+mP+2gk1RthbGtvywrfZAEvz5pYdxADHnqhHWHPwUESqSQ2eLqSS6shKuX82Td7H 0Ucg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LYPqW2tf; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020aa7d9c1000000b0041cdc4992aasi3994465eds.456.2022.04.05.17.21.11; Tue, 05 Apr 2022 17:21:43 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=LYPqW2tf; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382800AbiDENaH (ORCPT + 99 others); Tue, 5 Apr 2022 09:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345335AbiDEJW2 (ORCPT ); Tue, 5 Apr 2022 05:22:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3AE46167; Tue, 5 Apr 2022 02:10:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE29961577; Tue, 5 Apr 2022 09:10:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0F9C385A2; Tue, 5 Apr 2022 09:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149835; bh=KBBEiaudzNuttpozFnSTnTmfgA9wXGUFOKNx4lDwuv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYPqW2tfsb+qhmgyPqSW7NKz9tHo30OGI1uTfgr/8FMj/Qf3CwMVFnKcJeF4GnuZ9 XyDSMwEnev9yK3IJw1eWuXjvRnj+b7YjO1GwRC4d/2t2MwJUr0ypCMPAmeFOuCvyQU fAF7oi2ti6uwwXP1rkbtNdllN0rbebCmBkd7t0Ck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.16 0858/1017] KVM: x86/mmu: Use common TDP MMU zap helper for MMU notifier unmap hook Date: Tue, 5 Apr 2022 09:29:31 +0200 Message-Id: <20220405070419.703621984@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Sean Christopherson commit 83b83a02073ec8d18c77a9bbe0881d710f7a9d32 upstream. Use the common TDP MMU zap helper when handling an MMU notifier unmap event, the two flows are semantically identical. Consolidate the code in preparation for a future bug fix, as both kvm_tdp_mmu_unmap_gfn_range() and __kvm_tdp_mmu_zap_gfn_range() are guilty of not zapping SPTEs in invalid roots. No functional change intended. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20211215011557.399940-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/mmu/tdp_mmu.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1032,13 +1032,8 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcp bool kvm_tdp_mmu_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range, bool flush) { - struct kvm_mmu_page *root; - - for_each_tdp_mmu_root_yield_safe(kvm, root, range->slot->as_id, false) - flush = zap_gfn_range(kvm, root, range->start, range->end, - range->may_block, flush, false); - - return flush; + return __kvm_tdp_mmu_zap_gfn_range(kvm, range->slot->as_id, range->start, + range->end, range->may_block, flush); } typedef bool (*tdp_handler_t)(struct kvm *kvm, struct tdp_iter *iter,