From patchwork Mon Jul 10 20:43:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13307621 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C922CEB64DA for ; Mon, 10 Jul 2023 20:44:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24D208E0019; Mon, 10 Jul 2023 16:43:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FAB48E0013; Mon, 10 Jul 2023 16:43:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAC7C8E001A; Mon, 10 Jul 2023 16:43:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B377F8E0017 for ; Mon, 10 Jul 2023 16:43:51 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8871D140266 for ; Mon, 10 Jul 2023 20:43:51 +0000 (UTC) X-FDA: 80996878662.18.BB92C06 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id D864B20017 for ; Mon, 10 Jul 2023 20:43:49 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cQSu1fAY; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689021830; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YVryiR3XtoiyFiUlRMFGMnu0rhdwK+sF8PTJzbuMMJE=; b=zrTUnFfZih5o8j9/Ovc+mjMM0tsBVDdtG925Zz2XDLKEuhlVj+9TvFS/AiQcdwPPWMpiKN apFA7n7SknqrGbmXO9yzDcVscXtf7QqrH2vgEtApQaakSfB+H8A8kwkN3YZh99bc0/+2l0 WuKqptZewKGDpH/PX5qgmsRiOw++TGI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cQSu1fAY; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689021830; a=rsa-sha256; cv=none; b=NYgkMY5AaqxpRmihKt605G5FN2wnGLrfSbx+rTSQyRVrOFqP9yo83hKWM/VHwNteVzDfH8 OWHFJRuKEbTZeCLhBS8vQF5+f7a/qyQgH6buB4lsD5URrS7v0g65/Bul0xS6FQ0EsTzr6N 2cU80k1bYiILtifIJLgMegETrl6T5io= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=YVryiR3XtoiyFiUlRMFGMnu0rhdwK+sF8PTJzbuMMJE=; b=cQSu1fAYjR+TiMmvRB+FLhQ9VZ dsKNLEH2eO+40qj1H1+SavyWnV5+amvjA/AhrbeWX/K4/wtT+3j2fFa69/prVbe1UZSyQaBq6jzmB H2+cJXFFy8UHtpl6N4Gch1Ixd0IFCKgOgHptrgwAHYlt6KpxiO1ldUzQP+osBB96120oB0vtwE+i/ oi078x9gLqcljH1xnPXdEDEYPQ9BN5HMqcnU+FGPZlsQZA5HCrT1PEZNqax5MGPGON1xh2zrdXya4 6Q7uEFlqiFvJJJ26lw+kK9j153qORPoU8+H+huhdweYsbKw8Ta5ZKrlR7R7ObA2g9/E/P7+T+bJLA PUYGo1AQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qIxjR-00EuoI-Db; Mon, 10 Jul 2023 20:43:41 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport , Anshuman Khandual Subject: [PATCH v5 03/38] mm: Add generic flush_icache_pages() and documentation Date: Mon, 10 Jul 2023 21:43:04 +0100 Message-Id: <20230710204339.3554919-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230710204339.3554919-1-willy@infradead.org> References: <20230710204339.3554919-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: D864B20017 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: jrzmf3rzm9arsss63cnnzydxx4bm8gos X-HE-Tag: 1689021829-125149 X-HE-Meta: U2FsdGVkX1//Of5NI/DQISJGL/NOwoLYMbK+aWikvvSEje+1/Z+voI+YfDlmq98Xz/u5Vd4OBLLsmo5EI/9/zgIxSDD48LPqT0teVsgZG/rUyiq3cq63LvYbmyyvMWAwVOf/eVGYV+eUySoba1rALOaO9TAMFRCBoPPUz6uPCAZN6Wqd44kKbBrqbjJlAsX701AUYInZ9+ElakP1nohc5MOsUzrqoJJWwNRBBe81p1Mtbgz7a7b+gTZFBbDj1mM+TKlqAXi1WnhYIYj3QXQKBri3f/srcbAZmMoT1tY3km9jTiKvWRtcMlSoHVLv37aQOASFr9c9qlNMSR2da8Tj06Jl8OSr0MNzg2FFm7VaBFD/+jLfpd6+QgsQoQdG+3ijVmCseguFeKHtE6HbqE7SFa98VE7iDN1ZdFhXlAecT/rHJZZpBWJFpfKUitMdYpZaogrJDASW/v9EWhUNJ50s5aXUdD51bmKJlaB/ILUtEYCEXXPYqQZKxh+oAarL3A0EVrIyTyPaGANrxyZyn+rLux4d7AORpER2QND1mg13SGQbGDnx2soJlUBRNxZI/mUn75kQY91xsY3GtUNRmiw2wqQJ9/53V2oO0JLA/JKR/zWdOo+yOs7IuZ5COu/dpspWFfXer+lOOL3Gd+u9Vh3PVyyWsFCIGw+vSRUBmjCl9fzBKxjQGEFVCmywBsu5frFtdmQ7sdMYGbChsjGuTqCctJQpLosk8dvUZq/EIQ3Yqy0O81AfN5FUzuvHyhmTh+l0Vphspfn47iqi9pC4g0cieRNiRf03WTZdt6S7qLEfctxds4hZzu440EYoCDztYQGJzwZVIIoW6pls4vT5rP7hG7FvFddwXEBiYoUnw7ZBRkzhadM1qSX6qyhH6murX+FZeLsKkgYLGqOF8bBWHjMBzKikYZK4IRQwSkNgDYylCrxufnVF+68dtbL/pEC0189rh4ZPHk+/y3Pw4pHClhs cAdZIdT9 E725BjyxZaQf/XbF/ZJi8frOu2jxaR7T8bn5Ov6c3tmbu65OJTuYcKjUgVi9lBlMSrjhGZ9a+BLCrSj6aa59Q9TwbUtBIoi6F2B/3YaRP7b9TJQdQM2QYd3lN/v7npM7UcuC2/pZ7/x8HJyzQdYzpAjEvbnli1VQ/lF04zsFKjqSOnS1teBxWwvEEgEh59LGcSqDEvCuixIe3ES5aMVOXcxkGSf6lB3efcpj8GR6ofkadx6RE5wFinE0zvX0pF6svKjKSVvoVWayyc36PMApcwmdryoF33EIvQjV0HvD2T95jla2aSeQkJTBI4tFZADM12gdRPvBYXmxPabL5z0j2p/rAPToaAIfksmXq X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: flush_icache_page() is deprecated but not yet removed, so add a range version of it. Change the documentation to refer to update_mmu_cache_range() instead of update_mmu_cache(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Mike Rapoport (IBM) Reviewed-by: Anshuman Khandual --- Documentation/core-api/cachetlb.rst | 39 ++++++++++++++++------------- include/asm-generic/cacheflush.h | 5 ++++ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Documentation/core-api/cachetlb.rst b/Documentation/core-api/cachetlb.rst index 5c0552e78c58..b645947954fb 100644 --- a/Documentation/core-api/cachetlb.rst +++ b/Documentation/core-api/cachetlb.rst @@ -88,13 +88,17 @@ changes occur: This is used primarily during fault processing. -5) ``void update_mmu_cache(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep)`` +5) ``void update_mmu_cache_range(struct vm_fault *vmf, + struct vm_area_struct *vma, unsigned long address, pte_t *ptep, + unsigned int nr)`` - At the end of every page fault, this routine is invoked to - tell the architecture specific code that a translation - now exists at virtual address "address" for address space - "vma->vm_mm", in the software page tables. + At the end of every page fault, this routine is invoked to tell + the architecture specific code that translations now exists + in the software page tables for address space "vma->vm_mm" + at virtual address "address" for "nr" consecutive pages. + + This routine is also invoked in various other places which pass + a NULL "vmf". A port may use this information in any way it so chooses. For example, it could use this event to pre-load TLB @@ -306,17 +310,18 @@ maps this page at its virtual address. private". The kernel guarantees that, for pagecache pages, it will clear this bit when such a page first enters the pagecache. - This allows these interfaces to be implemented much more efficiently. - It allows one to "defer" (perhaps indefinitely) the actual flush if - there are currently no user processes mapping this page. See sparc64's - flush_dcache_page and update_mmu_cache implementations for an example - of how to go about doing this. + This allows these interfaces to be implemented much more + efficiently. It allows one to "defer" (perhaps indefinitely) the + actual flush if there are currently no user processes mapping this + page. See sparc64's flush_dcache_page and update_mmu_cache_range + implementations for an example of how to go about doing this. - The idea is, first at flush_dcache_page() time, if page_file_mapping() - returns a mapping, and mapping_mapped on that mapping returns %false, - just mark the architecture private page flag bit. Later, in - update_mmu_cache(), a check is made of this flag bit, and if set the - flush is done and the flag bit is cleared. + The idea is, first at flush_dcache_page() time, if + page_file_mapping() returns a mapping, and mapping_mapped on that + mapping returns %false, just mark the architecture private page + flag bit. Later, in update_mmu_cache_range(), a check is made + of this flag bit, and if set the flush is done and the flag bit + is cleared. .. important:: @@ -369,7 +374,7 @@ maps this page at its virtual address. ``void flush_icache_page(struct vm_area_struct *vma, struct page *page)`` All the functionality of flush_icache_page can be implemented in - flush_dcache_page and update_mmu_cache. In the future, the hope + flush_dcache_page and update_mmu_cache_range. In the future, the hope is to remove this interface completely. The final category of APIs is for I/O to deliberately aliased address diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h index f46258d1a080..09d51a680765 100644 --- a/include/asm-generic/cacheflush.h +++ b/include/asm-generic/cacheflush.h @@ -78,6 +78,11 @@ static inline void flush_icache_range(unsigned long start, unsigned long end) #endif #ifndef flush_icache_page +static inline void flush_icache_pages(struct vm_area_struct *vma, + struct page *page, unsigned int nr) +{ +} + static inline void flush_icache_page(struct vm_area_struct *vma, struct page *page) {