[OpenWrt-Devel] [PATCH] kernel: remove full cache flush in fuse_copy_do() for MIPS

Hauke Mehrtens hauke at hauke-m.de
Sat Apr 2 08:36:10 EDT 2016


This patch was introduced in commit r16412 for the brcm47xx target only
and then moved to generic in commit r32395. It was initially added
because of ticket #5186 and should fix some problems with fuse file
systems and MIPS caches. The commit comment in r32395 says that this a
generic problem in MIPS CPUs, but does not name any specifics about
that. There was a fix added to kernel 2.6.21 in commit commit
7575a49f20 "[MIPS] Implement flush_anon_page()." that should fix this
problem, but that was already available before both commits were done
to OpenWrt.

I just tested fuse with ntfs.3g without this patch on a BCM4704
(BMIPS3300 V0.6) SoC and haven't seen any problems. Someone reported
that removing this patch improves some fuse operations by 5 times on
some modern MIPS cores.
My test was only a simple "dd if=/dev/zero of=/mnt/zero bs=5000" to an
USB stick.

This patch removes the patch to OpenWrt, because I assume that it is
not needed any more. If someone knows more about a better test scenario
or sees problem with removing this patch, please report back.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../patches-3.18/309-mips_fuse_workaround.patch    | 32 ----------------------
 .../patches-4.1/309-mips_fuse_workaround.patch     | 32 ----------------------
 .../patches-4.4/309-mips_fuse_workaround.patch     | 32 ----------------------
 3 files changed, 96 deletions(-)
 delete mode 100644 target/linux/generic/patches-3.18/309-mips_fuse_workaround.patch
 delete mode 100644 target/linux/generic/patches-4.1/309-mips_fuse_workaround.patch
 delete mode 100644 target/linux/generic/patches-4.4/309-mips_fuse_workaround.patch

diff --git a/target/linux/generic/patches-3.18/309-mips_fuse_workaround.patch b/target/linux/generic/patches-3.18/309-mips_fuse_workaround.patch
deleted file mode 100644
index 934b119..0000000
--- a/target/linux/generic/patches-3.18/309-mips_fuse_workaround.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/mips/mm/cache.c
-+++ b/arch/mips/mm/cache.c
-@@ -38,6 +38,7 @@ void (*__flush_cache_vunmap)(void);
- 
- void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
- EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
-+EXPORT_SYMBOL(__flush_cache_all);
- void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
- 
- /* MIPS specific cache operations */
---- a/fs/fuse/dev.c
-+++ b/fs/fuse/dev.c
-@@ -20,6 +20,9 @@
- #include <linux/swap.h>
- #include <linux/splice.h>
- #include <linux/aio.h>
-+#ifdef CONFIG_MIPS
-+#include <asm/cacheflush.h>
-+#endif
- 
- MODULE_ALIAS_MISCDEV(FUSE_MINOR);
- MODULE_ALIAS("devname:fuse");
-@@ -749,6 +752,9 @@ static int fuse_copy_fill(struct fuse_co
- static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
- {
- 	unsigned ncpy = min(*size, cs->len);
-+#ifdef CONFIG_MIPS
-+	__flush_cache_all();
-+#endif
- 	if (val) {
- 		void *pgaddr = kmap_atomic(cs->pg);
- 		void *buf = pgaddr + cs->offset;
diff --git a/target/linux/generic/patches-4.1/309-mips_fuse_workaround.patch b/target/linux/generic/patches-4.1/309-mips_fuse_workaround.patch
deleted file mode 100644
index 7a3aa34..0000000
--- a/target/linux/generic/patches-4.1/309-mips_fuse_workaround.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/mips/mm/cache.c
-+++ b/arch/mips/mm/cache.c
-@@ -38,6 +38,7 @@ void (*__flush_cache_vunmap)(void);
- 
- void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
- EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
-+EXPORT_SYMBOL(__flush_cache_all);
- void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
- 
- /* MIPS specific cache operations */
---- a/fs/fuse/dev.c
-+++ b/fs/fuse/dev.c
-@@ -19,6 +19,9 @@
- #include <linux/pipe_fs_i.h>
- #include <linux/swap.h>
- #include <linux/splice.h>
-+#ifdef CONFIG_MIPS
-+#include <asm/cacheflush.h>
-+#endif
- 
- MODULE_ALIAS_MISCDEV(FUSE_MINOR);
- MODULE_ALIAS("devname:fuse");
-@@ -816,6 +819,9 @@ static int fuse_copy_fill(struct fuse_co
- static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
- {
- 	unsigned ncpy = min(*size, cs->len);
-+#ifdef CONFIG_MIPS
-+	__flush_cache_all();
-+#endif
- 	if (val) {
- 		void *pgaddr = kmap_atomic(cs->pg);
- 		void *buf = pgaddr + cs->offset;
diff --git a/target/linux/generic/patches-4.4/309-mips_fuse_workaround.patch b/target/linux/generic/patches-4.4/309-mips_fuse_workaround.patch
deleted file mode 100644
index 14d7962..0000000
--- a/target/linux/generic/patches-4.4/309-mips_fuse_workaround.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/mips/mm/cache.c
-+++ b/arch/mips/mm/cache.c
-@@ -39,6 +39,7 @@ void (*__flush_cache_vunmap)(void);
- 
- void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
- EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
-+EXPORT_SYMBOL(__flush_cache_all);
- void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size);
- 
- /* MIPS specific cache operations */
---- a/fs/fuse/dev.c
-+++ b/fs/fuse/dev.c
-@@ -19,6 +19,9 @@
- #include <linux/pipe_fs_i.h>
- #include <linux/swap.h>
- #include <linux/splice.h>
-+#ifdef CONFIG_MIPS
-+#include <asm/cacheflush.h>
-+#endif
- 
- MODULE_ALIAS_MISCDEV(FUSE_MINOR);
- MODULE_ALIAS("devname:fuse");
-@@ -802,6 +805,9 @@ static int fuse_copy_fill(struct fuse_co
- static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
- {
- 	unsigned ncpy = min(*size, cs->len);
-+#ifdef CONFIG_MIPS
-+	__flush_cache_all();
-+#endif
- 	if (val) {
- 		void *pgaddr = kmap_atomic(cs->pg);
- 		void *buf = pgaddr + cs->offset;
-- 
2.8.0.rc3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list