linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: "Darrick J . Wong " <djwong@kernel.org>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v2 01/28] csky,sparc: Declare flush_dcache_folio()
Date: Tue, 16 Nov 2021 21:49:13 +0000	[thread overview]
Message-ID: <YZQnWU9ABBlXJKa5@casper.infradead.org> (raw)
In-Reply-To: <YZNQnd887/TcPH7H@infradead.org>

On Mon, Nov 15, 2021 at 10:33:01PM -0800, Christoph Hellwig wrote:
> I see how this works no, but it is pretty horrible.  Why not something
> simple like the patch below?  If/when an architecture actually
> wants to override flush_dcache_folio we can find out how to best do
> it:

I'll stick this one into -next and see if anything blows up:

From 14f55de74c68a3eb058cfdbf81414148b9bdaac7 Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Date: Sat, 6 Nov 2021 17:13:35 -0400
Subject: [PATCH] Add linux/cacheflush.h

Many architectures do not include asm-generic/cacheflush.h, so turn
the includes on their head and add linux/cacheflush.h which includes
asm/cacheflush.h.

Move the flush_dcache_folio() declaration from asm-generic/cacheflush.h
to linux/cacheflush.h and change linux/highmem.h to include
linux/cacheflush.h instead of asm/cacheflush.h so that all necessary
places will see flush_dcache_folio().

More functions should have their default implementations moved in the
future, but those are for follow-on patches.  This fixes csky, sparc and
sparc64 which were missed in the commit which added flush_dcache_folio().

Fixes: 08b0b0059bf1 ("mm: Add flush_dcache_folio()")
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 arch/arc/include/asm/cacheflush.h     |  1 -
 arch/arm/include/asm/cacheflush.h     |  1 -
 arch/m68k/include/asm/cacheflush_mm.h |  1 -
 arch/mips/include/asm/cacheflush.h    |  2 --
 arch/nds32/include/asm/cacheflush.h   |  1 -
 arch/nios2/include/asm/cacheflush.h   |  1 -
 arch/parisc/include/asm/cacheflush.h  |  1 -
 arch/sh/include/asm/cacheflush.h      |  1 -
 arch/xtensa/include/asm/cacheflush.h  |  3 ---
 include/asm-generic/cacheflush.h      |  6 ------
 include/linux/cacheflush.h            | 18 ++++++++++++++++++
 include/linux/highmem.h               |  3 +--
 12 files changed, 19 insertions(+), 20 deletions(-)
 create mode 100644 include/linux/cacheflush.h

diff --git a/arch/arc/include/asm/cacheflush.h b/arch/arc/include/asm/cacheflush.h
index e8c2c7469e10..e201b4b1655a 100644
--- a/arch/arc/include/asm/cacheflush.h
+++ b/arch/arc/include/asm/cacheflush.h
@@ -36,7 +36,6 @@ void __flush_dcache_page(phys_addr_t paddr, unsigned long vaddr);
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 
 void flush_dcache_page(struct page *page);
-void flush_dcache_folio(struct folio *folio);
 
 void dma_cache_wback_inv(phys_addr_t start, unsigned long sz);
 void dma_cache_inv(phys_addr_t start, unsigned long sz);
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index e68fb879e4f9..5e56288e343b 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -290,7 +290,6 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr
  */
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 extern void flush_dcache_page(struct page *);
-void flush_dcache_folio(struct folio *folio);
 
 #define ARCH_IMPLEMENTS_FLUSH_KERNEL_VMAP_RANGE 1
 static inline void flush_kernel_vmap_range(void *addr, int size)
diff --git a/arch/m68k/include/asm/cacheflush_mm.h b/arch/m68k/include/asm/cacheflush_mm.h
index 8ab46625ddd3..1ac55e7b47f0 100644
--- a/arch/m68k/include/asm/cacheflush_mm.h
+++ b/arch/m68k/include/asm/cacheflush_mm.h
@@ -250,7 +250,6 @@ static inline void __flush_page_to_ram(void *vaddr)
 
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 #define flush_dcache_page(page)		__flush_page_to_ram(page_address(page))
-void flush_dcache_folio(struct folio *folio);
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_page(vma, page)	__flush_page_to_ram(page_address(page))
diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h
index f207388541d5..b3dc9c589442 100644
--- a/arch/mips/include/asm/cacheflush.h
+++ b/arch/mips/include/asm/cacheflush.h
@@ -61,8 +61,6 @@ static inline void flush_dcache_page(struct page *page)
 		SetPageDcacheDirty(page);
 }
 
-void flush_dcache_folio(struct folio *folio);
-
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 
diff --git a/arch/nds32/include/asm/cacheflush.h b/arch/nds32/include/asm/cacheflush.h
index 3fc0bb7d6487..c2a222ebfa2a 100644
--- a/arch/nds32/include/asm/cacheflush.h
+++ b/arch/nds32/include/asm/cacheflush.h
@@ -27,7 +27,6 @@ void flush_cache_vunmap(unsigned long start, unsigned long end);
 
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 void flush_dcache_page(struct page *page);
-void flush_dcache_folio(struct folio *folio);
 void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
 		       unsigned long vaddr, void *dst, void *src, int len);
 void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
diff --git a/arch/nios2/include/asm/cacheflush.h b/arch/nios2/include/asm/cacheflush.h
index 1999561b22aa..d0b71dd71287 100644
--- a/arch/nios2/include/asm/cacheflush.h
+++ b/arch/nios2/include/asm/cacheflush.h
@@ -29,7 +29,6 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
 	unsigned long pfn);
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 void flush_dcache_page(struct page *page);
-void flush_dcache_folio(struct folio *folio);
 
 extern void flush_icache_range(unsigned long start, unsigned long end);
 extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index da0cd4b3a28f..859b8a34adcf 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -50,7 +50,6 @@ void invalidate_kernel_vmap_range(void *vaddr, int size);
 
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 void flush_dcache_page(struct page *page);
-void flush_dcache_folio(struct folio *folio);
 
 #define flush_dcache_mmap_lock(mapping)		xa_lock_irq(&mapping->i_pages)
 #define flush_dcache_mmap_unlock(mapping)	xa_unlock_irq(&mapping->i_pages)
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index c7a97f32432f..481a664287e2 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -43,7 +43,6 @@ extern void flush_cache_range(struct vm_area_struct *vma,
 				 unsigned long start, unsigned long end);
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 void flush_dcache_page(struct page *page);
-void flush_dcache_folio(struct folio *folio);
 extern void flush_icache_range(unsigned long start, unsigned long end);
 #define flush_icache_user_range flush_icache_range
 extern void flush_icache_page(struct vm_area_struct *vma,
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index a8a041609c5d..7b4359312c25 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -121,7 +121,6 @@ void flush_cache_page(struct vm_area_struct*,
 
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 void flush_dcache_page(struct page *);
-void flush_dcache_folio(struct folio *);
 
 void local_flush_cache_range(struct vm_area_struct *vma,
 		unsigned long start, unsigned long end);
@@ -138,9 +137,7 @@ void local_flush_cache_page(struct vm_area_struct *vma,
 #define flush_cache_vunmap(start,end)			do { } while (0)
 
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
-#define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO
 #define flush_dcache_page(page)				do { } while (0)
-static inline void flush_dcache_folio(struct folio *folio) { }
 
 #define flush_icache_range local_flush_icache_range
 #define flush_cache_page(vma, addr, pfn)		do { } while (0)
diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h
index fedc0dfa4877..4f07afacbc23 100644
--- a/include/asm-generic/cacheflush.h
+++ b/include/asm-generic/cacheflush.h
@@ -50,13 +50,7 @@ static inline void flush_dcache_page(struct page *page)
 {
 }
 
-static inline void flush_dcache_folio(struct folio *folio) { }
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
-#define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO
-#endif
-
-#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO
-void flush_dcache_folio(struct folio *folio);
 #endif
 
 #ifndef flush_dcache_mmap_lock
diff --git a/include/linux/cacheflush.h b/include/linux/cacheflush.h
new file mode 100644
index 000000000000..fef8b607f97e
--- /dev/null
+++ b/include/linux/cacheflush.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_CACHEFLUSH_H
+#define _LINUX_CACHEFLUSH_H
+
+#include <asm/cacheflush.h>
+
+#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
+#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO
+void flush_dcache_folio(struct folio *folio);
+#endif
+#else
+static inline void flush_dcache_folio(struct folio *folio)
+{
+}
+#define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO 0
+#endif /* ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE */
+
+#endif /* _LINUX_CACHEFLUSH_H */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 25aff0f2ed0b..c944b3b70ee7 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -5,12 +5,11 @@
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/bug.h>
+#include <linux/cacheflush.h>
 #include <linux/mm.h>
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 
-#include <asm/cacheflush.h>
-
 #include "highmem-internal.h"
 
 /**
-- 
2.33.0


  reply	other threads:[~2021-11-16 21:49 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08  4:05 [PATCH v2 00/28] iomap/xfs folio patches Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 01/28] csky,sparc: Declare flush_dcache_folio() Matthew Wilcox (Oracle)
2021-11-09  8:36   ` Christoph Hellwig
2021-11-15 15:54     ` Matthew Wilcox
2021-11-16  6:33       ` Christoph Hellwig
2021-11-16 21:49         ` Matthew Wilcox [this message]
2021-11-17  9:52           ` Geert Uytterhoeven
2021-11-08  4:05 ` [PATCH v2 02/28] mm: Add functions to zero portions of a folio Matthew Wilcox (Oracle)
2021-11-09  8:40   ` Christoph Hellwig
2021-11-17  4:45   ` Darrick J. Wong
2021-11-17 14:07     ` Matthew Wilcox
2021-11-17 17:07       ` Darrick J. Wong
2021-11-18 15:55         ` Matthew Wilcox
2021-11-18 17:26           ` Darrick J. Wong
2021-11-18 20:08             ` Matthew Wilcox
2021-11-08  4:05 ` [PATCH v2 03/28] fs: Remove FS_THP_SUPPORT Matthew Wilcox (Oracle)
2021-11-17  4:36   ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 04/28] fs: Rename AS_THP_SUPPORT and mapping_thp_support Matthew Wilcox (Oracle)
2021-11-09  8:41   ` Christoph Hellwig
2021-11-15 16:03     ` Matthew Wilcox
2021-11-16  6:33       ` Christoph Hellwig
2021-11-08  4:05 ` [PATCH v2 05/28] block: Add bio_add_folio() Matthew Wilcox (Oracle)
2021-11-17  4:48   ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 06/28] block: Add bio_for_each_folio_all() Matthew Wilcox (Oracle)
2021-11-17  4:48   ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 07/28] fs/buffer: Convert __block_write_begin_int() to take a folio Matthew Wilcox (Oracle)
2021-11-09  8:42   ` Christoph Hellwig
2021-11-17  4:35   ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 08/28] iomap: Convert to_iomap_page " Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 09/28] iomap: Convert iomap_page_create " Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 10/28] iomap: Convert iomap_page_release " Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 11/28] iomap: Convert iomap_releasepage to use " Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 12/28] iomap: Add iomap_invalidate_folio Matthew Wilcox (Oracle)
2021-11-17  2:20   ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 13/28] iomap: Pass the iomap_page into iomap_set_range_uptodate Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 14/28] iomap: Convert bio completions to use folios Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 15/28] iomap: Use folio offsets instead of page offsets Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 16/28] iomap: Convert iomap_read_inline_data to take a folio Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 17/28] iomap: Convert readahead and readpage to use " Matthew Wilcox (Oracle)
2021-11-09  8:43   ` Christoph Hellwig
2021-11-08  4:05 ` [PATCH v2 18/28] iomap: Convert iomap_page_mkwrite " Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 19/28] iomap: Convert __iomap_zero_iter " Matthew Wilcox (Oracle)
2021-11-09  8:47   ` Christoph Hellwig
2021-11-17  2:24   ` Darrick J. Wong
2021-11-17 14:20     ` Matthew Wilcox
2021-12-09 21:38   ` Matthew Wilcox
2021-12-10 16:19     ` Matthew Wilcox
2021-12-13  7:34       ` Christoph Hellwig
2021-12-13 18:08         ` Matthew Wilcox
2021-12-16 19:36     ` Darrick J. Wong
2021-12-16 20:43       ` Matthew Wilcox
2021-11-08  4:05 ` [PATCH v2 20/28] iomap: Convert iomap_write_begin() and iomap_write_end() to folios Matthew Wilcox (Oracle)
2021-11-17  4:31   ` Darrick J. Wong
2021-11-17 14:31     ` Matthew Wilcox
2021-11-17 17:10       ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 21/28] iomap: Convert iomap_write_end_inline to take a folio Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 22/28] iomap,xfs: Convert ->discard_page to ->discard_folio Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 23/28] iomap: Simplify iomap_writepage_map() Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 24/28] iomap: Simplify iomap_do_writepage() Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 25/28] iomap: Convert iomap_add_to_ioend() to take a folio Matthew Wilcox (Oracle)
2021-11-17  4:34   ` Darrick J. Wong
2021-11-08  4:05 ` [PATCH v2 26/28] iomap: Convert iomap_migrate_page() to use folios Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 27/28] iomap: Support multi-page folios in invalidatepage Matthew Wilcox (Oracle)
2021-11-08  4:05 ` [PATCH v2 28/28] xfs: Support multi-page folios Matthew Wilcox (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZQnWU9ABBlXJKa5@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).