Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5202925rwl; Tue, 21 Mar 2023 15:15:10 -0700 (PDT) X-Google-Smtp-Source: AK7set91dSpueQFOuxGvXKU5YtSxVEcibYSVJeVtBKFdmNPOrAYxPgnPrjbUOcsD4HYh3NqLGOib X-Received: by 2002:a17:906:10d0:b0:931:4285:ea16 with SMTP id v16-20020a17090610d000b009314285ea16mr4196748ejv.7.1679436910152; Tue, 21 Mar 2023 15:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679436910; cv=none; d=google.com; s=arc-20160816; b=XRRr7w9BZadINaiCyY8qheMVddfKaZfaa2/jpR/K8BqkdfxcY9DU6MPEkWx/CnYog/ hAD/bnrNmswPNidGb0Ae7D7rE5rtZsOhf9U5kuoh7oXOrwWx8eHpruibkPXzoXZo7lB3 S73qxRjml2H5ZkpOGxDZRHUXPW+hA0F6ROl4KK2IAU4I/weSKpyua5U2c154zU8auyqI Llx00NHwso1BZqD34cTBmsIOCk+v0NEcxPL67MjhSxyBsidqo3UNO+wL66W8/ODLVtvZ xWCqQrh4Je6jX53SqGIupm2gBMYneDpSaZXfBLEX3YtMDQyU1Ny+71OYrb77KjsSkJXT d7IA== 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=g5IUgDmGKg6jS9TeGySBz+vT2au0VaL5ai4ERvav8Fo=; b=T6/yOikdbzlZL5IEo4VLb1+rK4LZpYRElf6jaIFaDusF9Hjaz//s7VAvvGBwIu/zyU 93E3zlXtRZaiuGwLTe2/O896om68E2l6Jk2dxkkLk1NcjBNsDdpTwgPyRExQso6lMIWn uXuzRMkl0ZQgsARIvX3ZiQlCJc712P1gCBmK0tCX+NHxzm0chPYBpCj2UyKOwyaV8i76 cZJBYQ+K5GWXucvCI17HNxglk0VEY41WSsY9+BVaYTS16/BwzFLDuKBd8o4e+yJh21/v +W+bQUvnQamXq/iXi09w1NOwtLSZlWJ9RHhjyxxE/t5gYXa4+6sGmCwU42GMF9kS9BUU G19A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IPQCsgpH; 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 21-20020a170906225500b0092554df06ffsi15131434ejr.286.2023.03.21.15.14.46; Tue, 21 Mar 2023 15:15:10 -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=IPQCsgpH; 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 S230272AbjCUWB0 (ORCPT + 99 others); Tue, 21 Mar 2023 18:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbjCUWBD (ORCPT ); Tue, 21 Mar 2023 18:01:03 -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 B9B7D25BB3 for ; Tue, 21 Mar 2023 15:00:41 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id p36-20020a056a000a2400b005f72df7d97bso8199486pfh.19 for ; Tue, 21 Mar 2023 15:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679436041; 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=g5IUgDmGKg6jS9TeGySBz+vT2au0VaL5ai4ERvav8Fo=; b=IPQCsgpH532ux37jGtK+gee01/TmGVQihY3q1GSL5SbWGpDOmVHoKwjo9gY1VnBvV7 iQvqVl9VlJ9vSNl5eVAmVDd7inExLA22z9oDXKCLG2DFexsbV7JhWWOqLXEKnVvofSNO 02oLDJtx5gKZtP/TbiWLFuQI++cTODWPWXUpLRfymbIl6Y0lJZOe+QA5Vlz7+mKA60We 266VMnURrV3+LDfx+ovmWN++5M3RvB3G6JUk3BUX+gKMWINAundUZC3cd02gKOwgpJUQ KATJb9cZratcUCkP83G9ozJQKZSkwe5NIyvlkwV4qv0/2vgW9fH+5F+PVl1KjMo9lSmO IZaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679436041; 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=g5IUgDmGKg6jS9TeGySBz+vT2au0VaL5ai4ERvav8Fo=; b=56xIqrCrGtcJwZdxllLs+ce5Dy0Iqsndrj0fN8wn+dkYQTuDrv+uTswHUWH5p24zlw 1llpNKmdqIlDFROpDAVZB1k38B14iiX/ynBmIrIJjuUdNfKF5MCZY+RKyHYhIKFhPZ5D keKKyJkFvBsahEfOofD7s6TvI+kJFTyZBkAKfg12qw3ApicHW/TxDJyetEWf/rqGqYNj tax/yBmQAtolFlzs6cdGOh1uy+0qZYMMuxtmMGEtQfzrzn+lBizlkjcl0TSGFupQaWnZ kIMV6rbY1QrQ5HNrXyIvtr02oof2dhzN003XbKUJOynKAbAEl6oU8RVUqwbPapIQBzcr TAVA== X-Gm-Message-State: AO0yUKUjzVlejxhACIh5nflY58Y/HqDBpfxV/sJm+WHf1ovOSAJObCuZ 7SMN1DVXEf7zDb8qsrZmEt5qKY1SeIE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:4349:0:b0:502:fd12:83ce with SMTP id k9-20020a654349000000b00502fd1283cemr154916pgq.5.1679436040780; Tue, 21 Mar 2023 15:00:40 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 21 Mar 2023 15:00:18 -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-11-seanjc@google.com> Subject: [PATCH v4 10/13] KVM: x86/mmu: Bypass __handle_changed_spte() when aging TDP MMU SPTEs 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 Drop everything except the "tdp_mmu_spte_changed" tracepoint part of __handle_changed_spte() when aging SPTEs in the TDP MMU, as clearing the accessed status doesn't affect the SPTE's shadow-present status, whether or not the SPTE is a leaf, or change the PFN. I.e. none of the functional updates handled by __handle_changed_spte() are relevant. Losing __handle_changed_spte()'s sanity checks does mean that a bug could theoretical go unnoticed, but that scenario is extremely unlikely, e.g. would effectively require a misconfigured MMU or a locking bug elsewhere. Link: https://lore.kernel.org/all/Y9HcHRBShQgjxsQb@google.com Signed-off-by: Vipin Sharma Reviewed-by: David Matlack [sean: massage changelog] Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu/tdp_mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 29bb97ff266e..cdfb67ef5800 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1275,8 +1275,8 @@ static bool age_gfn_range(struct kvm *kvm, struct tdp_iter *iter, iter->level); } - __handle_changed_spte(kvm, iter->as_id, iter->gfn, iter->old_spte, - new_spte, iter->level, false); + trace_kvm_tdp_mmu_spte_changed(iter->as_id, iter->gfn, iter->level, + iter->old_spte, new_spte); return true; } -- 2.40.0.rc2.332.ga46443480c-goog