Re: [PATCH v3 03/19] powerpc: bad_page_fault, do_break get registers from regs
Excerpts from Nicholas Piggin's message of December 26, 2020 6:19 pm: > Excerpts from Christophe Leroy's message of December 23, 2020 12:42 am: >> >> >> Le 28/11/2020 à 15:40, Nicholas Piggin a écrit : >>> Similar to the previous patch this makes interrupt handler function >>> types more regular so they can be wrapped with the next patch. >>> >>> bad_page_fault and do_break are not performance critical. >> >> I partly took your changes into one of my series, in different order though. >> >> Please have a look at >> https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=221656 >> patches >> 4 to 7 > > Thanks, I had a look. Seems like the result is basically the same as my > series, so that's good if you like the end result now :) > >> I think some of the changes are missing in your series, especially the >> changes in entry_32.S from >> patch 7. > > Okay I could take them in. In your patch 7/15, why do you leave this > load of DSISR? > > diff --git a/arch/powerpc/kernel/head_book3s_32.S > b/arch/powerpc/kernel/head_book3s_32.S > index 15e6003fd3b8..0133a02d1d47 100644 > --- a/arch/powerpc/kernel/head_book3s_32.S > +++ b/arch/powerpc/kernel/head_book3s_32.S > @@ -369,9 +369,9 @@ BEGIN_MMU_FTR_SECTION > END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) > #endif > #endif /* CONFIG_VMAP_STACK */ > -1: mr r4,r12 > andis. r5,r9,DSISR_SRR1_MATCH_32S@h /* Filter relevant SRR1 bits */ > - stw r4, _DAR(r11) > + stw r12, _DAR(r11) > + stw r5, _DSISR(r11) > EXC_XFER_LITE(0x400, handle_page_fault) > > /* External interrupt */ > @@ -693,7 +693,6 @@ handle_page_fault_tramp_1: > #ifdef CONFIG_VMAP_STACK > EXCEPTION_PROLOG_2 handle_dar_dsisr=1 > #endif > - lwz r4, _DAR(r11) > lwz r5, _DSISR(r11) > ^^ > /* fall through */ > handle_page_fault_tramp_2: > > ? Ah never mind, this needs to come back after your DABR match move patch, which you have earlier in the series. I confused myself. I'll rebase my series on your patch 4 rather than have it squashed in with other do_break stuff. Thanks, Nick
Re: [PATCH v3 03/19] powerpc: bad_page_fault, do_break get registers from regs
Excerpts from Christophe Leroy's message of December 23, 2020 12:42 am: > > > Le 28/11/2020 à 15:40, Nicholas Piggin a écrit : >> Similar to the previous patch this makes interrupt handler function >> types more regular so they can be wrapped with the next patch. >> >> bad_page_fault and do_break are not performance critical. > > I partly took your changes into one of my series, in different order though. > > Please have a look at > https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=221656 patches > 4 to 7 Thanks, I had a look. Seems like the result is basically the same as my series, so that's good if you like the end result now :) > I think some of the changes are missing in your series, especially the > changes in entry_32.S from > patch 7. Okay I could take them in. In your patch 7/15, why do you leave this load of DSISR? diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S index 15e6003fd3b8..0133a02d1d47 100644 --- a/arch/powerpc/kernel/head_book3s_32.S +++ b/arch/powerpc/kernel/head_book3s_32.S @@ -369,9 +369,9 @@ BEGIN_MMU_FTR_SECTION END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) #endif #endif /* CONFIG_VMAP_STACK */ -1: mr r4,r12 andis. r5,r9,DSISR_SRR1_MATCH_32S@h /* Filter relevant SRR1 bits */ - stw r4, _DAR(r11) + stw r12, _DAR(r11) + stw r5, _DSISR(r11) EXC_XFER_LITE(0x400, handle_page_fault) /* External interrupt */ @@ -693,7 +693,6 @@ handle_page_fault_tramp_1: #ifdef CONFIG_VMAP_STACK EXCEPTION_PROLOG_2 handle_dar_dsisr=1 #endif - lwz r4, _DAR(r11) lwz r5, _DSISR(r11) ^^ /* fall through */ handle_page_fault_tramp_2: ? > Will see how our two series make their way into mainline, yours needs rebase > anyway. I have it rebased, just waiting for a bit after merge window to repost. Would be good if mine can go first so I don't have to redo the 64s page fault to C conversion again. AFAIKS after that you can just drop 4-7, no conflicts? (after bugs are fixed) Thanks, Nick
Re: [PATCH v3 03/19] powerpc: bad_page_fault, do_break get registers from regs
Le 28/11/2020 à 15:40, Nicholas Piggin a écrit : Similar to the previous patch this makes interrupt handler function types more regular so they can be wrapped with the next patch. bad_page_fault and do_break are not performance critical. I partly took your changes into one of my series, in different order though. Please have a look at https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=221656 patches 4 to 7 I think some of the changes are missing in your series, especially the changes in entry_32.S from patch 7. Will see how our two series make their way into mainline, yours needs rebase anyway. Christophe [32s DABR code from Christophe Leroy ] Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h | 2 +- arch/powerpc/include/asm/debug.h | 3 +-- arch/powerpc/kernel/entry_32.S | 18 +- arch/powerpc/kernel/exceptions-64e.S | 3 +-- arch/powerpc/kernel/exceptions-64s.S | 3 +-- arch/powerpc/kernel/head_8xx.S | 5 ++--- arch/powerpc/kernel/head_book3s_32.S | 3 +++ arch/powerpc/kernel/process.c | 7 +++ arch/powerpc/kernel/traps.c| 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 4 ++-- arch/powerpc/mm/book3s64/slb.c | 2 +- arch/powerpc/mm/fault.c| 10 +- arch/powerpc/platforms/8xx/machine_check.c | 2 +- 13 files changed, 23 insertions(+), 41 deletions(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 897bad6b6bbb..49162faba33f 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -113,7 +113,7 @@ struct pt_regs; long do_page_fault(struct pt_regs *); long hash__do_page_fault(struct pt_regs *); -extern void bad_page_fault(struct pt_regs *, unsigned long, int); +void bad_page_fault(struct pt_regs *, int); extern void _exception(int, struct pt_regs *, int, unsigned long); extern void _exception_pkey(struct pt_regs *, unsigned long, int); extern void die(const char *, struct pt_regs *, long); diff --git a/arch/powerpc/include/asm/debug.h b/arch/powerpc/include/asm/debug.h index ec57daf87f40..0550eceab3ca 100644 --- a/arch/powerpc/include/asm/debug.h +++ b/arch/powerpc/include/asm/debug.h @@ -52,8 +52,7 @@ extern void do_send_trap(struct pt_regs *regs, unsigned long address, unsigned long error_code, int brkpt); #else -extern void do_break(struct pt_regs *regs, unsigned long address, -unsigned long error_code); +void do_break(struct pt_regs *regs); #endif #endif /* _ASM_POWERPC_DEBUG_H */ diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 8cdc8bcde703..57b8e95ea2a0 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -657,10 +657,6 @@ ppc_swapcontext: .globl handle_page_fault handle_page_fault: addir3,r1,STACK_FRAME_OVERHEAD -#ifdef CONFIG_PPC_BOOK3S_32 - andis. r0,r5,DSISR_DABRMATCH@h - bne-handle_dabr_fault -#endif bl do_page_fault cmpwi r3,0 beq+ret_from_except @@ -668,23 +664,11 @@ handle_page_fault: lwz r0,_TRAP(r1) clrrwi r0,r0,1 stw r0,_TRAP(r1) - mr r5,r3 + mr r4,r3 /* err arg for bad_page_fault */ addir3,r1,STACK_FRAME_OVERHEAD - lwz r4,_DAR(r1) bl bad_page_fault b ret_from_except_full -#ifdef CONFIG_PPC_BOOK3S_32 - /* We have a data breakpoint exception - handle it */ -handle_dabr_fault: - SAVE_NVGPRS(r1) - lwz r0,_TRAP(r1) - clrrwi r0,r0,1 - stw r0,_TRAP(r1) - bl do_break - b ret_from_except_full -#endif - /* * This routine switches between two different tasks. The process * state of one is saved on its kernel stack. Then the state diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S index 25fa7d5a643c..dc728bb1c89a 100644 --- a/arch/powerpc/kernel/exceptions-64e.S +++ b/arch/powerpc/kernel/exceptions-64e.S @@ -1018,9 +1018,8 @@ storage_fault_common: bne-1f b ret_from_except_lite 1:bl save_nvgprs - mr r5,r3 + mr r4,r3 addir3,r1,STACK_FRAME_OVERHEAD - ld r4,_DAR(r1) bl bad_page_fault b ret_from_except diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 690058043b17..77b730f515c4 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -2136,8 +2136,7 @@ EXC_COMMON_BEGIN(h_data_storage_common) GEN_COMMON h_data_storage addir3,r1,STACK_FRAME_OVERHEAD BEGIN_MMU_FTR_SECTION - ld r4,_DAR(r1) - li r5,SIGSEGV + li r4,SIGSEGV bl
Re: [PATCH v3 03/19] powerpc: bad_page_fault, do_break get registers from regs
Nicholas Piggin writes: > Similar to the previous patch this makes interrupt handler function > types more regular so they can be wrapped with the next patch. > > bad_page_fault and do_break are not performance critical. > Reviewed-by: Aneesh Kumar K.V > [32s DABR code from Christophe Leroy ] > Signed-off-by: Nicholas Piggin > --- > arch/powerpc/include/asm/bug.h | 2 +- > arch/powerpc/include/asm/debug.h | 3 +-- > arch/powerpc/kernel/entry_32.S | 18 +- > arch/powerpc/kernel/exceptions-64e.S | 3 +-- > arch/powerpc/kernel/exceptions-64s.S | 3 +-- > arch/powerpc/kernel/head_8xx.S | 5 ++--- > arch/powerpc/kernel/head_book3s_32.S | 3 +++ > arch/powerpc/kernel/process.c | 7 +++ > arch/powerpc/kernel/traps.c| 2 +- > arch/powerpc/mm/book3s64/hash_utils.c | 4 ++-- > arch/powerpc/mm/book3s64/slb.c | 2 +- > arch/powerpc/mm/fault.c| 10 +- > arch/powerpc/platforms/8xx/machine_check.c | 2 +- > 13 files changed, 23 insertions(+), 41 deletions(-) > > diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h > index 897bad6b6bbb..49162faba33f 100644 > --- a/arch/powerpc/include/asm/bug.h > +++ b/arch/powerpc/include/asm/bug.h > @@ -113,7 +113,7 @@ > struct pt_regs; > long do_page_fault(struct pt_regs *); > long hash__do_page_fault(struct pt_regs *); > -extern void bad_page_fault(struct pt_regs *, unsigned long, int); > +void bad_page_fault(struct pt_regs *, int); > extern void _exception(int, struct pt_regs *, int, unsigned long); > extern void _exception_pkey(struct pt_regs *, unsigned long, int); > extern void die(const char *, struct pt_regs *, long); > diff --git a/arch/powerpc/include/asm/debug.h > b/arch/powerpc/include/asm/debug.h > index ec57daf87f40..0550eceab3ca 100644 > --- a/arch/powerpc/include/asm/debug.h > +++ b/arch/powerpc/include/asm/debug.h > @@ -52,8 +52,7 @@ extern void do_send_trap(struct pt_regs *regs, unsigned > long address, >unsigned long error_code, int brkpt); > #else > > -extern void do_break(struct pt_regs *regs, unsigned long address, > - unsigned long error_code); > +void do_break(struct pt_regs *regs); > #endif > > #endif /* _ASM_POWERPC_DEBUG_H */ > diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S > index 8cdc8bcde703..57b8e95ea2a0 100644 > --- a/arch/powerpc/kernel/entry_32.S > +++ b/arch/powerpc/kernel/entry_32.S > @@ -657,10 +657,6 @@ ppc_swapcontext: > .globl handle_page_fault > handle_page_fault: > addir3,r1,STACK_FRAME_OVERHEAD > -#ifdef CONFIG_PPC_BOOK3S_32 > - andis. r0,r5,DSISR_DABRMATCH@h > - bne-handle_dabr_fault > -#endif > bl do_page_fault > cmpwi r3,0 > beq+ret_from_except > @@ -668,23 +664,11 @@ handle_page_fault: > lwz r0,_TRAP(r1) > clrrwi r0,r0,1 > stw r0,_TRAP(r1) > - mr r5,r3 > + mr r4,r3 /* err arg for bad_page_fault */ > addir3,r1,STACK_FRAME_OVERHEAD > - lwz r4,_DAR(r1) > bl bad_page_fault > b ret_from_except_full > > -#ifdef CONFIG_PPC_BOOK3S_32 > - /* We have a data breakpoint exception - handle it */ > -handle_dabr_fault: > - SAVE_NVGPRS(r1) > - lwz r0,_TRAP(r1) > - clrrwi r0,r0,1 > - stw r0,_TRAP(r1) > - bl do_break > - b ret_from_except_full > -#endif > - > /* > * This routine switches between two different tasks. The process > * state of one is saved on its kernel stack. Then the state > diff --git a/arch/powerpc/kernel/exceptions-64e.S > b/arch/powerpc/kernel/exceptions-64e.S > index 25fa7d5a643c..dc728bb1c89a 100644 > --- a/arch/powerpc/kernel/exceptions-64e.S > +++ b/arch/powerpc/kernel/exceptions-64e.S > @@ -1018,9 +1018,8 @@ storage_fault_common: > bne-1f > b ret_from_except_lite > 1: bl save_nvgprs > - mr r5,r3 > + mr r4,r3 > addir3,r1,STACK_FRAME_OVERHEAD > - ld r4,_DAR(r1) > bl bad_page_fault > b ret_from_except > > diff --git a/arch/powerpc/kernel/exceptions-64s.S > b/arch/powerpc/kernel/exceptions-64s.S > index 690058043b17..77b730f515c4 100644 > --- a/arch/powerpc/kernel/exceptions-64s.S > +++ b/arch/powerpc/kernel/exceptions-64s.S > @@ -2136,8 +2136,7 @@ EXC_COMMON_BEGIN(h_data_storage_common) > GEN_COMMON h_data_storage > addir3,r1,STACK_FRAME_OVERHEAD > BEGIN_MMU_FTR_SECTION > - ld r4,_DAR(r1) > - li r5,SIGSEGV > + li r4,SIGSEGV > bl bad_page_fault > MMU_FTR_SECTION_ELSE > bl unknown_exception > diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S > index 8acd365a2be6..71ad7ce28469 100644 > --- a/arch/powerpc/kernel/head_8xx.S > +++ b/arch/powerpc/kernel/head_8xx.S > @@
[PATCH v3 03/19] powerpc: bad_page_fault, do_break get registers from regs
Similar to the previous patch this makes interrupt handler function types more regular so they can be wrapped with the next patch. bad_page_fault and do_break are not performance critical. [32s DABR code from Christophe Leroy ] Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h | 2 +- arch/powerpc/include/asm/debug.h | 3 +-- arch/powerpc/kernel/entry_32.S | 18 +- arch/powerpc/kernel/exceptions-64e.S | 3 +-- arch/powerpc/kernel/exceptions-64s.S | 3 +-- arch/powerpc/kernel/head_8xx.S | 5 ++--- arch/powerpc/kernel/head_book3s_32.S | 3 +++ arch/powerpc/kernel/process.c | 7 +++ arch/powerpc/kernel/traps.c| 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 4 ++-- arch/powerpc/mm/book3s64/slb.c | 2 +- arch/powerpc/mm/fault.c| 10 +- arch/powerpc/platforms/8xx/machine_check.c | 2 +- 13 files changed, 23 insertions(+), 41 deletions(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 897bad6b6bbb..49162faba33f 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -113,7 +113,7 @@ struct pt_regs; long do_page_fault(struct pt_regs *); long hash__do_page_fault(struct pt_regs *); -extern void bad_page_fault(struct pt_regs *, unsigned long, int); +void bad_page_fault(struct pt_regs *, int); extern void _exception(int, struct pt_regs *, int, unsigned long); extern void _exception_pkey(struct pt_regs *, unsigned long, int); extern void die(const char *, struct pt_regs *, long); diff --git a/arch/powerpc/include/asm/debug.h b/arch/powerpc/include/asm/debug.h index ec57daf87f40..0550eceab3ca 100644 --- a/arch/powerpc/include/asm/debug.h +++ b/arch/powerpc/include/asm/debug.h @@ -52,8 +52,7 @@ extern void do_send_trap(struct pt_regs *regs, unsigned long address, unsigned long error_code, int brkpt); #else -extern void do_break(struct pt_regs *regs, unsigned long address, -unsigned long error_code); +void do_break(struct pt_regs *regs); #endif #endif /* _ASM_POWERPC_DEBUG_H */ diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 8cdc8bcde703..57b8e95ea2a0 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -657,10 +657,6 @@ ppc_swapcontext: .globl handle_page_fault handle_page_fault: addir3,r1,STACK_FRAME_OVERHEAD -#ifdef CONFIG_PPC_BOOK3S_32 - andis. r0,r5,DSISR_DABRMATCH@h - bne-handle_dabr_fault -#endif bl do_page_fault cmpwi r3,0 beq+ret_from_except @@ -668,23 +664,11 @@ handle_page_fault: lwz r0,_TRAP(r1) clrrwi r0,r0,1 stw r0,_TRAP(r1) - mr r5,r3 + mr r4,r3 /* err arg for bad_page_fault */ addir3,r1,STACK_FRAME_OVERHEAD - lwz r4,_DAR(r1) bl bad_page_fault b ret_from_except_full -#ifdef CONFIG_PPC_BOOK3S_32 - /* We have a data breakpoint exception - handle it */ -handle_dabr_fault: - SAVE_NVGPRS(r1) - lwz r0,_TRAP(r1) - clrrwi r0,r0,1 - stw r0,_TRAP(r1) - bl do_break - b ret_from_except_full -#endif - /* * This routine switches between two different tasks. The process * state of one is saved on its kernel stack. Then the state diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S index 25fa7d5a643c..dc728bb1c89a 100644 --- a/arch/powerpc/kernel/exceptions-64e.S +++ b/arch/powerpc/kernel/exceptions-64e.S @@ -1018,9 +1018,8 @@ storage_fault_common: bne-1f b ret_from_except_lite 1: bl save_nvgprs - mr r5,r3 + mr r4,r3 addir3,r1,STACK_FRAME_OVERHEAD - ld r4,_DAR(r1) bl bad_page_fault b ret_from_except diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 690058043b17..77b730f515c4 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -2136,8 +2136,7 @@ EXC_COMMON_BEGIN(h_data_storage_common) GEN_COMMON h_data_storage addir3,r1,STACK_FRAME_OVERHEAD BEGIN_MMU_FTR_SECTION - ld r4,_DAR(r1) - li r5,SIGSEGV + li r4,SIGSEGV bl bad_page_fault MMU_FTR_SECTION_ELSE bl unknown_exception diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 8acd365a2be6..71ad7ce28469 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -376,10 +376,9 @@ do_databreakpoint: addir3,r1,STACK_FRAME_OVERHEAD mfspr r4,SPRN_BAR stw r4,_DAR(r11) -#ifdef CONFIG_VMAP_STACK - lwz r5,_DSISR(r11) -#else +#ifndef CONFIG_VMAP_STACK