Message ID | 7622ee313f20fbae58cfa0b880f9d27dd1a9a10b.1506525800.git.joseph.salisbury@canonical.com |
---|---|
State | New |
Headers | show |
Series | powerpc/64s: Handle data breakpoints in Radix mode | expand |
On 27.09.2017 11:32, Joseph Salisbury wrote: > From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> > > BugLink: http://bugs.launchpad.net/bugs/1706033 > > On Power9, trying to use data breakpoints throws the splat shown > below. This is because the check for a data breakpoint in DSISR is in > do_hash_page(), which is not called when in Radix mode. > > Unable to handle kernel paging request for data at address 0xc000000000e19218 > Faulting instruction address: 0xc0000000001155e8 > cpu 0x0: Vector: 300 (Data Access) at [c0000000ef1e7b20] > pc: c0000000001155e8: find_pid_ns+0x48/0xe0 > lr: c000000000116ac4: find_task_by_vpid+0x44/0x90 > sp: c0000000ef1e7da0 > msr: 9000000000009033 > dar: c000000000e19218 > dsisr: 400000 > > Move the check to handle_page_fault() so as to catch data breakpoints > in both Hash and Radix MMU modes. > > We have to change the check in do_hash_page() against 0xa410 to use > 0xa450, so as to include the value of (DSISR_DABRMATCH << 16). > > There are two sites that call handle_page_fault() when in Radix, both > already pass DSISR in r4. > > Fixes: caca285e5ab4 ("powerpc/mm/radix: Use STD_MMU_64 to properly isolate hash related code") > Cc: stable@vger.kernel.org # v4.7+ > Reported-by: Shriya R. Kulkarni <shriykul@in.ibm.com> > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > [mpe: Fix the fall-through case on hash, we need to reload DSISR] > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> > > (cherry picked from commit d89ba5353f301971dd7d2f9fdf25c4432728f38e) > Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> > --- > arch/powerpc/kernel/exceptions-64s.S | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S > index 7845613..fa2c6c9 100644 > --- a/arch/powerpc/kernel/exceptions-64s.S > +++ b/arch/powerpc/kernel/exceptions-64s.S > @@ -1418,10 +1418,8 @@ USE_TEXT_SECTION() > .balign IFETCH_ALIGN_BYTES > do_hash_page: > #ifdef CONFIG_PPC_STD_MMU_64 > - andis. r0,r4,0xa410 /* weird error? */ > + andis. r0,r4,0xa450 /* weird error? */ > bne- handle_page_fault /* if not, try to insert a HPTE */ > - andis. r0,r4,DSISR_DABRMATCH@h > - bne- handle_dabr_fault > CURRENT_THREAD_INFO(r11, r1) > lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ > andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ > @@ -1445,11 +1443,16 @@ do_hash_page: > > /* Error */ > blt- 13f > + > + /* Reload DSISR into r4 for the DABR check below */ > + ld r4,_DSISR(r1) > #endif /* CONFIG_PPC_STD_MMU_64 */ > > /* Here we have a page fault that hash_page can't handle. */ > handle_page_fault: > -11: ld r4,_DAR(r1) > +11: andis. r0,r4,DSISR_DABRMATCH@h > + bne- handle_dabr_fault > + ld r4,_DAR(r1) > ld r5,_DSISR(r1) > addi r3,r1,STACK_FRAME_OVERHEAD > bl do_page_fault >
On 27/09/17 16:32, Joseph Salisbury wrote: > From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> > > BugLink: http://bugs.launchpad.net/bugs/1706033 > > On Power9, trying to use data breakpoints throws the splat shown > below. This is because the check for a data breakpoint in DSISR is in > do_hash_page(), which is not called when in Radix mode. > > Unable to handle kernel paging request for data at address 0xc000000000e19218 > Faulting instruction address: 0xc0000000001155e8 > cpu 0x0: Vector: 300 (Data Access) at [c0000000ef1e7b20] > pc: c0000000001155e8: find_pid_ns+0x48/0xe0 > lr: c000000000116ac4: find_task_by_vpid+0x44/0x90 > sp: c0000000ef1e7da0 > msr: 9000000000009033 > dar: c000000000e19218 > dsisr: 400000 > > Move the check to handle_page_fault() so as to catch data breakpoints > in both Hash and Radix MMU modes. > > We have to change the check in do_hash_page() against 0xa410 to use > 0xa450, so as to include the value of (DSISR_DABRMATCH << 16). > > There are two sites that call handle_page_fault() when in Radix, both > already pass DSISR in r4. > > Fixes: caca285e5ab4 ("powerpc/mm/radix: Use STD_MMU_64 to properly isolate hash related code") > Cc: stable@vger.kernel.org # v4.7+ > Reported-by: Shriya R. Kulkarni <shriykul@in.ibm.com> > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > [mpe: Fix the fall-through case on hash, we need to reload DSISR] > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> > > (cherry picked from commit d89ba5353f301971dd7d2f9fdf25c4432728f38e) > Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com> > --- > arch/powerpc/kernel/exceptions-64s.S | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S > index 7845613..fa2c6c9 100644 > --- a/arch/powerpc/kernel/exceptions-64s.S > +++ b/arch/powerpc/kernel/exceptions-64s.S > @@ -1418,10 +1418,8 @@ USE_TEXT_SECTION() > .balign IFETCH_ALIGN_BYTES > do_hash_page: > #ifdef CONFIG_PPC_STD_MMU_64 > - andis. r0,r4,0xa410 /* weird error? */ > + andis. r0,r4,0xa450 /* weird error? */ > bne- handle_page_fault /* if not, try to insert a HPTE */ > - andis. r0,r4,DSISR_DABRMATCH@h > - bne- handle_dabr_fault > CURRENT_THREAD_INFO(r11, r1) > lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ > andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ > @@ -1445,11 +1443,16 @@ do_hash_page: > > /* Error */ > blt- 13f > + > + /* Reload DSISR into r4 for the DABR check below */ > + ld r4,_DSISR(r1) > #endif /* CONFIG_PPC_STD_MMU_64 */ > > /* Here we have a page fault that hash_page can't handle. */ > handle_page_fault: > -11: ld r4,_DAR(r1) > +11: andis. r0,r4,DSISR_DABRMATCH@h > + bne- handle_dabr_fault > + ld r4,_DAR(r1) > ld r5,_DSISR(r1) > addi r3,r1,STACK_FRAME_OVERHEAD > bl do_page_fault > Positive test results. Acked-by: Colin Ian King <colin.king@canonical.com>
Applied to zesty master-next branch. Thanks. Cascardo. Applied-to: zesty/master-next
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 7845613..fa2c6c9 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -1418,10 +1418,8 @@ USE_TEXT_SECTION() .balign IFETCH_ALIGN_BYTES do_hash_page: #ifdef CONFIG_PPC_STD_MMU_64 - andis. r0,r4,0xa410 /* weird error? */ + andis. r0,r4,0xa450 /* weird error? */ bne- handle_page_fault /* if not, try to insert a HPTE */ - andis. r0,r4,DSISR_DABRMATCH@h - bne- handle_dabr_fault CURRENT_THREAD_INFO(r11, r1) lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ @@ -1445,11 +1443,16 @@ do_hash_page: /* Error */ blt- 13f + + /* Reload DSISR into r4 for the DABR check below */ + ld r4,_DSISR(r1) #endif /* CONFIG_PPC_STD_MMU_64 */ /* Here we have a page fault that hash_page can't handle. */ handle_page_fault: -11: ld r4,_DAR(r1) +11: andis. r0,r4,DSISR_DABRMATCH@h + bne- handle_dabr_fault + ld r4,_DAR(r1) ld r5,_DSISR(r1) addi r3,r1,STACK_FRAME_OVERHEAD bl do_page_fault