From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC62052BE5D for ; Wed, 9 Sep 2026 10:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788950546; cv=none; b=qvHYAaI6Q+BMzgCVeuIzwlR8PtW4KQRvvbFJXmwkYHoGBixGIrpYYsRobpyt9aCkimqwnfpn7aQTiCz6+glDRdzQgCtwOW6WwvTR/+1IVXLVTaeOIKWQV1DaMSXB+u6ZkSx+itLcaIy+UnRRDrU+lYwi2vSNwzpYgmOuI8sNG+E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788950546; c=relaxed/simple; bh=bqgEueA/FGa4pO4wWglS7N2wkLJSX5x/SPGI/hgCXO0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=DIb6AQ9IjatazQqGHX7BI4EZRXWagipQb4hFP6/kr9cPI2JI6Qfx/HDAOyLuaqMv95xy9WG/J6MUcSujZMNI1Qnr+e0nhu5HMA3gpkp9TLfXwZjZ1COV/TvbZo7Bn8OqpX1byBr+td4EeDQXlX4TBw2C+bNCRYljJposIPxc5rM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=beYBtKUH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="beYBtKUH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 336B71F00A3A; Wed, 9 Sep 2026 10:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788950543; bh=RK03JeBlxUBvUpjIXeaIjIL+hURZOlTG6QAHJAJ6JCU=; h=Subject:To:Cc:From:Date; b=beYBtKUHLtK4Hfm613pkltseHz4EIiqj3kd+yLOztPAKAeMPJDylJm0KajQgWR3wM RanO+AiKSqZtVSnTDhbnq9KOTTR3VxQ+d6pKhlxNJIkiIkk+herJAzFnFDBvgL6qOB gsdoqmLOCamAv8o+YyCDGkFlrXQzuJl0taDiHELk= Subject: FAILED: patch "[PATCH] KVM: x86/mmu: Split kvm_mmu_zap_all_fast() into "front" and" failed to apply to 6.12-stable tree To: seanjc@google.com,michael.roth@amd.com Cc: From: Date: Wed, 09 Sep 2026 12:30:11 +0200 Message-ID: <2026090911-eats-threefold-66cf@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x b27622c4eeb125814081baaefe9175191be5b94d # git commit -s git send-email --to '' --in-reply-to '2026090911-eats-threefold-66cf@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b27622c4eeb125814081baaefe9175191be5b94d Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Thu, 9 Jul 2026 13:49:38 -0700 Subject: [PATCH] KVM: x86/mmu: Split kvm_mmu_zap_all_fast() into "front" and "back" halves Split kvm_mmu_zap_all_fast() into a "front half" and a "back half", where the front half is everything that runs with mmu_lock held for write, and the back half is the code that runs outside of mmu_lock. This will allow putting more code inside kvm_arch_flush_shadow_memslot()'s critical section without having to take mmu_lock twice in quick succession. No functional change intended. Cc: stable@vger.kernel.org # 6.12.x Reviewed-by: Michael Roth Link: https://patch.msgid.link/20260709204948.1988414-9-seanjc@google.com Signed-off-by: Sean Christopherson diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 223d80b12b9b..a5c2a560a88a 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -6921,20 +6921,11 @@ static void kvm_zap_obsolete_pages(struct kvm *kvm) kvm_mmu_commit_zap_page(kvm, &invalid_list); } -/* - * Fast invalidate all shadow pages and use lock-break technique - * to zap obsolete pages. - * - * It's required when memslot is being deleted or VM is being - * destroyed, in these cases, we should ensure that KVM MMU does - * not use any resource of the being-deleted slot or all slots - * after calling the function. - */ -static void kvm_mmu_zap_all_fast(struct kvm *kvm) +static void __kvm_mmu_zap_all_fast_front_half(struct kvm *kvm) { lockdep_assert_held(&kvm->slots_lock); + lockdep_assert_held_write(&kvm->mmu_lock); - write_lock(&kvm->mmu_lock); trace_kvm_mmu_zap_all_fast(kvm); /* @@ -6971,8 +6962,12 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm) kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_FREE_OBSOLETE_ROOTS); kvm_zap_obsolete_pages(kvm); +} - write_unlock(&kvm->mmu_lock); +static void __kvm_mmu_zap_all_fast_back_half(struct kvm *kvm) +{ + lockdep_assert_held(&kvm->slots_lock); + lockdep_assert_not_held(&kvm->mmu_lock); /* * Zap the invalidated TDP MMU roots, all SPTEs must be dropped before @@ -6986,6 +6981,24 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm) kvm_tdp_mmu_zap_invalidated_roots(kvm, true); } +/* + * Fast invalidate all shadow pages and use lock-break technique + * to zap obsolete pages. + * + * It's required when memslot is being deleted or VM is being + * destroyed, in these cases, we should ensure that KVM MMU does + * not use any resource of the being-deleted slot or all slots + * after calling the function. + */ +static void kvm_mmu_zap_all_fast(struct kvm *kvm) +{ + write_lock(&kvm->mmu_lock); + __kvm_mmu_zap_all_fast_front_half(kvm); + write_unlock(&kvm->mmu_lock); + + __kvm_mmu_zap_all_fast_back_half(kvm); +} + int kvm_mmu_init_vm(struct kvm *kvm) { int r, i;