From mboxrd@z Thu Jan 1 00:00:00 1970 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 A4166C76196 for ; Wed, 15 Mar 2023 05:15:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 073188E001E; Wed, 15 Mar 2023 01:15:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F13E08E001D; Wed, 15 Mar 2023 01:15:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D68EA8E001E; Wed, 15 Mar 2023 01:15:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A6A3C8E001D for ; Wed, 15 Mar 2023 01:15:04 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 810D51C69C0 for ; Wed, 15 Mar 2023 05:15:04 +0000 (UTC) X-FDA: 80569968528.22.1C9853B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id C21A0100004 for ; Wed, 15 Mar 2023 05:15:02 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kMtfC4Y8; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678857303; 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=Y6UQRtApFRekBXOS3Hoo+JaDt5MuymsqP/Dtb80Hd68=; b=AI2u8UqCMJmidqQdzv6re+7T4MpFOE74lQTI8GDVzdyg5x+nq7t+md1W489wlXUvLpTOw+ fQMl0lGSzsMTTn/SJ5Fd+KQPow802bNRSEP+PKQs5RDw5acNumwPrqD0+WQtbLFRx7LgnF rHkgLGWmiU04i6WF6PaJddaT6ZIJ1EQ= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kMtfC4Y8; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678857303; a=rsa-sha256; cv=none; b=4McIXCHNsefZd/0vw+4Arpm4SoTnzYlIxe6YZJyo37ECXKIV9235QfLulj+8hqn6vpyfpl 3kBsYhK/sMs0CTpvxSJJur1mLXs6WK5kHr6g/5HEetMcCL8zDW11U3e2IIOg2H/uMSkl+8 iRguuLLIvu+GzboOm4SrvZftMbL1how= 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=Y6UQRtApFRekBXOS3Hoo+JaDt5MuymsqP/Dtb80Hd68=; b=kMtfC4Y8cRwzxnyikLnmC+pXrF S08XyEXWi259m5wWZQqlD79SBIbUYDxcBLuSL86NVAnvtg4xXfUpltnS44mI+15iJXI9fg69EAtlg MFIUlzW9PHr3U1aoRU6P/B6aSLfq4i/oLgpIFnUfxfZ6d5qRVlFsATQUZdfABblJUxj02K64BvXpu nOhhgag7XC2+IC+wmMtRq5j7b59hvdYcelXnmrIYdRsXeq+SOSx6p7FPuyxFeXcRHgv5D5Bms1+Ni voGyM7rAG7rdO/7aF//y2RXEjckrpOfLiBlAJ7ioUYzG0feEklpTZUSI/jBHX5Pog4JA0O1BxkSV8 Xm1kdeqA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pcJTK-00DYAt-IK; Wed, 15 Mar 2023 05:14:46 +0000 From: "Matthew Wilcox (Oracle)" To: linux-arch@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 02/36] mm: Add generic flush_icache_pages() and documentation Date: Wed, 15 Mar 2023 05:14:10 +0000 Message-Id: <20230315051444.3229621-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230315051444.3229621-1-willy@infradead.org> References: <20230315051444.3229621-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C21A0100004 X-Rspam-User: X-Stat-Signature: 71rzs4cf83c14atfxpptk9c6u9hgeaxk X-HE-Tag: 1678857302-680683 X-HE-Meta: U2FsdGVkX1993cmwNZJZGQ26k82OGNN+ojUCU1BvXP1dyFBuAIQmrhTimlWlJ3hWK7d6DOVintGFq1rE/mPnwv+J2ELZfTpm8J431bGjqajJg7YamrFUNtQRz3dNt6ET6VzNdHNQKTMGRTMiMSykyA/JyktCMEWAOMLO1hu469q1n1mw0zc5l8p2MwBnbBMFW4BRCA1rRNu60ElutVvYSDeIPjyfydBEP98DV8uWjt9Vf9+AOOUp9XsMkO3WPa2+NRwFmsKEVjbDVGMkx46jrZHanuXbviC0vmTOahcFHFyiVzUdyopldb9uiuPPaXNKy9z4x8brKbX9f05Q/if8MAypBVs5O+tssSYwa/xZh8Ls3lYjLcwAWDHOXIl9t4Im7WL1cmaXB+7dhhS+uoZ0hlaFN4czqpqP35eFgxxP0r+ReBdnIWZA4zOgk10IpD2uBE+HrelobfJMkYblb7wPO3nBUwmkt3vMtMe0H9u2HtwHL3PZ8Mt7lcYMGD0hlL7q1AKT5ZkYgk7LDCDS37js3oL/g3Z9Ut+VCNOy3XlKkqr0HR5mKvrsHFfiGEBdyUxQVmWUHTwzIHhM3RPJmDHZ0zXuqPo9N5UP+IndIwpUFnlQI48iKcHB36OsEbMZeiT+sEwos5JXaw84fUoFabLaBijNZByTxVECYPqCx5678OR65BSFks8Xe0gyVBqIIo8YwS0N89C8tUpueoAiEthclJq6Gc2O6CKDSOZ7qhhoOv62c583QEatZK3jHqdE9fcTT0Un0gi3vbzEEjt4yty5yQSPiM4NulRtxpLszExmNFPq8JCyBwlF/hoA9SeffFmlUlQ+grKdJqjordIkgzaWrljfbJuYGxn+pdFIJfsHkokEUHjXO5h9/qp9e2bQbNQe5itd/HYBvyfppdU7VuizbuKSPLxj1Z54agGneR1q5gBhfEVP2h0Hhm+ZJKElxWoP96r3LvrjKGJkZYpjEHr m2RVXJIC cAKWfCeam61SahjGaNaJgTcszjvZF6iS9UIM+WT2V92XcOCX3i4P+dDgibdoXol0ECV52OKEmhlZ4T1tPvSCV9qlRqWQ7oYXADds7BlkkduSnu26fPFj0op6MMI3XH8/Dxi447Bf9O0qZUL5AK6sVIFNK/7S6si/os321af5n1+/TQiNNHYYA3uev+lXVAfUG/xS3+endO8WpAzCPofMi27Hv/tpVEXR7pRYEw+1i4WbQQejDsT1iJ95T4w== 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) --- Documentation/core-api/cachetlb.rst | 35 +++++++++++++++-------------- include/asm-generic/cacheflush.h | 5 +++++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Documentation/core-api/cachetlb.rst b/Documentation/core-api/cachetlb.rst index 5c0552e78c58..d4c9e2a28d36 100644 --- a/Documentation/core-api/cachetlb.rst +++ b/Documentation/core-api/cachetlb.rst @@ -88,13 +88,13 @@ 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_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. 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 +306,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 +370,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) { -- 2.39.2