Message ID | 297f30d8ba75cb0e9ebe0a776d96c19750105570.1550745320.git.christophe.leroy@c-s.fr (mailing list archive) |
---|---|
State | Accepted |
Commit | 93c4a162b014d238a287f8264adb25c009c79e61 |
Headers | show |
Series | Optimise TLB miss handlers on 6xx (603/e300) | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | next/apply_patch Successfully applied |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 101 lines checked |
Hi, On Thu, Feb 21, 2019 at 10:37:55AM +0000, Christophe Leroy wrote: > Use SPRN_SPRG2 to store the current thread PGDIR and > avoid reading thread_struct.pgdir at every TLB miss. > This patch causes a number of silent (no crash) qemu boot stalls in -next. See https://kerneltests.org/builders/qemu-ppc-next/builds/1080/steps/qemubuildcommand/logs/stdio for an example. Unfortunately, it is not possible to revert the patch due to subsequent patches, so I was unable to test a revert. Bisect log is attached. Guenter --- # bad: [cf08baa29613dd899954089e7cc7dba1d478b365] Add linux-next specific files for 20190306 # good: [1c163f4c7b3f621efff9b28a47abb36f7378d783] Linux 5.0 git bisect start 'HEAD' 'v5.0' # bad: [6cc8f3499ec8d31904ab9083980a91736512cb37] Merge remote-tracking branch 'vfs/for-next' git bisect bad 6cc8f3499ec8d31904ab9083980a91736512cb37 # good: [63bdf4284c38a48af21745ceb148a087b190cd21] Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 git bisect good 63bdf4284c38a48af21745ceb148a087b190cd21 # good: [520b5fc601ab760fee7ea0c403b42d04e8ebfd93] Merge remote-tracking branch 'arm-soc/for-next' git bisect good 520b5fc601ab760fee7ea0c403b42d04e8ebfd93 # bad: [d7f54e4e0d4e90f5df78da8d6a830bafad3b535a] Merge remote-tracking branch 'xtensa/xtensa-for-next' git bisect bad d7f54e4e0d4e90f5df78da8d6a830bafad3b535a # good: [0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f] Merge remote-tracking branch 'clk/clk-next' git bisect good 0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f # bad: [fb0b0a73b223fc113e961b1d921322844e9c30d9] powerpc: Enable kcov git bisect bad fb0b0a73b223fc113e961b1d921322844e9c30d9 # good: [d0055df0c9c1471c389197a69f43e300185a75aa] Merge branch 'topic/dma' into next git bisect good d0055df0c9c1471c389197a69f43e300185a75aa # good: [0df977eafc792a5365a7f81d8d5920132e03afad] powerpc/6xx: Don't use SPRN_SPRG2 for storing stack pointer while in RTAS git bisect good 0df977eafc792a5365a7f81d8d5920132e03afad # bad: [665bed2386e5dc29844ad78c7ef1464664b103ec] powerpc/8xx: replace most #ifdef by IS_ENABLED() in 8xx_mmu.c git bisect bad 665bed2386e5dc29844ad78c7ef1464664b103ec # bad: [78ca1108b10927b3d068c8da91352b0f4cd01fc5] powerpc/book3s32: Reorder _PAGE_XXX flags to simplify TLB handling git bisect bad 78ca1108b10927b3d068c8da91352b0f4cd01fc5 # bad: [a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee] powerpc/603: Don't handle kernel page TLB misses when not need git bisect bad a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee # bad: [2c12393f577396a51b7e0537bd3eb29dcc26dc1b] powerpc/603: use physical address directly in TLB miss handlers. git bisect bad 2c12393f577396a51b7e0537bd3eb29dcc26dc1b # bad: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG git bisect bad 93c4a162b014d238a287f8264adb25c009c79e61 # first bad commit: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG
Hi, On 03/07/2019 02:11 PM, Guenter Roeck wrote: > Hi, > > On Thu, Feb 21, 2019 at 10:37:55AM +0000, Christophe Leroy wrote: >> Use SPRN_SPRG2 to store the current thread PGDIR and >> avoid reading thread_struct.pgdir at every TLB miss. >> > This patch causes a number of silent (no crash) qemu boot stalls > in -next. See > https://kerneltests.org/builders/qemu-ppc-next/builds/1080/steps/qemubuildcommand/logs/stdio > for an example. Oops. Could you try the fix below ? diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S index 6f1c11e0691f..7534ecff5e92 100644 --- a/arch/powerpc/kernel/cpu_setup_6xx.S +++ b/arch/powerpc/kernel/cpu_setup_6xx.S @@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION li r10,0 mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU) - lis r10, (swapper_pg_dir - PAGE_OFFSET)@h - ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l - mtspr SPRN_SPRG_PGDIR, r10 BEGIN_FTR_SECTION bl __init_fpu_registers diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index ce6a972f2584..48051c8977c5 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S @@ -855,6 +855,9 @@ __secondary_start: li r3,0 stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ #endif + lis r4, (swapper_pg_dir - PAGE_OFFSET)@h + ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l + mtspr SPRN_SPRG_PGDIR, r4 /* enable MMU and jump to start_secondary */ li r4,MSR_KERNEL @@ -942,6 +945,9 @@ start_here: li r3,0 stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ #endif + lis r4, (swapper_pg_dir - PAGE_OFFSET)@h + ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l + mtspr SPRN_SPRG_PGDIR, r4 /* stack */ lis r1,init_thread_union@ha diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S index 1f13494efb2b..587e4550d83e 100644 --- a/arch/powerpc/mm/hash_low_32.S +++ b/arch/powerpc/mm/hash_low_32.S @@ -70,12 +70,12 @@ _GLOBAL(hash_page) lis r0,KERNELBASE@h /* check if kernel address */ cmplw 0,r4,r0 ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ - mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */ + mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */ blt+ 112f /* assume user more likely */ - lis r5,swapper_pg_dir@ha /* if kernel address, use */ - addi r5,r5,swapper_pg_dir@l /* kernel page table */ + lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ + addi r5 ,r5 , (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ -112: tophys(r5, r5) +112: #ifndef CONFIG_PTE_64BIT rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */ lwz r8,0(r5) /* get pmd entry */ Thanks Christophe > > Unfortunately, it is not possible to revert the patch due to subsequent > patches, so I was unable to test a revert. > > Bisect log is attached. > > Guenter > > --- > # bad: [cf08baa29613dd899954089e7cc7dba1d478b365] Add linux-next specific files for 20190306 > # good: [1c163f4c7b3f621efff9b28a47abb36f7378d783] Linux 5.0 > git bisect start 'HEAD' 'v5.0' > # bad: [6cc8f3499ec8d31904ab9083980a91736512cb37] Merge remote-tracking branch 'vfs/for-next' > git bisect bad 6cc8f3499ec8d31904ab9083980a91736512cb37 > # good: [63bdf4284c38a48af21745ceb148a087b190cd21] Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 > git bisect good 63bdf4284c38a48af21745ceb148a087b190cd21 > # good: [520b5fc601ab760fee7ea0c403b42d04e8ebfd93] Merge remote-tracking branch 'arm-soc/for-next' > git bisect good 520b5fc601ab760fee7ea0c403b42d04e8ebfd93 > # bad: [d7f54e4e0d4e90f5df78da8d6a830bafad3b535a] Merge remote-tracking branch 'xtensa/xtensa-for-next' > git bisect bad d7f54e4e0d4e90f5df78da8d6a830bafad3b535a > # good: [0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f] Merge remote-tracking branch 'clk/clk-next' > git bisect good 0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f > # bad: [fb0b0a73b223fc113e961b1d921322844e9c30d9] powerpc: Enable kcov > git bisect bad fb0b0a73b223fc113e961b1d921322844e9c30d9 > # good: [d0055df0c9c1471c389197a69f43e300185a75aa] Merge branch 'topic/dma' into next > git bisect good d0055df0c9c1471c389197a69f43e300185a75aa > # good: [0df977eafc792a5365a7f81d8d5920132e03afad] powerpc/6xx: Don't use SPRN_SPRG2 for storing stack pointer while in RTAS > git bisect good 0df977eafc792a5365a7f81d8d5920132e03afad > # bad: [665bed2386e5dc29844ad78c7ef1464664b103ec] powerpc/8xx: replace most #ifdef by IS_ENABLED() in 8xx_mmu.c > git bisect bad 665bed2386e5dc29844ad78c7ef1464664b103ec > # bad: [78ca1108b10927b3d068c8da91352b0f4cd01fc5] powerpc/book3s32: Reorder _PAGE_XXX flags to simplify TLB handling > git bisect bad 78ca1108b10927b3d068c8da91352b0f4cd01fc5 > # bad: [a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee] powerpc/603: Don't handle kernel page TLB misses when not need > git bisect bad a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee > # bad: [2c12393f577396a51b7e0537bd3eb29dcc26dc1b] powerpc/603: use physical address directly in TLB miss handlers. > git bisect bad 2c12393f577396a51b7e0537bd3eb29dcc26dc1b > # bad: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG > git bisect bad 93c4a162b014d238a287f8264adb25c009c79e61 > # first bad commit: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG >
On Thu, Mar 07, 2019 at 06:14:09PM +0000, Christophe Leroy wrote: > Hi, > > On 03/07/2019 02:11 PM, Guenter Roeck wrote: > >Hi, > > > >On Thu, Feb 21, 2019 at 10:37:55AM +0000, Christophe Leroy wrote: > >>Use SPRN_SPRG2 to store the current thread PGDIR and > >>avoid reading thread_struct.pgdir at every TLB miss. > >> > >This patch causes a number of silent (no crash) qemu boot stalls > >in -next. See > >https://kerneltests.org/builders/qemu-ppc-next/builds/1080/steps/qemubuildcommand/logs/stdio > >for an example. > > Oops. > Could you try the fix below ? > Yes, that does the trick. With this patch applied on top of next-20190306, all my ppc qemu boot tests pass. Tested-by: Guenter Roeck <linux@roeck-us.net> Guenter > diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S > b/arch/powerpc/kernel/cpu_setup_6xx.S > index 6f1c11e0691f..7534ecff5e92 100644 > --- a/arch/powerpc/kernel/cpu_setup_6xx.S > +++ b/arch/powerpc/kernel/cpu_setup_6xx.S > @@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION > li r10,0 > mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ > END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU) > - lis r10, (swapper_pg_dir - PAGE_OFFSET)@h > - ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l > - mtspr SPRN_SPRG_PGDIR, r10 > > BEGIN_FTR_SECTION > bl __init_fpu_registers > diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S > index ce6a972f2584..48051c8977c5 100644 > --- a/arch/powerpc/kernel/head_32.S > +++ b/arch/powerpc/kernel/head_32.S > @@ -855,6 +855,9 @@ __secondary_start: > li r3,0 > stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ > #endif > + lis r4, (swapper_pg_dir - PAGE_OFFSET)@h > + ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l > + mtspr SPRN_SPRG_PGDIR, r4 > > /* enable MMU and jump to start_secondary */ > li r4,MSR_KERNEL > @@ -942,6 +945,9 @@ start_here: > li r3,0 > stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ > #endif > + lis r4, (swapper_pg_dir - PAGE_OFFSET)@h > + ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l > + mtspr SPRN_SPRG_PGDIR, r4 > > /* stack */ > lis r1,init_thread_union@ha > diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S > index 1f13494efb2b..587e4550d83e 100644 > --- a/arch/powerpc/mm/hash_low_32.S > +++ b/arch/powerpc/mm/hash_low_32.S > @@ -70,12 +70,12 @@ _GLOBAL(hash_page) > lis r0,KERNELBASE@h /* check if kernel address */ > cmplw 0,r4,r0 > ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ > - mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */ > + mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */ > blt+ 112f /* assume user more likely */ > - lis r5,swapper_pg_dir@ha /* if kernel address, use */ > - addi r5,r5,swapper_pg_dir@l /* kernel page table */ > + lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ > + addi r5 ,r5 , (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ > rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ > -112: tophys(r5, r5) > +112: > #ifndef CONFIG_PTE_64BIT > rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */ > lwz r8,0(r5) /* get pmd entry */ > > > Thanks > Christophe > > > > >Unfortunately, it is not possible to revert the patch due to subsequent > >patches, so I was unable to test a revert. > > > >Bisect log is attached. > > > >Guenter > > > >--- > ># bad: [cf08baa29613dd899954089e7cc7dba1d478b365] Add linux-next specific files for 20190306 > ># good: [1c163f4c7b3f621efff9b28a47abb36f7378d783] Linux 5.0 > >git bisect start 'HEAD' 'v5.0' > ># bad: [6cc8f3499ec8d31904ab9083980a91736512cb37] Merge remote-tracking branch 'vfs/for-next' > >git bisect bad 6cc8f3499ec8d31904ab9083980a91736512cb37 > ># good: [63bdf4284c38a48af21745ceb148a087b190cd21] Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 > >git bisect good 63bdf4284c38a48af21745ceb148a087b190cd21 > ># good: [520b5fc601ab760fee7ea0c403b42d04e8ebfd93] Merge remote-tracking branch 'arm-soc/for-next' > >git bisect good 520b5fc601ab760fee7ea0c403b42d04e8ebfd93 > ># bad: [d7f54e4e0d4e90f5df78da8d6a830bafad3b535a] Merge remote-tracking branch 'xtensa/xtensa-for-next' > >git bisect bad d7f54e4e0d4e90f5df78da8d6a830bafad3b535a > ># good: [0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f] Merge remote-tracking branch 'clk/clk-next' > >git bisect good 0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f > ># bad: [fb0b0a73b223fc113e961b1d921322844e9c30d9] powerpc: Enable kcov > >git bisect bad fb0b0a73b223fc113e961b1d921322844e9c30d9 > ># good: [d0055df0c9c1471c389197a69f43e300185a75aa] Merge branch 'topic/dma' into next > >git bisect good d0055df0c9c1471c389197a69f43e300185a75aa > ># good: [0df977eafc792a5365a7f81d8d5920132e03afad] powerpc/6xx: Don't use SPRN_SPRG2 for storing stack pointer while in RTAS > >git bisect good 0df977eafc792a5365a7f81d8d5920132e03afad > ># bad: [665bed2386e5dc29844ad78c7ef1464664b103ec] powerpc/8xx: replace most #ifdef by IS_ENABLED() in 8xx_mmu.c > >git bisect bad 665bed2386e5dc29844ad78c7ef1464664b103ec > ># bad: [78ca1108b10927b3d068c8da91352b0f4cd01fc5] powerpc/book3s32: Reorder _PAGE_XXX flags to simplify TLB handling > >git bisect bad 78ca1108b10927b3d068c8da91352b0f4cd01fc5 > ># bad: [a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee] powerpc/603: Don't handle kernel page TLB misses when not need > >git bisect bad a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee > ># bad: [2c12393f577396a51b7e0537bd3eb29dcc26dc1b] powerpc/603: use physical address directly in TLB miss handlers. > >git bisect bad 2c12393f577396a51b7e0537bd3eb29dcc26dc1b > ># bad: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG > >git bisect bad 93c4a162b014d238a287f8264adb25c009c79e61 > ># first bad commit: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG > >
Le 07/03/2019 à 20:07, Guenter Roeck a écrit : > On Thu, Mar 07, 2019 at 06:14:09PM +0000, Christophe Leroy wrote: >> Hi, >> >> On 03/07/2019 02:11 PM, Guenter Roeck wrote: >>> Hi, >>> >>> On Thu, Feb 21, 2019 at 10:37:55AM +0000, Christophe Leroy wrote: >>>> Use SPRN_SPRG2 to store the current thread PGDIR and >>>> avoid reading thread_struct.pgdir at every TLB miss. >>>> >>> This patch causes a number of silent (no crash) qemu boot stalls >>> in -next. See >>> https://kerneltests.org/builders/qemu-ppc-next/builds/1080/steps/qemubuildcommand/logs/stdio >>> for an example. >> >> Oops. >> Could you try the fix below ? >> > > Yes, that does the trick. With this patch applied on top of next-20190306, > all my ppc qemu boot tests pass. > > Tested-by: Guenter Roeck <linux@roeck-us.net> Thanks for testing. I'll send a proper patch tomorrow morning, sorry for that. Christophe > > Guenter > >> diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S >> b/arch/powerpc/kernel/cpu_setup_6xx.S >> index 6f1c11e0691f..7534ecff5e92 100644 >> --- a/arch/powerpc/kernel/cpu_setup_6xx.S >> +++ b/arch/powerpc/kernel/cpu_setup_6xx.S >> @@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION >> li r10,0 >> mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ >> END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU) >> - lis r10, (swapper_pg_dir - PAGE_OFFSET)@h >> - ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l >> - mtspr SPRN_SPRG_PGDIR, r10 >> >> BEGIN_FTR_SECTION >> bl __init_fpu_registers >> diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S >> index ce6a972f2584..48051c8977c5 100644 >> --- a/arch/powerpc/kernel/head_32.S >> +++ b/arch/powerpc/kernel/head_32.S >> @@ -855,6 +855,9 @@ __secondary_start: >> li r3,0 >> stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ >> #endif >> + lis r4, (swapper_pg_dir - PAGE_OFFSET)@h >> + ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l >> + mtspr SPRN_SPRG_PGDIR, r4 >> >> /* enable MMU and jump to start_secondary */ >> li r4,MSR_KERNEL >> @@ -942,6 +945,9 @@ start_here: >> li r3,0 >> stw r3, RTAS_SP(r4) /* 0 => not in RTAS */ >> #endif >> + lis r4, (swapper_pg_dir - PAGE_OFFSET)@h >> + ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l >> + mtspr SPRN_SPRG_PGDIR, r4 >> >> /* stack */ >> lis r1,init_thread_union@ha >> diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S >> index 1f13494efb2b..587e4550d83e 100644 >> --- a/arch/powerpc/mm/hash_low_32.S >> +++ b/arch/powerpc/mm/hash_low_32.S >> @@ -70,12 +70,12 @@ _GLOBAL(hash_page) >> lis r0,KERNELBASE@h /* check if kernel address */ >> cmplw 0,r4,r0 >> ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ >> - mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */ >> + mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */ >> blt+ 112f /* assume user more likely */ >> - lis r5,swapper_pg_dir@ha /* if kernel address, use */ >> - addi r5,r5,swapper_pg_dir@l /* kernel page table */ >> + lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ >> + addi r5 ,r5 , (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ >> rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ >> -112: tophys(r5, r5) >> +112: >> #ifndef CONFIG_PTE_64BIT >> rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */ >> lwz r8,0(r5) /* get pmd entry */ >> >> >> Thanks >> Christophe >> >>> >>> Unfortunately, it is not possible to revert the patch due to subsequent >>> patches, so I was unable to test a revert. >>> >>> Bisect log is attached. >>> >>> Guenter >>> >>> --- >>> # bad: [cf08baa29613dd899954089e7cc7dba1d478b365] Add linux-next specific files for 20190306 >>> # good: [1c163f4c7b3f621efff9b28a47abb36f7378d783] Linux 5.0 >>> git bisect start 'HEAD' 'v5.0' >>> # bad: [6cc8f3499ec8d31904ab9083980a91736512cb37] Merge remote-tracking branch 'vfs/for-next' >>> git bisect bad 6cc8f3499ec8d31904ab9083980a91736512cb37 >>> # good: [63bdf4284c38a48af21745ceb148a087b190cd21] Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 >>> git bisect good 63bdf4284c38a48af21745ceb148a087b190cd21 >>> # good: [520b5fc601ab760fee7ea0c403b42d04e8ebfd93] Merge remote-tracking branch 'arm-soc/for-next' >>> git bisect good 520b5fc601ab760fee7ea0c403b42d04e8ebfd93 >>> # bad: [d7f54e4e0d4e90f5df78da8d6a830bafad3b535a] Merge remote-tracking branch 'xtensa/xtensa-for-next' >>> git bisect bad d7f54e4e0d4e90f5df78da8d6a830bafad3b535a >>> # good: [0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f] Merge remote-tracking branch 'clk/clk-next' >>> git bisect good 0c1a78523542fb3d2e6c5ac7955c8ca8f6482e6f >>> # bad: [fb0b0a73b223fc113e961b1d921322844e9c30d9] powerpc: Enable kcov >>> git bisect bad fb0b0a73b223fc113e961b1d921322844e9c30d9 >>> # good: [d0055df0c9c1471c389197a69f43e300185a75aa] Merge branch 'topic/dma' into next >>> git bisect good d0055df0c9c1471c389197a69f43e300185a75aa >>> # good: [0df977eafc792a5365a7f81d8d5920132e03afad] powerpc/6xx: Don't use SPRN_SPRG2 for storing stack pointer while in RTAS >>> git bisect good 0df977eafc792a5365a7f81d8d5920132e03afad >>> # bad: [665bed2386e5dc29844ad78c7ef1464664b103ec] powerpc/8xx: replace most #ifdef by IS_ENABLED() in 8xx_mmu.c >>> git bisect bad 665bed2386e5dc29844ad78c7ef1464664b103ec >>> # bad: [78ca1108b10927b3d068c8da91352b0f4cd01fc5] powerpc/book3s32: Reorder _PAGE_XXX flags to simplify TLB handling >>> git bisect bad 78ca1108b10927b3d068c8da91352b0f4cd01fc5 >>> # bad: [a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee] powerpc/603: Don't handle kernel page TLB misses when not need >>> git bisect bad a8a121995b2e4f227fddc534c6bd5f1c02cbe2ee >>> # bad: [2c12393f577396a51b7e0537bd3eb29dcc26dc1b] powerpc/603: use physical address directly in TLB miss handlers. >>> git bisect bad 2c12393f577396a51b7e0537bd3eb29dcc26dc1b >>> # bad: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG >>> git bisect bad 93c4a162b014d238a287f8264adb25c009c79e61 >>> # first bad commit: [93c4a162b014d238a287f8264adb25c009c79e61] powerpc/6xx: Store PGDIR physical address in a SPRG >>>
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 371ef6e8248e..1f79e1d8fb0b 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -1167,6 +1167,7 @@ #ifdef CONFIG_PPC_BOOK3S_32 #define SPRN_SPRG_SCRATCH0 SPRN_SPRG0 #define SPRN_SPRG_SCRATCH1 SPRN_SPRG1 +#define SPRN_SPRG_PGDIR SPRN_SPRG2 #define SPRN_SPRG_603_LRU SPRN_SPRG4 #endif diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S index 8c069e96c478..6f1c11e0691f 100644 --- a/arch/powerpc/kernel/cpu_setup_6xx.S +++ b/arch/powerpc/kernel/cpu_setup_6xx.S @@ -24,6 +24,10 @@ BEGIN_MMU_FTR_SECTION li r10,0 mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU) + lis r10, (swapper_pg_dir - PAGE_OFFSET)@h + ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l + mtspr SPRN_SPRG_PGDIR, r10 + BEGIN_FTR_SECTION bl __init_fpu_registers END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index 04128899a0a5..2b0a26f66115 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S @@ -500,16 +500,15 @@ InstructionTLBMiss: mfspr r3,SPRN_IMISS lis r1,PAGE_OFFSET@h /* check if kernel address */ cmplw 0,r1,r3 - mfspr r2,SPRN_SPRG_THREAD + mfspr r2, SPRN_SPRG_PGDIR li r1,_PAGE_USER|_PAGE_PRESENT|_PAGE_EXEC /* low addresses tested as user */ - lwz r2,PGDIR(r2) bge- 112f mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ lis r2,swapper_pg_dir@ha /* if kernel address, use */ addi r2,r2,swapper_pg_dir@l /* kernel page table */ -112: tophys(r2,r2) - rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ + tophys(r2,r2) +112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ lwz r2,0(r2) /* get pmd entry */ rlwinm. r2,r2,0,0,19 /* extract address of pte page */ beq- InstructionAddressInvalid /* return if no mapping */ @@ -574,16 +573,15 @@ DataLoadTLBMiss: mfspr r3,SPRN_DMISS lis r1,PAGE_OFFSET@h /* check if kernel address */ cmplw 0,r1,r3 - mfspr r2,SPRN_SPRG_THREAD + mfspr r2, SPRN_SPRG_PGDIR li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */ - lwz r2,PGDIR(r2) bge- 112f mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ lis r2,swapper_pg_dir@ha /* if kernel address, use */ addi r2,r2,swapper_pg_dir@l /* kernel page table */ -112: tophys(r2,r2) - rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ + tophys(r2,r2) +112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ lwz r2,0(r2) /* get pmd entry */ rlwinm. r2,r2,0,0,19 /* extract address of pte page */ beq- DataAddressInvalid /* return if no mapping */ @@ -658,16 +656,15 @@ DataStoreTLBMiss: mfspr r3,SPRN_DMISS lis r1,PAGE_OFFSET@h /* check if kernel address */ cmplw 0,r1,r3 - mfspr r2,SPRN_SPRG_THREAD + mfspr r2, SPRN_SPRG_PGDIR li r1,_PAGE_RW|_PAGE_USER|_PAGE_PRESENT /* access flags */ - lwz r2,PGDIR(r2) bge- 112f mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ lis r2,swapper_pg_dir@ha /* if kernel address, use */ addi r2,r2,swapper_pg_dir@l /* kernel page table */ -112: tophys(r2,r2) - rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ + tophys(r2,r2) +112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ lwz r2,0(r2) /* get pmd entry */ rlwinm. r2,r2,0,0,19 /* extract address of pte page */ beq- DataAddressInvalid /* return if no mapping */ @@ -1024,14 +1021,16 @@ _ENTRY(switch_mmu_context) li r0,NUM_USER_SEGMENTS mtctr r0 + lwz r4, MM_PGD(r4) #ifdef CONFIG_BDI_SWITCH /* Context switch the PTE pointer for the Abatron BDI2000. * The PGDIR is passed as second argument. */ - lwz r4,MM_PGD(r4) lis r5, abatron_pteptrs@ha stw r4, abatron_pteptrs@l + 0x4(r5) #endif + tophys(r4, r4) + mtspr SPRN_SPRG_PGDIR, r4 li r4,0 isync 3: diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S index 1e2df3e9f9ea..82e7dd0c0220 100644 --- a/arch/powerpc/mm/hash_low_32.S +++ b/arch/powerpc/mm/hash_low_32.S @@ -70,9 +70,8 @@ _GLOBAL(hash_page) /* Get PTE (linux-style) and check access */ lis r0,KERNELBASE@h /* check if kernel address */ cmplw 0,r4,r0 - mfspr r8,SPRN_SPRG_THREAD /* current task's THREAD (phys) */ ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ - lwz r5,PGDIR(r8) /* virt page-table root */ + mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */ blt+ 112f /* assume user more likely */ lis r5,swapper_pg_dir@ha /* if kernel address, use */ addi r5,r5,swapper_pg_dir@l /* kernel page table */
Use SPRN_SPRG2 to store the current thread PGDIR and avoid reading thread_struct.pgdir at every TLB miss. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/cpu_setup_6xx.S | 4 ++++ arch/powerpc/kernel/head_32.S | 25 ++++++++++++------------- arch/powerpc/mm/hash_low_32.S | 3 +-- 4 files changed, 18 insertions(+), 15 deletions(-)