From: Greg Kroah-Hartman Date: Mon, 11 Jul 2016 23:34:08 +0000 (-0700) Subject: 3.14-stable patches X-Git-Tag: v4.6.5~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3092f77c26e59cb10985a8a7bfb00f18e093c7d9;p=thirdparty%2Fkernel%2Fstable-queue.git 3.14-stable patches added patches: arm-8578-1-mm-ensure-pmd_present-only-checks-the-valid-bit.patch ubifs-implement-migratepage.patch --- diff --git a/queue-3.14/arm-8578-1-mm-ensure-pmd_present-only-checks-the-valid-bit.patch b/queue-3.14/arm-8578-1-mm-ensure-pmd_present-only-checks-the-valid-bit.patch new file mode 100644 index 00000000000..7672d6a5640 --- /dev/null +++ b/queue-3.14/arm-8578-1-mm-ensure-pmd_present-only-checks-the-valid-bit.patch @@ -0,0 +1,66 @@ +From 624531886987f0f1b5d01fb598034d039198e090 Mon Sep 17 00:00:00 2001 +From: Will Deacon +Date: Tue, 7 Jun 2016 17:57:54 +0100 +Subject: ARM: 8578/1: mm: ensure pmd_present only checks the valid bit + +From: Will Deacon + +commit 624531886987f0f1b5d01fb598034d039198e090 upstream. + +In a subsequent patch, pmd_mknotpresent will clear the valid bit of the +pmd entry, resulting in a not-present entry from the hardware's +perspective. Unfortunately, pmd_present simply checks for a non-zero pmd +value and will therefore continue to return true even after a +pmd_mknotpresent operation. Since pmd_mknotpresent is only used for +managing huge entries, this is only an issue for the 3-level case. + +This patch fixes the 3-level pmd_present implementation to take into +account the valid bit. For bisectability, the change is made before the +fix to pmd_mknotpresent. + +[catalin.marinas@arm.com: comment update regarding pmd_mknotpresent patch] + +Fixes: 8d9625070073 ("ARM: mm: Transparent huge page support for LPAE systems.") +Cc: Russell King +Cc: Steve Capper +Signed-off-by: Will Deacon +Signed-off-by: Catalin Marinas +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/include/asm/pgtable-2level.h | 1 + + arch/arm/include/asm/pgtable-3level.h | 1 + + arch/arm/include/asm/pgtable.h | 1 - + 3 files changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/arm/include/asm/pgtable-2level.h ++++ b/arch/arm/include/asm/pgtable-2level.h +@@ -163,6 +163,7 @@ static inline pmd_t *pmd_offset(pud_t *p + + #define pmd_large(pmd) (pmd_val(pmd) & 2) + #define pmd_bad(pmd) (pmd_val(pmd) & 2) ++#define pmd_present(pmd) (pmd_val(pmd)) + + #define copy_pmd(pmdpd,pmdps) \ + do { \ +--- a/arch/arm/include/asm/pgtable-3level.h ++++ b/arch/arm/include/asm/pgtable-3level.h +@@ -212,6 +212,7 @@ static inline pmd_t *pmd_offset(pud_t *p + : !!(pmd_val(pmd) & (val))) + #define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val))) + ++#define pmd_present(pmd) (pmd_isset((pmd), L_PMD_SECT_VALID)) + #define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF)) + + #define __HAVE_ARCH_PMD_WRITE +--- a/arch/arm/include/asm/pgtable.h ++++ b/arch/arm/include/asm/pgtable.h +@@ -182,7 +182,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD + #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) + + #define pmd_none(pmd) (!pmd_val(pmd)) +-#define pmd_present(pmd) (pmd_val(pmd)) + + static inline pte_t *pmd_page_vaddr(pmd_t pmd) + { diff --git a/queue-3.14/series b/queue-3.14/series index 2f22973535e..ad9f3e2e8f6 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -19,3 +19,5 @@ kprobes-x86-clear-tf-bit-in-fault-on-single-stepping.patch x86-amd_nb-fix-boot-crash-on-non-amd-systems.patch make-nfs_atomic_open-call-d_drop-on-all-open_context-errors.patch nfs-fix-another-open_downgrade-bug.patch +arm-8578-1-mm-ensure-pmd_present-only-checks-the-valid-bit.patch +ubifs-implement-migratepage.patch diff --git a/queue-3.14/ubifs-implement-migratepage.patch b/queue-3.14/ubifs-implement-migratepage.patch new file mode 100644 index 00000000000..476adadb04d --- /dev/null +++ b/queue-3.14/ubifs-implement-migratepage.patch @@ -0,0 +1,98 @@ +From 4ac1c17b2044a1b4b2fbed74451947e905fc2992 Mon Sep 17 00:00:00 2001 +From: "Kirill A. Shutemov" +Date: Thu, 16 Jun 2016 23:26:15 +0200 +Subject: UBIFS: Implement ->migratepage() + +From: Kirill A. Shutemov + +commit 4ac1c17b2044a1b4b2fbed74451947e905fc2992 upstream. + +During page migrations UBIFS might get confused +and the following assert triggers: +[ 213.480000] UBIFS assert failed in ubifs_set_page_dirty at 1451 (pid 436) +[ 213.490000] CPU: 0 PID: 436 Comm: drm-stress-test Not tainted 4.4.4-00176-geaa802524636-dirty #1008 +[ 213.490000] Hardware name: Allwinner sun4i/sun5i Families +[ 213.490000] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) +[ 213.490000] [] (show_stack) from [] (dump_stack+0x8c/0xa0) +[ 213.490000] [] (dump_stack) from [] (ubifs_set_page_dirty+0x44/0x50) +[ 213.490000] [] (ubifs_set_page_dirty) from [] (try_to_unmap_one+0x10c/0x3a8) +[ 213.490000] [] (try_to_unmap_one) from [] (rmap_walk+0xb4/0x290) +[ 213.490000] [] (rmap_walk) from [] (try_to_unmap+0x64/0x80) +[ 213.490000] [] (try_to_unmap) from [] (migrate_pages+0x328/0x7a0) +[ 213.490000] [] (migrate_pages) from [] (alloc_contig_range+0x168/0x2f4) +[ 213.490000] [] (alloc_contig_range) from [] (cma_alloc+0x170/0x2c0) +[ 213.490000] [] (cma_alloc) from [] (__alloc_from_contiguous+0x38/0xd8) +[ 213.490000] [] (__alloc_from_contiguous) from [] (__dma_alloc+0x23c/0x274) +[ 213.490000] [] (__dma_alloc) from [] (arm_dma_alloc+0x54/0x5c) +[ 213.490000] [] (arm_dma_alloc) from [] (drm_gem_cma_create+0xb8/0xf0) +[ 213.490000] [] (drm_gem_cma_create) from [] (drm_gem_cma_create_with_handle+0x1c/0xe8) +[ 213.490000] [] (drm_gem_cma_create_with_handle) from [] (drm_gem_cma_dumb_create+0x3c/0x48) +[ 213.490000] [] (drm_gem_cma_dumb_create) from [] (drm_ioctl+0x12c/0x444) +[ 213.490000] [] (drm_ioctl) from [] (do_vfs_ioctl+0x3f4/0x614) +[ 213.490000] [] (do_vfs_ioctl) from [] (SyS_ioctl+0x34/0x5c) +[ 213.490000] [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x34) + +UBIFS is using PagePrivate() which can have different meanings across +filesystems. Therefore the generic page migration code cannot handle this +case correctly. +We have to implement our own migration function which basically does a +plain copy but also duplicates the page private flag. +UBIFS is not a block device filesystem and cannot use buffer_migrate_page(). + +Signed-off-by: Kirill A. Shutemov +[rw: Massaged changelog, build fixes, etc...] +Signed-off-by: Richard Weinberger +Acked-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ubifs/file.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/fs/ubifs/file.c ++++ b/fs/ubifs/file.c +@@ -54,6 +54,7 @@ + #include + #include + #include ++#include + + static int read_block(struct inode *inode, void *addr, unsigned int block, + struct ubifs_data_node *dn) +@@ -1423,6 +1424,26 @@ static int ubifs_set_page_dirty(struct p + return ret; + } + ++#ifdef CONFIG_MIGRATION ++static int ubifs_migrate_page(struct address_space *mapping, ++ struct page *newpage, struct page *page, enum migrate_mode mode) ++{ ++ int rc; ++ ++ rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0); ++ if (rc != MIGRATEPAGE_SUCCESS) ++ return rc; ++ ++ if (PagePrivate(page)) { ++ ClearPagePrivate(page); ++ SetPagePrivate(newpage); ++ } ++ ++ migrate_page_copy(newpage, page); ++ return MIGRATEPAGE_SUCCESS; ++} ++#endif ++ + static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) + { + /* +@@ -1559,6 +1580,9 @@ const struct address_space_operations ub + .write_end = ubifs_write_end, + .invalidatepage = ubifs_invalidatepage, + .set_page_dirty = ubifs_set_page_dirty, ++#ifdef CONFIG_MIGRATION ++ .migratepage = ubifs_migrate_page, ++#endif + .releasepage = ubifs_releasepage, + }; +