Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp643296lqp; Fri, 5 Apr 2024 04:59:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUI6RarUskp8T4cSde08Gt/Rc2pRgpRaCS4m8s+GxfRJdUBAiH6klgsnSyW1RjmDaUPXrpJTeo9A2EH/YvwXojX5X1auSJXpvDgsUCi2A== X-Google-Smtp-Source: AGHT+IF7o0755lNk9kxtQhrCI2BiCpWPyj1o/m4kN1e08qTzr73EJuQ4K5H+ung5AIDYs8IfEmnD X-Received: by 2002:a05:6a20:3d85:b0:1a7:242a:5aaf with SMTP id s5-20020a056a203d8500b001a7242a5aafmr2016402pzi.15.1712318393831; Fri, 05 Apr 2024 04:59:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712318393; cv=pass; d=google.com; s=arc-20160816; b=q9W3OCe8vxy3hxnxZjJmwXVo9oUYxJ3yU+jC7cLjLkL8xNYv2EuhOwCULQqoB1IJEk bEDWNmFFKdenUQAc0OrD33UMO3LWDmg3kr+2Rb1KOiCPrMRy/svK3s08dI8RtviPPNKB 4+doMePshTcGn9Nsi02wKFDwKYKxQmgXLQVsfgPzmkps2j0nnSqQel3E7NI3Xe7BmDXG Aq1wdEzboc+z18WcFmex3h2xyx+i35KWMFjPzNJcdgChbBsRwx42dQKzEJX8CEb/jj4d f6NI2fL9e222F0xgXAODzbvnKxxEVSpQIKZbKFPbJcISweQGvhOyhGnZqJIUwlaZJKc1 UN+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bNbIAMV3AIIh+finZC0kYCtErDA0HoO+gaZWe4mDURE=; fh=ex9tfTLfEV9yrneSsuhwuLnHZmRo6aoxU3STffoDbx4=; b=bs8i4+QLNNoSiHlUu5ZxcTIGABywlgV+ymVpxLvByu+wAqav6+vCD9GcQ9Gj89axk8 PEGFv1ye9fHpRnOSEnlZSmk2JY+46dT9SZk/QebziFReHPb46B9qB2FqoBdMIxX6/nHw 4IsDOsibOK0ybt4WronXSvtgONoNFpkcSit4an+e0wUsfTFgYSWnTftkPObXb+DPo5yB 0Rod6qV4OLfV1+SJP3l0up2drwD7g8DPHkt5lMTlsJzpe8HPrMmDxmbg7XopHHK3tuuL hD4Jy0/z/Yy/3wce+GVsdJOIuInUVwu4kkNTeC9RNnHFEndfhtBff0mmgruqKCsXith/ OuDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fu+9BIpN; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-132939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132939-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id r2-20020aa79ec2000000b006ed0348824bsi585877pfq.190.2024.04.05.04.59.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:59:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fu+9BIpN; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-132939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132939-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8C099B22B6E for ; Fri, 5 Apr 2024 11:59:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F22116D9AE; Fri, 5 Apr 2024 11:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fu+9BIpN" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 B6B3F16D4DF for ; Fri, 5 Apr 2024 11:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712318313; cv=none; b=lQUjsCOZtn8sdpioXacAYsfCgPI4g+Yv/jZYYKnJ9RXHlj1OxolgKwI13EMx1/cFvHt21Jbu/TjZiR8XEq+Lh/Ah9URCJFjAuE9kcoMIVHDd0H9jRKcD0rqFbPgWhwCIS5rbkLh8b1rdWUaPEWYKVo/sJflqZu8c/o7PWk0sEcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712318313; c=relaxed/simple; bh=VOl9mQCZZBeBKTYD0q38JVa+rIW4wA9u/6sOyqn9PV4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eAV2+tk7obBqelqheTXVsTnH1tFuFQ8bJNis6pvGPqrejlBUfWSC/Pz4B8uLvon6xKb1eQC97aaRZuTivpzVzB6DWes4JYguPiFRs9tVAGStRM6U3hVYrmBxZrp2IAJLsjm1M6ajetA/3k+s67W1YpSlAHFMsp6kd4MKeR9PoBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Fu+9BIpN; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712318310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bNbIAMV3AIIh+finZC0kYCtErDA0HoO+gaZWe4mDURE=; b=Fu+9BIpNpMdOLGNEXn4bn3Gm2YHQrppJwRkjUSRvWEmCcJfAjbel/dUfqphkcXtJqlp/Y+ 6YTHvYV6i3v1QUujUKsqo/+0nglqdlTQf9LXpsqgLozoKJY8T8xSDO6WxKpYvK3p3ocDaI sVRhWp1Pl4gaW+0/w9RJQJNIoaWGz0k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-216-j7EJIyIYM6OGTJqf_yp9KQ-1; Fri, 05 Apr 2024 07:58:23 -0400 X-MC-Unique: j7EJIyIYM6OGTJqf_yp9KQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 584B885CF01; Fri, 5 Apr 2024 11:58:22 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id D080D40C6CB5; Fri, 5 Apr 2024 11:58:20 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Marc Zyngier , 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: [PATCH 4/4] mm: replace set_pte_at_notify() with just set_pte_at() Date: Fri, 5 Apr 2024 07:58:15 -0400 Message-ID: <20240405115815.3226315-5-pbonzini@redhat.com> In-Reply-To: <20240405115815.3226315-1-pbonzini@redhat.com> References: <20240405115815.3226315-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 With the demise of the .change_pte() MMU notifier callback, there is no notification happening in set_pte_at_notify(). It is a synonym of set_pte_at() and can be replaced with it. Signed-off-by: Paolo Bonzini --- include/linux/mmu_notifier.h | 2 -- kernel/events/uprobes.c | 5 ++--- mm/ksm.c | 4 ++-- mm/memory.c | 7 +------ mm/migrate_device.c | 8 ++------ 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 8c72bf651606..d39ebb10caeb 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -657,6 +657,4 @@ static inline void mmu_notifier_synchronize(void) #endif /* CONFIG_MMU_NOTIFIER */ -#define set_pte_at_notify set_pte_at - #endif /* _LINUX_MMU_NOTIFIER_H */ diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index e4834d23e1d1..f4523b95c945 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -18,7 +18,6 @@ #include #include #include /* anon_vma_prepare */ -#include /* set_pte_at_notify */ #include /* folio_free_swap */ #include /* user_enable_single_step */ #include /* notifier mechanism */ @@ -195,8 +194,8 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, flush_cache_page(vma, addr, pte_pfn(ptep_get(pvmw.pte))); ptep_clear_flush(vma, addr, pvmw.pte); if (new_page) - set_pte_at_notify(mm, addr, pvmw.pte, - mk_pte(new_page, vma->vm_page_prot)); + set_pte_at(mm, addr, pvmw.pte, + mk_pte(new_page, vma->vm_page_prot)); folio_remove_rmap_pte(old_folio, old_page, vma); if (!folio_mapped(old_folio)) diff --git a/mm/ksm.c b/mm/ksm.c index 8c001819cf10..108a4d167824 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1345,7 +1345,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page, if (pte_write(entry)) entry = pte_wrprotect(entry); - set_pte_at_notify(mm, pvmw.address, pvmw.pte, entry); + set_pte_at(mm, pvmw.address, pvmw.pte, entry); } *orig_pte = entry; err = 0; @@ -1447,7 +1447,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, * See Documentation/mm/mmu_notifier.rst */ ptep_clear_flush(vma, addr, ptep); - set_pte_at_notify(mm, addr, ptep, newpte); + set_pte_at(mm, addr, ptep, newpte); folio = page_folio(page); folio_remove_rmap_pte(folio, page, vma); diff --git a/mm/memory.c b/mm/memory.c index f2bc6dd15eb8..9a6f4d8aa379 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3327,13 +3327,8 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) ptep_clear_flush(vma, vmf->address, vmf->pte); folio_add_new_anon_rmap(new_folio, vma, vmf->address); folio_add_lru_vma(new_folio, vma); - /* - * We call the notify macro here because, when using secondary - * mmu page tables (such as kvm shadow page tables), we want the - * new page to be mapped directly into the secondary page table. - */ BUG_ON(unshare && pte_write(entry)); - set_pte_at_notify(mm, vmf->address, vmf->pte, entry); + set_pte_at(mm, vmf->address, vmf->pte, entry); update_mmu_cache_range(vmf, vma, vmf->address, vmf->pte, 1); if (old_folio) { /* diff --git a/mm/migrate_device.c b/mm/migrate_device.c index b6c27c76e1a0..66206734b1b9 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -664,13 +664,9 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate, if (flush) { flush_cache_page(vma, addr, pte_pfn(orig_pte)); ptep_clear_flush(vma, addr, ptep); - set_pte_at_notify(mm, addr, ptep, entry); - update_mmu_cache(vma, addr, ptep); - } else { - /* No need to invalidate - it was non-present before */ - set_pte_at(mm, addr, ptep, entry); - update_mmu_cache(vma, addr, ptep); } + set_pte_at(mm, addr, ptep, entry); + update_mmu_cache(vma, addr, ptep); pte_unmap_unlock(ptep, ptl); *src = MIGRATE_PFN_MIGRATE; -- 2.43.0