From patchwork Fri Nov 11 10:35:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhao X-Patchwork-Id: 18682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp670851wru; Fri, 11 Nov 2022 02:59:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf7x0K3JOwIeE8Ma41pQZjL0hpAcrLSppAISPRm52BDAmujKdT4MLc4X5Hnotb1q6Xx9ynhO X-Received: by 2002:a63:4750:0:b0:457:f4bb:513 with SMTP id w16-20020a634750000000b00457f4bb0513mr1151070pgk.331.1668164362256; Fri, 11 Nov 2022 02:59:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668164362; cv=none; d=google.com; s=arc-20160816; b=JupM+WEX8EvNdIHsZTnTXpJgIISAdth0XGTqVDzEYLE+gx9I+UfbRIUf2fwHz/FM82 w7T8/g88Og1ThNYqgR2ZfjGIq2UCaRWoCTYMgGYEp1nE2eSZyBnlo0hWMu5mB32adD2m rgzVAuIFtTkat/+7AIBh+Tdc/BzYz1WCDuX9kmbicm104b2BSslgK0IfZ4yW8DHTLZAE eLeiJWvWHYw+AcxxyL1j95EeW+8ZD26Ek/q72UNDq+PJH1VCmvq/pxMSwS/4GiiERr1n utRowCr+bR3mD+hsQoXleyW/NTeiLnXg7VHxJnLpbqV7czu8Ck42qNv/jW9CqJlARI8s ri+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=tU9R+7wHd4HTx2dBc4+of8Lv3esfQ5GQKGNuWzcAXRs=; b=E93WgSwotPfClOpsYPUSmPElD+QkBIlt39dOeHoyIGUJVVSoa9VL2laWRPibphKR+p EzQaX5j+aQ5Xc5aXaMT3sRZMegzn8m+ClXS4+u58Kk5ImkByT0LAPynb7n6bOC78IHsx 3or+qheSVzfW4vFvTdVe16wf9cib+qv+xG/C4pEDYx9kYaqw/grv+48illwXQcguhtVt cm1g3A9T6CFlg9VZgRQIXGeRky1hwb51AyGbXFtKlpP2lO+XZ5uWU9E6Ot3SBhfu/Njy XIBHZnPq3HDGu+OLQbw6fVR2iKOg3FfBwI8HCd2+j+Dm8276B3gKwcil51LFz1GJvVjP DKbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VeYzLMhP; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a056a000a9500b0056e3400fddfsi2312605pfl.195.2022.11.11.02.59.08; Fri, 11 Nov 2022 02:59:22 -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=@intel.com header.s=Intel header.b=VeYzLMhP; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231167AbiKKK6K (ORCPT + 99 others); Fri, 11 Nov 2022 05:58:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbiKKK6C (ORCPT ); Fri, 11 Nov 2022 05:58:02 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B3E7C6A; Fri, 11 Nov 2022 02:58:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668164281; x=1699700281; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rdP472iIcXARHSPftEHD7qv99p1yFZZR6gsVvb/7Mfg=; b=VeYzLMhPeciTSVrNZEzuxmDkClIfd6yT1liO6FOPLuQkSgdb2gHwrQfl H7X4aJsBM4A0ZRr72wIeSPELppPT0yOOl9+wb5ahVQRzwGzmlEtJfUqCf Tz1IkcJbqoUPSUrwMDiM/9XPwwDvBat5J2VKDXsmPtBW+BcpcBM/3nabA H5kHBxvJztwwJG4Len2X+l79rPKRVZUkDfztJjo/WaLuiYX7gNKqGdSE1 QV2lx83Ftw178z41MG100PQrw9FwgLaPcRwD15l0V+DInis+DC13N8k8R 330Ni4Bj1Wy+AoQ7Hr4Y7jTrcmivcWmx6FFUS1Iyuf4QK7NvnPinxdcwj A==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="309202929" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="309202929" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 02:58:01 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="706509732" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="706509732" 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:57:59 -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 v2 3/3] KVM: x86: Remove the unused page track hook track_flush_slot Date: Fri, 11 Nov 2022 18:35:04 +0800 Message-Id: <20221111103504.22431-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221111103247.22275-1-yan.y.zhao@intel.com> References: <20221111103247.22275-1-yan.y.zhao@intel.com> 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_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749197114313827610?= X-GMAIL-MSGID: =?utf-8?q?1749197114313827610?= 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)