This is a note to let you know that I've just added the patch titled Revert "MIPS: Remove race window in page fault handling" to the 4.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-mips-remove-race-window-in-page-fault-handling.patch and it can be found in the queue-4.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ralf@xxxxxxxxxxxxxx Fri May 8 16:24:33 2015 From: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Date: Thu, 26 Feb 2015 14:16:02 +0100 Subject: Revert "MIPS: Remove race window in page fault handling" To: stable@xxxxxxxxxxxxxxx Message-ID: <dd9d42c457f61da9fc4224b06cccb584f290c17b.1431087908.git.ralf@xxxxxxxxxxxxxx> From: Lars Persson <lars.persson@xxxxxxxx> Commit 5b9593f3bccb9904f260f9ad7f184e1d2921bd1e upstream. Revert commit 2a4a8b1e5d9d ("MIPS: Remove race window in page fault handling") because it increased the number of flushed dcache pages and became a performance problem for some workloads. Signed-off-by: Lars Persson <larper@xxxxxxxx> Cc: linux-mips@xxxxxxxxxxxxxx Cc: paul.burton@xxxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx Patchwork: https://patchwork.linux-mips.org/patch/9345/ Signed-off-by: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/mips/include/asm/pgtable.h | 9 +++++---- arch/mips/mm/cache.c | 27 ++++++++------------------- 2 files changed, 13 insertions(+), 23 deletions(-) --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -127,10 +127,6 @@ do { \ } \ } while(0) - -extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, - pte_t pteval); - #if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) #define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) @@ -154,6 +150,7 @@ static inline void set_pte(pte_t *ptep, } } } +#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { @@ -192,6 +189,7 @@ static inline void set_pte(pte_t *ptep, } #endif } +#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { @@ -407,12 +405,15 @@ static inline pte_t pte_modify(pte_t pte extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte); +extern void __update_cache(struct vm_area_struct *vma, unsigned long address, + pte_t pte); static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { pte_t pte = *ptep; __update_tlb(vma, address, pte); + __update_cache(vma, address, pte); } static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c @@ -119,36 +119,25 @@ void __flush_anon_page(struct page *page EXPORT_SYMBOL(__flush_anon_page); -static void mips_flush_dcache_from_pte(pte_t pteval, unsigned long address) +void __update_cache(struct vm_area_struct *vma, unsigned long address, + pte_t pte) { struct page *page; - unsigned long pfn = pte_pfn(pteval); + unsigned long pfn, addr; + int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc; + pfn = pte_pfn(pte); if (unlikely(!pfn_valid(pfn))) return; - page = pfn_to_page(pfn); if (page_mapping(page) && Page_dcache_dirty(page)) { - unsigned long page_addr = (unsigned long) page_address(page); - - if (!cpu_has_ic_fills_f_dc || - pages_do_alias(page_addr, address & PAGE_MASK)) - flush_data_cache_page(page_addr); + addr = (unsigned long) page_address(page); + if (exec || pages_do_alias(addr, address & PAGE_MASK)) + flush_data_cache_page(addr); ClearPageDcacheDirty(page); } } -void set_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pteval) -{ - if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) { - if (pte_present(pteval)) - mips_flush_dcache_from_pte(pteval, addr); - } - - set_pte(ptep, pteval); -} - unsigned long _page_cachable_default; EXPORT_SYMBOL(_page_cachable_default); Patches currently in stable-queue which might be from ralf@xxxxxxxxxxxxxx are queue-4.0/mips-octeon-remove-udelay-causing-huge-irq-latency.patch queue-4.0/mips-makefile-fix-mips-ase-detection-code.patch queue-4.0/mips-r4kcache-use-correct-base-register-for-mips-r6-cache-flushes.patch queue-4.0/mips-fix-cpu_has_mips_r2_exec_hazard.patch queue-4.0/mips-ralink-fix-bad-config-symbol-in-pci-makefile.patch queue-4.0/revert-mips-remove-race-window-in-page-fault-handling.patch queue-4.0/mips-fix-race-condition-in-lazy-cache-flushing.patch queue-4.0/mips-bcm63xx-move-bcm63xx_gpio_init-to-bcm63xx_register_devices.patch queue-4.0/mips-octeon-delete-override-of-cpu_has_mips_r2_exec_hazard.patch queue-4.0/mips-asm-spinlock-fix-addiu-instruction-for-r10000_llsc_war-case.patch queue-4.0/mips-kconfig-disable-smp-cps-for-64-bit.patch queue-4.0/mips-bcm47xx-fix-detecting-microsoft-mn-700-asus-wl500g.patch queue-4.0/mips-octeon-use-correct-csr-to-soft-reset.patch queue-4.0/revert-mips-avoid-pipeline-stalls-on-some-mips32r2-cores.patch queue-4.0/mips-octeon-dma-octeon-fix-ohci-usb-config-check.patch queue-4.0/mips-octeon-fix-pci-interrupt-mapping-for-d-link-dsr-1000n.patch queue-4.0/mips-kconfig-fix-typo-for-the-r2-to-r6-emulator-kernel-parameter.patch queue-4.0/ssb-fix-kconfig-dependencies.patch queue-4.0/mips-kernel-entry.s-set-correct-isa-level-for-mips_ihb.patch queue-4.0/mips-netlogic-fix-for-sata-phy-init.patch queue-4.0/mips-ralink-add-missing-symbol-for-ralink_ill_acc.patch queue-4.0/mips-asm-elf-set-o32-default-fpu-flags.patch queue-4.0/mips-smp-cps-cpu_set-fpu-mask-if-fpu-present.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html