Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1548690qtg; Tue, 21 Mar 2023 15:02:07 -0700 (PDT) X-Google-Smtp-Source: AK7set+Mw8f4WNUBxBZAgUEuNymQ+S3beZd40cdQtyf/8tyywLvc9rVdnNdS8/Z+ALkNudHZSCsB X-Received: by 2002:a17:902:b185:b0:19a:a815:2877 with SMTP id s5-20020a170902b18500b0019aa8152877mr3713510plr.6.1679436127283; Tue, 21 Mar 2023 15:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679436127; cv=none; d=google.com; s=arc-20160816; b=RHwox1aJfcNTADhqVE0jP1ufNFKUgFeGZEA3lsUkFiQgrhCVQJbDET+Rbf54wam47e E3O9VzGh6Y28ClI1m30KCGuLbZjIssKFwII5/lzvPWSZY2b6LthPLjvVICmvzqRCTqn4 pPjkgLz7uFWc84RzUNxt4tUsRtMaCoBoWhYhcrmJJQUjvEnOL873FAK8w0RHxPmO5TBX QNnAN0EKVPOiH7g935OQFSsF0Mlr7YcITu5WBAPXkZ0x7RAlOhElL3GUczluPC9zRsE6 YkzPF31l25K85AtheGEu1uYPzC7BYDvMlnPLpqyRT2+msW+7wvLhM5yWJLuR2ASJG3zr JR7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=KjKcmvesKMOfQvirTv9DqxPBipEMdr9d2inmQgOn+s4=; b=OQsIN2vCtWhcrgb0oOpXdj7rCVmMPId2g/g+MpAKlnqy3akF9LJEKc4y94SAzDZIMS rHyzeCCeZdeqKtIyNWSXByTjrQ3H741Sk9U9gmpURRJqujYSMePuQwqey7OjAeWstsXk ymhyDgPQUWZPE1ZpE4aubFabTwh92xVf37oUPR2D6hgdFKnXokIXS5kMKgs+VIzQu7na PCCacdbTernxPWpWuEXtAxhNTSZdm16tJwrc1liM0c1S4DH39qMrh+Kt1xTt7i2kmQuK fw9SVEVwvWzaPdfKR/J1p14Vb/ApNmtTJL9e/NCl4MifqpbetNMybWbKuKDMTwtDG8ah jOZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tkoda7tx; 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 q25-20020a637519000000b0050c0f15c68fsi13778562pgc.77.2023.03.21.15.01.49; Tue, 21 Mar 2023 15:02:07 -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=@google.com header.s=20210112 header.b=tkoda7tx; 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 S230338AbjCUWBF (ORCPT + 99 others); Tue, 21 Mar 2023 18:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbjCUWAp (ORCPT ); Tue, 21 Mar 2023 18:00:45 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D8D5591F2 for ; Tue, 21 Mar 2023 15:00:36 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id h66-20020a628345000000b00625e0121e40so8147135pfe.1 for ; Tue, 21 Mar 2023 15:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679436036; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=KjKcmvesKMOfQvirTv9DqxPBipEMdr9d2inmQgOn+s4=; b=tkoda7txDF5YFbkW+Mt/PmeisXwqsGdCNNiWC7XyWUmM7WlTyiGAQ+S0jYuSJFqxiW IN80Zrw3U1974nErB9TjPhl2gbNt8n9+swhU4bOZXbscFco6IfgyR4ha0MKsSgz/i/N+ TpETbLNOuDVTJAckCx4h1rgt1YE8iIf5jE4YamaAqUI7E+yIOVDuF9pOx8zrCZQUMkOC ejW7z5CjNoBXnvAgk6JOZ4B6F1EhCvQrRo/l/fEhAuFe8Oer/pRFIGob2XKRh39WdxAY OF40O8sbgZWSYr5TJCTsIwmlRdRVVg1NABFchyyXQ6dV3s53u4zcsVsqeYF/l3pVnu+Y bDeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679436036; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KjKcmvesKMOfQvirTv9DqxPBipEMdr9d2inmQgOn+s4=; b=O1bWxtmle3Xt7Q72DQGmUh0HnSlLLhHS0batNlWYvn7jCE+IWMrI9G6zDgZS23DXHR BqnuV7L7Gyrwtkm+heC18vprS8ZzBXqDh2fbOtzexv4x/LbMXZmpaT1VDDcMgF9oF1ym KsRKk9+FjzRElxB6bHoZzIO7k4Pm+wt3RnKRxrbCqr5dMqpIXsKCoCmBzaaLAZ4eDfID RUI/aFJXs7ftdFsOmdwLHoTsesUV/pkIUq13AOxjwEqsKEC/TlifGeCMwhhwhf4nHkrE DQxVo9EHBZJrcrwnFqw6laLrGIZCMwSGL5L0bRtCeRzju0i2sLcjbDUqg70Qsn4m4Zcg Pf+w== X-Gm-Message-State: AO0yUKVKhKHRxa39XDhP9ylU98olexj1e1BGW3fIdNKxXLhGPMMhQaqg UOYq1Xsztu6ZSLrbWpXbXt/5+SbbV90= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:43c6:0:b0:503:2663:5c9f with SMTP id n6-20020a6543c6000000b0050326635c9fmr142889pgp.8.1679436035808; Tue, 21 Mar 2023 15:00:35 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 21 Mar 2023 15:00:15 -0700 In-Reply-To: <20230321220021.2119033-1-seanjc@google.com> Mime-Version: 1.0 References: <20230321220021.2119033-1-seanjc@google.com> X-Mailer: git-send-email 2.40.0.rc2.332.ga46443480c-goog Message-ID: <20230321220021.2119033-8-seanjc@google.com> Subject: [PATCH v4 07/13] KVM: x86/mmu: Remove "record_dirty_log" in __tdp_mmu_set_spte() From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vipin Sharma , David Matlack , Ben Gardon Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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: Vipin Sharma Remove bool parameter "record_dirty_log" from __tdp_mmu_set_spte() and refactor the code as this variable is always set to true by its caller. Signed-off-by: Vipin Sharma Reviewed-by: David Matlack Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu/tdp_mmu.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 467931c43968..3cc81fa22b7f 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -708,18 +708,13 @@ static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm, * notifier for access tracking. Leaving record_acc_track * unset in that case prevents page accesses from being * double counted. - * @record_dirty_log: Record the page as dirty in the dirty bitmap if - * appropriate for the change being made. Should be set - * unless performing certain dirty logging operations. - * Leaving record_dirty_log unset in that case prevents page - * writes from being double counted. * * Returns the old SPTE value, which _may_ be different than @old_spte if the * SPTE had voldatile bits. */ static u64 __tdp_mmu_set_spte(struct kvm *kvm, int as_id, tdp_ptep_t sptep, u64 old_spte, u64 new_spte, gfn_t gfn, int level, - bool record_acc_track, bool record_dirty_log) + bool record_acc_track) { lockdep_assert_held_write(&kvm->mmu_lock); @@ -738,35 +733,34 @@ static u64 __tdp_mmu_set_spte(struct kvm *kvm, int as_id, tdp_ptep_t sptep, if (record_acc_track) handle_changed_spte_acc_track(old_spte, new_spte, level); - if (record_dirty_log) - handle_changed_spte_dirty_log(kvm, as_id, gfn, old_spte, - new_spte, level); + + handle_changed_spte_dirty_log(kvm, as_id, gfn, old_spte, new_spte, + level); return old_spte; } static inline void _tdp_mmu_set_spte(struct kvm *kvm, struct tdp_iter *iter, - u64 new_spte, bool record_acc_track, - bool record_dirty_log) + u64 new_spte, bool record_acc_track) { WARN_ON_ONCE(iter->yielded); iter->old_spte = __tdp_mmu_set_spte(kvm, iter->as_id, iter->sptep, iter->old_spte, new_spte, iter->gfn, iter->level, - record_acc_track, record_dirty_log); + record_acc_track); } static inline void tdp_mmu_set_spte(struct kvm *kvm, struct tdp_iter *iter, u64 new_spte) { - _tdp_mmu_set_spte(kvm, iter, new_spte, true, true); + _tdp_mmu_set_spte(kvm, iter, new_spte, true); } static inline void tdp_mmu_set_spte_no_acc_track(struct kvm *kvm, struct tdp_iter *iter, u64 new_spte) { - _tdp_mmu_set_spte(kvm, iter, new_spte, false, true); + _tdp_mmu_set_spte(kvm, iter, new_spte, false); } #define tdp_root_for_each_pte(_iter, _root, _start, _end) \ @@ -916,7 +910,7 @@ bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp) return false; __tdp_mmu_set_spte(kvm, kvm_mmu_page_as_id(sp), sp->ptep, old_spte, 0, - sp->gfn, sp->role.level + 1, true, true); + sp->gfn, sp->role.level + 1, true); return true; } -- 2.40.0.rc2.332.ga46443480c-goog