The patch titled Subject: powerpc/e500: don't pre-check write access on data TLB error has been added to the -mm mm-unstable branch. Its filename is powerpc-e500-dont-pre-check-write-access-on-data-tlb-error.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/powerpc-e500-dont-pre-check-write-access-on-data-tlb-error.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Subject: powerpc/e500: don't pre-check write access on data TLB error Date: Tue, 2 Jul 2024 15:51:30 +0200 Don't pre-check write access on read-only pages on data TLB error. Load the TLB anyway and take a DSI exception when it happens. This avoids reading SPRN_ESR at every data TLB error exception. Link: https://lkml.kernel.org/r/8525518e1657d6032b7e980c1888102828d66950.1719928057.git.christophe.leroy@xxxxxxxxxx Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Jason Gunthorpe <jgg@xxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/powerpc/kernel/head_85xx.S | 15 --------------- 1 file changed, 15 deletions(-) --- a/arch/powerpc/kernel/head_85xx.S~powerpc-e500-dont-pre-check-write-access-on-data-tlb-error +++ a/arch/powerpc/kernel/head_85xx.S @@ -472,27 +472,12 @@ END_BTB_FLUSH_SECTION #endif 4: - /* Mask of required permission bits. Note that while we - * do copy ESR:ST to _PAGE_WRITE position as trying to write - * to an RO page is pretty common, we don't do it with - * _PAGE_DIRTY. We could do it, but it's a fairly rare - * event so I'd rather take the overhead when it happens - * rather than adding an instruction here. We should measure - * whether the whole thing is worth it in the first place - * as we could avoid loading SPRN_ESR completely in the first - * place... - * - * TODO: Is it worth doing that mfspr & rlwimi in the first - * place or can we save a couple of instructions here ? - */ - mfspr r12,SPRN_ESR #ifdef CONFIG_PTE_64BIT li r13,_PAGE_PRESENT|_PAGE_BAP_SR oris r13,r13,_PAGE_ACCESSED@h #else li r13,_PAGE_PRESENT|_PAGE_READ|_PAGE_ACCESSED #endif - rlwimi r13,r12,11,29,29 FIND_PTE andc. r13,r13,r11 /* Check permission */ _ Patches currently in -mm which might be from christophe.leroy@xxxxxxxxxx are mm-define-__pte_leaf_size-to-also-take-a-pmd-entry.patch mm-provide-mm_struct-and-address-to-huge_ptep_get.patch powerpc-mm-remove-_page_psize.patch powerpc-mm-fix-__find_linux_pte-on-32-bits-with-pmd-leaf-entries.patch powerpc-mm-allow-hugepages-without-hugepd.patch powerpc-8xx-fix-size-given-to-set_huge_pte_at.patch powerpc-8xx-rework-support-for-8m-pages-using-contiguous-pte-entries.patch powerpc-8xx-simplify-struct-mmu_psize_def.patch powerpc-e500-remove-enc-and-ind-fields-from-struct-mmu_psize_def.patch powerpc-e500-switch-to-64-bits-pgd-on-85xx-32-bits.patch powerpc-e500-encode-hugepage-size-in-pte-bits.patch powerpc-e500-dont-pre-check-write-access-on-data-tlb-error.patch powerpc-e500-free-r10-for-find_pte.patch powerpc-e500-use-contiguous-pmd-instead-of-hugepd.patch powerpc-64s-use-contiguous-pmd-pud-instead-of-hugepd.patch powerpc-mm-remove-hugepd-leftovers.patch mm-remove-config_arch_has_hugepd.patch