From patchwork Fri Feb 3 19:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Sharma X-Patchwork-Id: 52621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1026046wrn; Fri, 3 Feb 2023 11:43:46 -0800 (PST) X-Google-Smtp-Source: AK7set80adhWtIitSUWt1duCQR2/64QUf1xdtHubNf8f9SiAo18wmb36/W7tv5mH3a1RYIW99ueF X-Received: by 2002:a17:90b:4a51:b0:230:76b1:8db2 with SMTP id lb17-20020a17090b4a5100b0023076b18db2mr2716412pjb.31.1675453426614; Fri, 03 Feb 2023 11:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675453426; cv=none; d=google.com; s=arc-20160816; b=hc5Ayl0sgmtWsic+j7mtcMYgTfrGQ8ZZ7ukLDrSM0jIX5yQpTVsqSmIdfnwwHw4M9O rKvqx7a6MfnMY2vzad8284sbY4p52vs5vrIDREuFVY8hl6vNAtlcER7UbZSWqAEPLU75 /sYtrNoEdo9ssvYydPx5dSVQBcxo4QCAre4982+Rc8KCF0cyQHLoaecoFwqf5TzUSY77 Z8Wxxv0EaU+9NPpw6zOmOsrnfQf9yuT3P4Axwsvv4R4mKoBs50OnQMUQHP4D/8oq4s1M 7wy6RK3G4mZfTar6HJDFWNV3Gz1X/t0IiY/EaAQJUNwL6sCwggNYYyg4KQB4U5cdn1po RZuw== 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:dkim-signature; bh=AcI5nZSY78YItFhCkcPCsgYpVHXo4G2xX3PARLK9PNY=; b=RgR49feeLq8Jfh82HeoegYY+YIhew20yODkBaY73BNYN+2prl1WhAD80uC6j7XDSEu nbb3CNDBrAAM7/s1NQnnT203UEkqVHiVK1gQFz8x3TITb6mQHxeDDgc8TctXuND0hbDK dMaFpvL+vqVTN36OQkznEYREPDoWYoLDzPzmfAqTK/IZ2KcajIJ3uOALbk1Ms7ReWU1C 2jbrD4N9sz6ONv69pI6GNS/taxTcpuOukmBK7/51ecYVoXrFv6xb5UPU5Iuy8SJO01sG GCZVlkWf0Mj2mc1QHppcqWgwGbMFi6SR6f69a7PoknzIrTIFs2F4tXxBlhn+W1/KAHd0 LjXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jnIgJE60; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp7-20020a17090b4a8700b0022c34ca3e99si4387591pjb.159.2023.02.03.11.43.30; Fri, 03 Feb 2023 11:43:46 -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=jnIgJE60; 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 S233721AbjBCT2n (ORCPT + 99 others); Fri, 3 Feb 2023 14:28:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233142AbjBCT2h (ORCPT ); Fri, 3 Feb 2023 14:28:37 -0500 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 E43B6A8A3D for ; Fri, 3 Feb 2023 11:28:32 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id i15-20020aa787cf000000b00593addd14a5so3169681pfo.15 for ; Fri, 03 Feb 2023 11:28:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AcI5nZSY78YItFhCkcPCsgYpVHXo4G2xX3PARLK9PNY=; b=jnIgJE609c2sptSoHjjd3x7jZtT7KKK/MLWWeUqiS8WA2JDk4FeRouptRJICfrxIiL ltXurNvSD6sG3igKDh2jIDvC139/r0ohRfJJG6pQnedSojgn6p86/PzyD7KtkRoozEMs kQk/oF3N032gLlif8xUP5eDhlBX1h9Xgbe6TauMdaNiztnykutoA6logtvV9fpbOhff/ n6fE5UFqDNwzbhaTz5ygCEMGiXIgDXG7fGIjHp4wkMPYAh1YXKf21kdIrLMzALj8a3u4 tudd1dArJcrxBZaQnyHLlr0CksaMvJ3/TD4Fet8r0s0LPkO4YK/ew1sp3r98Mpuf0rDv KtMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AcI5nZSY78YItFhCkcPCsgYpVHXo4G2xX3PARLK9PNY=; b=1WJ1VK4vNj1LvqXBiJXCHJ2ktYu+u0uctmEvScXBSaRJynf+bX74++Ri0V6y9mVJ/P Ugtze2YucY+gW0Eep/vVIfNc0Q3m066ic0GKH5fDFvaqVeKIyTN6+mMgMCoWx4Lg5c6f IzrK2JaUrhrm31OmpYnIx9/IkYeLRT5+T40CNrLyJ9GiaITt5CcUSDJ+2XPl7kWkcGO1 7SMsqgYgjGLesdJnTemFsOg53cjdqOR3DDRZBFWb7xc2P7/hQt0axlZfQ+x1tIStHbD9 nDNGoEgiwk+s012MzBbrR5KJ0NGjDIW6yWkowaxEfGSS5PICNoudUFVEVxKHo6c93DDR UNTg== X-Gm-Message-State: AO0yUKVgBh95NG4+Dqd3zEe2asG1K0QNpnjIDBWcWzAHuV2pcXkDiJRZ kYKFvpoSqFOIIDhI8WYfRfMoIHWsBykP X-Received: from vipin.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:479f]) (user=vipinsh job=sendgmr) by 2002:a17:902:ea03:b0:196:6b0d:752b with SMTP id s3-20020a170902ea0300b001966b0d752bmr2649815plg.19.1675452512414; Fri, 03 Feb 2023 11:28:32 -0800 (PST) Date: Fri, 3 Feb 2023 11:28:21 -0800 In-Reply-To: <20230203192822.106773-1-vipinsh@google.com> Mime-Version: 1.0 References: <20230203192822.106773-1-vipinsh@google.com> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog Message-ID: <20230203192822.106773-5-vipinsh@google.com> Subject: [Patch v2 4/5] KVM: x86/mmu: Remove handle_changed_spte_dirty_log() From: Vipin Sharma To: seanjc@google.com, pbonzini@redhat.com, bgardon@google.com, dmatlack@google.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vipin Sharma X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756840252122303619?= X-GMAIL-MSGID: =?utf-8?q?1756840252122303619?= Remove handle_changed_spte_dirty_log() as there is no code flow which sets leaf SPTE writable and hit this path. Signed-off-by: Vipin Sharma --- arch/x86/kvm/mmu/tdp_mmu.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 18630a06fa1f..afe0dcb1859e 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -345,24 +345,6 @@ static void handle_changed_spte_acc_track(u64 old_spte, u64 new_spte, int level) kvm_set_pfn_accessed(spte_to_pfn(old_spte)); } -static void handle_changed_spte_dirty_log(struct kvm *kvm, int as_id, gfn_t gfn, - u64 old_spte, u64 new_spte, int level) -{ - bool pfn_changed; - struct kvm_memory_slot *slot; - - if (level > PG_LEVEL_4K) - return; - - pfn_changed = spte_to_pfn(old_spte) != spte_to_pfn(new_spte); - - if ((!is_writable_pte(old_spte) || pfn_changed) && - is_writable_pte(new_spte)) { - slot = __gfn_to_memslot(__kvm_memslots(kvm, as_id), gfn); - mark_page_dirty_in_slot(kvm, slot, gfn); - } -} - static void tdp_account_mmu_page(struct kvm *kvm, struct kvm_mmu_page *sp) { kvm_account_pgtable_pages((void *)sp->spt, +1); @@ -614,8 +596,6 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, __handle_changed_spte(kvm, as_id, gfn, old_spte, new_spte, level, shared); handle_changed_spte_acc_track(old_spte, new_spte, level); - handle_changed_spte_dirty_log(kvm, as_id, gfn, old_spte, - new_spte, level); } /* @@ -727,8 +707,6 @@ static u64 _tdp_mmu_set_spte(struct kvm *kvm, int as_id, tdp_ptep_t sptep, __handle_changed_spte(kvm, as_id, gfn, old_spte, new_spte, level, false); handle_changed_spte_acc_track(old_spte, new_spte, level); - handle_changed_spte_dirty_log(kvm, as_id, gfn, old_spte, new_spte, - level); return old_spte; }