From nobody Wed Sep 17 05:42:40 2025 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 78A7BC4332F for ; Fri, 23 Dec 2022 01:00:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbiLWBAY (ORCPT ); Thu, 22 Dec 2022 20:00:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiLWA7d (ORCPT ); Thu, 22 Dec 2022 19:59:33 -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 9033131342 for ; Thu, 22 Dec 2022 16:58:22 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id z13-20020aa79f8d000000b00576b614b7d2so1849893pfr.14 for ; Thu, 22 Dec 2022 16:58:22 -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:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=RKF7pwud8YLdZV06SWOZWpUgew9kaBR/2Zer0uK8JrI=; b=Y78zDIL9TSKjC5fZ1xAudaofop4B7AoTczbfjdkWES3ri03Eu2accYPDVJ7U07L3YV bMXEgI7ZWdjTfCx1xYZSyZMf1+5W/HnZm0sdRrUfn4Ng8EmUBQAqj21hV/9jZ2vBeVbk nuSCozTMkur3ocnGD73uNO8NMJDs97XPzQNQBCx9X1Sj4sjULH/clMevSMApOLor5s4N 5jh0ZFD2g7HUAQiUMlVq2cRtppI+TyI2fzSOnSvadfjsLUZU30evAxHXvMIWmQdD+j2D t8mVx08wS2KT1xKVDQNjayha/lafuX7Ned3uBtlIwPyOEcBTZpJ9AklmSlDTlHgpWEea Z60Q== 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:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RKF7pwud8YLdZV06SWOZWpUgew9kaBR/2Zer0uK8JrI=; b=b2wtlZyH/ZFJHR3pSY2Et5CQekpzuXA/dAcRbgK4EDYIP6cX5C5CuWfncALubQwUr8 yAzE0bmCr4WSRKWkLEfxrq7HH77WIPPmVmVXo1TJk/GmJtIjERePUV7GWhvGFhU7iSzB d6QjmJ3unOGI9mLS4oD4J/XiDrX/jNqewtmaXuXL9XSZaW5O8WZYidn2mC7/3tbRr6GV VmqGBlJaFhp0fGOLFgpwjGiIq7yDoutQkNw8c0MYFteUU0+lkhJINMK8z2IDWWQkVCq7 2y+Jvd+fEQZGlvOBa1MCEvlVH8i0oIpTZa+t3PTKPQwTXu30KuzpaP73e5i194t2E4i/ e2Ng== X-Gm-Message-State: AFqh2kpB9o2MuWUrQactp2BU+nTbfsYNFp9Oa5ZahM804w0/kU/K+TNy ZHBtAIGylhCSsVVGRBpGIDuTxdtXm/Y= X-Google-Smtp-Source: AMrXdXuPSOsnVIaAhuI/GEjWy6KZo22luijB03To5PTg4Z2znC3GOTMDbFFlTwqCGXNJMyxXYza7fLxRkak= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:aa7:9495:0:b0:537:b0c3:691 with SMTP id z21-20020aa79495000000b00537b0c30691mr554633pfk.59.1671757094428; Thu, 22 Dec 2022 16:58:14 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 23 Dec 2022 00:57:29 +0000 In-Reply-To: <20221223005739.1295925-1-seanjc@google.com> Mime-Version: 1.0 References: <20221223005739.1295925-1-seanjc@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221223005739.1295925-18-seanjc@google.com> Subject: [PATCH 17/27] KVM: x86: Remove the unused page-track hook track_flush_slot() From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Zhenyu Wang , Zhi Wang Cc: kvm@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Yan Zhao , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yan Zhao Remove ->track_remove_slot(), there are no longer any users and it's unlikely a "flush" hook will ever be the correct API to provide to an external page-track user. Cc: Zhenyu Wang Suggested-by: Sean Christopherson Signed-off-by: Yan Zhao Signed-off-by: Sean Christopherson --- 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/k= vm_page_track.h index 152c5e7d7868..e5eb98ca4fce 100644 --- a/arch/x86/include/asm/kvm_page_track.h +++ b/arch/x86/include/asm/kvm_page_track.h @@ -33,16 +33,6 @@ struct kvm_page_track_notifier_node { */ void (*track_write)(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); =20 /* * Invoked when a memory region is removed from the guest. Or in KVM @@ -87,7 +77,6 @@ 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 *sl= ot); void kvm_page_track_delete_slot(struct kvm *kvm, struct kvm_memory_slot *s= lot); =20 bool kvm_page_track_has_external_user(struct kvm *kvm); diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c index 959be672e2ad..d2b9f7f183cc 100644 --- a/arch/x86/kvm/mmu/page_track.c +++ b/arch/x86/kvm/mmu/page_track.c @@ -277,32 +277,6 @@ void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t= gpa, const u8 *new, kvm_mmu_track_write(vcpu, gpa, new, bytes); } =20 -/* - * Notify the node that memory slot is being removed or moved so that it c= an - * 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 *sl= ot) -{ - struct kvm_page_track_notifier_head *head; - struct kvm_page_track_notifier_node *n; - int idx; - - head =3D &kvm->arch.track_notifier_head; - - if (hlist_empty(&head->track_notifier_list)) - return; - - idx =3D 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 external page track nodes that a memory region is being removed = from * the VM, e.g. so that users can free any associated metadata. diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cb0005e4baf0..f372c41ee2c2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -12610,8 +12610,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); } =20 static inline bool kvm_guest_apic_has_interrupt(struct kvm_vcpu *vcpu) --=20 2.39.0.314.g84b9a713c41-goog