Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp131670lql; Fri, 12 Apr 2024 06:07:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVky9azp/IQcHwvyveNlEOKyIIi9fnsIxYKQwCfJGNJL63Pl3s3w8uVXsBSzNVU7WJPgZiSVLT5qluif0oNP2ADpQESmK7oJP9nXYwDzg== X-Google-Smtp-Source: AGHT+IHZWrYdSEKTyaE8A2E+mviaqSZwPN7LTV1aQ6hWSwQLEYdI9sxcR6la/G0o5h4vJMLJKleL X-Received: by 2002:a17:902:cec9:b0:1e0:b562:b229 with SMTP id d9-20020a170902cec900b001e0b562b229mr2586521plg.47.1712927274700; Fri, 12 Apr 2024 06:07:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712927274; cv=pass; d=google.com; s=arc-20160816; b=RYWcuJaLKfv5axLZzTIPoIlKWgc2bWrXhkFO3b/OkCCd4q1bTufv+0QhfwluWfZQdr uzcYfbTEZ5JOTS/wveCk+lAp9FMUfWXYL7ASLNCoQDP9rooCIbHagsKIPNfYvszqjPJ9 dE0TZpnCFJJFlR2WYjEKhcx+UCygwku/7ev1yHEJBYIE2cV7o5+q0F4G5zTAOGHyv6Fp WPYsr3Bie3pcEbVAixNYf1cqgYq28u6+ABHsaKnhX3zCgJAfyhmwNHx4o+/ZdggMB0+H H8GgsGRip0JQG8pL2X/+aI81Pr23kWxabuMzvI2Wj8px7uuArH9QncR0J69zSv8ghrxo DG/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=fvv8bmoE56ytuE8oU0xD8pxdC/lIJe/x6Ca/s0HAH6k=; fh=E5zaIUrFbrEY9VpMCbLis7tLsgr8qOSNkdwQ90XcLpc=; b=uK4ikhTfaXIEDMdbL6Gc81/j4bCCtRldwmRLfCEMZjlck+/YTnmkO13tLS6w316Xb0 r5jj00624Xugm79H+d5n+fWPNEC7fJDhR8mMW5GHmnuldohn7NDKkPZNHldE6gsNxWg6 ANpSTNy33/Qgsf19WLJwG7OYmXVP/gBfR2sDJa/PWlSimbaZQ/4xQN9duT4lSwtLdghF 2GEypduEuE1ztCrYyayL1y7XPy54eOhrz8BuvoF7//bQifi0SUU724SkpWYduqNpxekq XMB0gJxCIEeuiPv6NeQkj+HOsvdlVSh9DMVIeUqgUhOK1vm+hNafcjualWcPZSMD8icl S9Lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mlWYRY6R; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e13-20020a170902ef4d00b001e587cae58dsi1966309plx.638.2024.04.12.06.07.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 06:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mlWYRY6R; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D6F4281F6E for ; Fri, 12 Apr 2024 13:07:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB1865F874; Fri, 12 Apr 2024 13:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mlWYRY6R" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CC854224D8; Fri, 12 Apr 2024 13:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712927263; cv=none; b=iH/E8a1bESxvMQRDDxc6HNPMm7+uaZWyuN682tWdbBBlgbz0PMwe8aweteOrMqpEIGDun7r2xAlprMXCn9+/4muIxBZmvTqs0TRR5b4bTkxjJvOWHJ0WZC9MgTB1Qyl+qjA0ZjVSXRqNhDaqAWmCmk73PwhXx5a7GL/uhshW2h8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712927263; c=relaxed/simple; bh=WXXIdGk+X4xSO8A0Mdd/JdZXvSOz7cKKHzKcx7zp/e4=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=YmMAEgkC1dkAh6rJCF1JtWJEJT8jcU3rBhxyMeJizZ9bzyWivMdqYo5cBR3krZC+zaZcugYMRGftcokw8uTEplW+tMQXCQZf6D02vbrI0o7tX6vGcpmXnBHpZam62Tn42chkWaa49jh3NEmRa3Zz9ISBkqapBmvDp7JYsPNO/AU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mlWYRY6R; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C47CC113CC; Fri, 12 Apr 2024 13:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712927262; bh=WXXIdGk+X4xSO8A0Mdd/JdZXvSOz7cKKHzKcx7zp/e4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mlWYRY6R+uO4KNbt8cIf64MguVd8/GHUg7jqEfibnb2j2yYOr842hoff3W6jZ2W6Q BRWCuZA/oNlXy6/0CFH3viAXrc8qD5Z1kg2VqyfMrkRlL0GkKt6FGGkq7vjol+/rWf xhKn1pcS/RFNPqEmpu+De8hHFtcOYW9290Q6wreBB+LuxJjv7MvmphVuMNI5yVeK6v 8LwCZ6+IMlvHhnGCu56SknAEpcfLvStMVcRpKtbhCnCjRQrnLJanixlnZPvxJPcLtA DyvXUuh5xMgv1rPhe/ETCYBkM2o42kXk36Yi7g8UEQFJ2zPIyYqG+w5RiuGqXWqE3I xnLxdM3U5CxIw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rvGd1-003tLC-MV; Fri, 12 Apr 2024 14:07:39 +0100 Date: Fri, 12 Apr 2024 14:07:38 +0100 Message-ID: <86le5isp9h.wl-maz@kernel.org> From: Marc Zyngier To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Oliver Upton , Tianrui Zhao , Bibo Mao , Thomas Bogendoerfer , Nicholas Piggin , Anup Patel , Atish Patra , Sean Christopherson , Andrew Morton , David Hildenbrand , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH 0/4] KVM, mm: remove the .change_pte() MMU notifier and set_pte_at_notify() In-Reply-To: <20240405115815.3226315-1-pbonzini@redhat.com> References: <20240405115815.3226315-1-pbonzini@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: pbonzini@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, oliver.upton@linux.dev, zhaotianrui@loongson.cn, maobibo@loongson.cn, tsbogend@alpha.franken.de, npiggin@gmail.com, anup@brainfault.org, atishp@atishpatra.org, seanjc@google.com, akpm@linux-foundation.org, david@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 05 Apr 2024 12:58:11 +0100, Paolo Bonzini wrote: > > The .change_pte() MMU notifier callback was intended as an optimization > and for this reason it was initially called without a surrounding > mmu_notifier_invalidate_range_{start,end}() pair. It was only ever > implemented by KVM (which was also the original user of MMU notifiers) > and the rules on when to call set_pte_at_notify() rather than set_pte_at() > have always been pretty obscure. > > It may seem a miracle that it has never caused any hard to trigger > bugs, but there's a good reason for that: KVM's implementation has > been nonfunctional for a good part of its existence. Already in > 2012, commit 6bdb913f0a70 ("mm: wrap calls to set_pte_at_notify with > invalidate_range_start and invalidate_range_end", 2012-10-09) changed the > .change_pte() callback to occur within an invalidate_range_start/end() > pair; and because KVM unmaps the sPTEs during .invalidate_range_start(), > .change_pte() has no hope of finding a sPTE to change. > > Therefore, all the code for .change_pte() can be removed from both KVM > and mm/, and set_pte_at_notify() can be replaced with just set_pte_at(). > > Please review! Also feel free to take the KVM patches through the mm > tree, as I don't expect any conflicts. > > Thanks, > > Paolo > > Paolo Bonzini (4): > KVM: delete .change_pte MMU notifier callback > KVM: remove unused argument of kvm_handle_hva_range() > mmu_notifier: remove the .change_pte() callback > mm: replace set_pte_at_notify() with just set_pte_at() > > arch/arm64/kvm/mmu.c | 34 ----------------- > arch/loongarch/include/asm/kvm_host.h | 1 - > arch/loongarch/kvm/mmu.c | 32 ---------------- > arch/mips/kvm/mmu.c | 30 --------------- > arch/powerpc/include/asm/kvm_ppc.h | 1 - > arch/powerpc/kvm/book3s.c | 5 --- > arch/powerpc/kvm/book3s.h | 1 - > arch/powerpc/kvm/book3s_64_mmu_hv.c | 12 ------ > arch/powerpc/kvm/book3s_hv.c | 1 - > arch/powerpc/kvm/book3s_pr.c | 7 ---- > arch/powerpc/kvm/e500_mmu_host.c | 6 --- > arch/riscv/kvm/mmu.c | 20 ---------- > arch/x86/kvm/mmu/mmu.c | 54 +-------------------------- > arch/x86/kvm/mmu/spte.c | 16 -------- > arch/x86/kvm/mmu/spte.h | 2 - > arch/x86/kvm/mmu/tdp_mmu.c | 46 ----------------------- > arch/x86/kvm/mmu/tdp_mmu.h | 1 - > include/linux/kvm_host.h | 2 - > include/linux/mmu_notifier.h | 44 ---------------------- > include/trace/events/kvm.h | 15 -------- > kernel/events/uprobes.c | 5 +-- > mm/ksm.c | 4 +- > mm/memory.c | 7 +--- > mm/migrate_device.c | 8 +--- > mm/mmu_notifier.c | 17 --------- > virt/kvm/kvm_main.c | 50 +------------------------ > 26 files changed, 10 insertions(+), 411 deletions(-) > Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.