From patchwork Fri Nov 11 09:38:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhao X-Patchwork-Id: 13040056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E92F2C433FE for ; Fri, 11 Nov 2022 10:01:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233116AbiKKKBS (ORCPT ); Fri, 11 Nov 2022 05:01:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233254AbiKKKBQ (ORCPT ); Fri, 11 Nov 2022 05:01:16 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32B45CD1D; Fri, 11 Nov 2022 02:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668160868; x=1699696868; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Oq0v5r5lyxdfiPIBLLI4trHp9sSEgQSGrg182cZ3Cpo=; b=ImYmb5VGJDheRNebzQfZUfnpGQhlvUxgwILw4vSP3zJ9HUUbJS807zfE VDqhrQp3ey8qdGBW2E89RL3bv5cbP5WcBW3UzZzBSIDMp1xHYo9VHVint V9hbDRD5fXlDoc14OSwsjUzxjenTJRe/s9nmDltCJAO2CkRBaU8Sw8kY2 4eiHEuxpFDnOLgQnQ4F5SZA6PeAYwzDLF3aKzap5hayEKSNTaWChewMBD Evn32A23RhATFcGBF0Rl4fD5WvJtsK58wFt3bQu1LE2Ym/A7WRvDhP9TF HqiraiVOQv9Kg1TYAPAde4u/wPX4bxkx9J3kc7zbWSL+P1VybpSfJWZk0 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="397864621" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="397864621" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 02:01:08 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="706497697" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="706497697" Received: from yzhao56-desk.sh.intel.com ([10.238.200.254]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 02:01:06 -0800 From: Yan Zhao To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, zhenyuw@linux.intel.com, Yan Zhao Subject: [PATCH 3/3] KVM: x86: Remove the unused page track hook track_flush_slot Date: Fri, 11 Nov 2022 17:38:26 +0800 Message-Id: <20221111093826.3330-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221111093222.3148-1-yan.y.zhao@intel.com> References: <20221111093222.3148-1-yan.y.zhao@intel.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org There's no users of hook track_remove_slot any more and no external page tracker user cares about slot flush. So remove this hook. Cc: Zhenyu Wang Suggested-by: Sean Christopherson Signed-off-by: Yan Zhao --- arch/x86/include/asm/kvm_page_track.h | 11 ----------- arch/x86/kvm/mmu/page_track.c | 26 -------------------------- arch/x86/kvm/x86.c | 2 -- 3 files changed, 39 deletions(-) diff --git a/arch/x86/include/asm/kvm_page_track.h b/arch/x86/include/asm/kvm_page_track.h index 046b024d1813..4f1d3c91fdc7 100644 --- a/arch/x86/include/asm/kvm_page_track.h +++ b/arch/x86/include/asm/kvm_page_track.h @@ -34,16 +34,6 @@ struct kvm_page_track_notifier_node { */ void (*track_write)(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new, int bytes, struct kvm_page_track_notifier_node *node); - /* - * It is called when memory slot is being moved or removed - * users can drop write-protection for the pages in that memory slot - * - * @kvm: the kvm where memory slot being moved or removed - * @slot: the memory slot being moved or removed - * @node: this node - */ - void (*track_flush_slot)(struct kvm *kvm, struct kvm_memory_slot *slot, - struct kvm_page_track_notifier_node *node); /* * It is called when memory slot is moved or removed * users can drop write-protection for the pages in that memory slot @@ -85,6 +75,5 @@ kvm_page_track_unregister_notifier(struct kvm *kvm, struct kvm_page_track_notifier_node *n); void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new, int bytes); -void kvm_page_track_flush_slot(struct kvm *kvm, struct kvm_memory_slot *slot); void kvm_page_track_remove_slot(struct kvm *kvm, struct kvm_memory_slot *slot); #endif diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c index 4d6bab1d61c9..f783aea618f8 100644 --- a/arch/x86/kvm/mmu/page_track.c +++ b/arch/x86/kvm/mmu/page_track.c @@ -275,32 +275,6 @@ void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new, srcu_read_unlock(&head->track_srcu, idx); } -/* - * Notify the node that memory slot is being removed or moved so that it can - * drop write-protection for the pages in the memory slot. - * - * The node should figure out it has any write-protected pages in this slot - * by itself. - */ -void kvm_page_track_flush_slot(struct kvm *kvm, struct kvm_memory_slot *slot) -{ - struct kvm_page_track_notifier_head *head; - struct kvm_page_track_notifier_node *n; - int idx; - - head = &kvm->arch.track_notifier_head; - - if (hlist_empty(&head->track_notifier_list)) - return; - - idx = srcu_read_lock(&head->track_srcu); - hlist_for_each_entry_srcu(n, &head->track_notifier_list, node, - srcu_read_lock_held(&head->track_srcu)) - if (n->track_flush_slot) - n->track_flush_slot(kvm, slot, n); - srcu_read_unlock(&head->track_srcu, idx); -} - /* * Notify the node that memory slot is removed or moved so that it can * drop write-protection for the pages in the memory slot. diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a24a4a2ad1a0..260288f4d741 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -12872,8 +12872,6 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm, struct kvm_memory_slot *slot) { kvm_mmu_zap_all_fast(kvm); - - kvm_page_track_flush_slot(kvm, slot); } static inline bool kvm_guest_apic_has_interrupt(struct kvm_vcpu *vcpu)