Message ID | 20210422151022.17868-2-sxwjean@me.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] powerpc: Make the code in __show_regs nice-looking | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (d20f726744a0312b4b6613333bda7da9bc52fb75) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 7 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Le 22/04/2021 à 17:10, Xiongwei Song a écrit : > From: Xiongwei Song <sxwjean@gmail.com> > > The esr register has the details of Program Interrupt on BookE/4xx cpus, > printing its value is helpful. > > Signed-off-by: Xiongwei Song <sxwjean@gmail.com> > --- > arch/powerpc/kernel/process.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 5c3830837f3a..664aecf8ee2e 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1459,6 +1459,7 @@ static bool interrupt_detail_printable(int trap) > case INTERRUPT_MACHINE_CHECK: > case INTERRUPT_DATA_STORAGE: > case INTERRUPT_ALIGNMENT: > + case INTERRUPT_PROGRAM: With this, it will also print the DSISR on 8xx/6xx so it will print garbage. 8xx/6xx provide the information in SRR1. If you want to proceed, you have to do the same as in ISI: Copy the content of SRR1 into regs->dsisr in the assembly handler in head_book3s_32.S and in the instruction TLB error handler in head_8xx.S > return true; > default: > return false; >
Le 22/04/2021 à 17:29, Christophe Leroy a écrit : > > > Le 22/04/2021 à 17:10, Xiongwei Song a écrit : >> From: Xiongwei Song <sxwjean@gmail.com> >> >> The esr register has the details of Program Interrupt on BookE/4xx cpus, >> printing its value is helpful. >> >> Signed-off-by: Xiongwei Song <sxwjean@gmail.com> >> --- >> arch/powerpc/kernel/process.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c >> index 5c3830837f3a..664aecf8ee2e 100644 >> --- a/arch/powerpc/kernel/process.c >> +++ b/arch/powerpc/kernel/process.c >> @@ -1459,6 +1459,7 @@ static bool interrupt_detail_printable(int trap) >> case INTERRUPT_MACHINE_CHECK: >> case INTERRUPT_DATA_STORAGE: >> case INTERRUPT_ALIGNMENT: >> + case INTERRUPT_PROGRAM: > > With this, it will also print the DSISR on 8xx/6xx so it will print garbage. > > 8xx/6xx provide the information in SRR1. If you want to proceed, you have to do the same as in ISI: > Copy the content of SRR1 into regs->dsisr in the assembly handler in head_book3s_32.S and in the > instruction TLB error handler in head_8xx.S In fact, we already have get_reason() called by do_program_check() to retrieve the reason of the program check exception. Maybe it could be used to print usefull information instead of starting doing almost the same is another way. Or we do as I suggested above, and we remove that get_reason() stuff. But get_reason() is also used by the alignment exception. So that doesn't look easy. I don't know what the best approach is. > >> return true; >> default: >> return false; >>
On Thu, Apr 22, 2021 at 11:29 PM Christophe Leroy <christophe.leroy@csgroup.eu> wrote: > > > > Le 22/04/2021 à 17:10, Xiongwei Song a écrit : > > From: Xiongwei Song <sxwjean@gmail.com> > > > > The esr register has the details of Program Interrupt on BookE/4xx cpus, > > printing its value is helpful. > > > > Signed-off-by: Xiongwei Song <sxwjean@gmail.com> > > --- > > arch/powerpc/kernel/process.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > > index 5c3830837f3a..664aecf8ee2e 100644 > > --- a/arch/powerpc/kernel/process.c > > +++ b/arch/powerpc/kernel/process.c > > @@ -1459,6 +1459,7 @@ static bool interrupt_detail_printable(int trap) > > case INTERRUPT_MACHINE_CHECK: > > case INTERRUPT_DATA_STORAGE: > > case INTERRUPT_ALIGNMENT: > > + case INTERRUPT_PROGRAM: > > With this, it will also print the DSISR on 8xx/6xx so it will print garbage. > > 8xx/6xx provide the information in SRR1. If you want to proceed, you have to do the same as in ISI: > Copy the content of SRR1 into regs->dsisr in the assembly handler in head_book3s_32.S and in the > instruction TLB error handler in head_8xx.S Good point.
On Fri, Apr 23, 2021 at 12:50 AM Christophe Leroy <christophe.leroy@csgroup.eu> wrote: > > > > Le 22/04/2021 à 17:29, Christophe Leroy a écrit : > > > > > > Le 22/04/2021 à 17:10, Xiongwei Song a écrit : > >> From: Xiongwei Song <sxwjean@gmail.com> > >> > >> The esr register has the details of Program Interrupt on BookE/4xx cpus, > >> printing its value is helpful. > >> > >> Signed-off-by: Xiongwei Song <sxwjean@gmail.com> > >> --- > >> arch/powerpc/kernel/process.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > >> index 5c3830837f3a..664aecf8ee2e 100644 > >> --- a/arch/powerpc/kernel/process.c > >> +++ b/arch/powerpc/kernel/process.c > >> @@ -1459,6 +1459,7 @@ static bool interrupt_detail_printable(int trap) > >> case INTERRUPT_MACHINE_CHECK: > >> case INTERRUPT_DATA_STORAGE: > >> case INTERRUPT_ALIGNMENT: > >> + case INTERRUPT_PROGRAM: > > > > With this, it will also print the DSISR on 8xx/6xx so it will print garbage. > > > > 8xx/6xx provide the information in SRR1. If you want to proceed, you have to do the same as in ISI: > > Copy the content of SRR1 into regs->dsisr in the assembly handler in head_book3s_32.S and in the > > instruction TLB error handler in head_8xx.S > > In fact, we already have get_reason() called by do_program_check() to retrieve the reason of the > program check exception. Maybe it could be used to print usefull information instead of starting > doing almost the same is another way. Yes, there is the get_reason() function. But if the program interrupt is triggered in kernel mode, the reason can be lost , see the code below: 335 static bool exception_common(int signr, struct pt_regs *regs, int code, 336 unsigned long addr) 337 { 338 if (!user_mode(regs)) { 339 die("Exception in kernel mode", regs, signr); 340 return false; 341 } The third parameter(int code) of exception_common is to pass the reason, when in kernel mode, the "code" parameter is lost, hence I append INTERRUPT_PROGRAM here. This is for __show_regs(), so just printing the content of the register is fine I think. > > Or we do as I suggested above, and we remove that get_reason() stuff. But get_reason() is also used > by the alignment exception. So that doesn't look easy. > > I don't know what the best approach is. Is it acceptable to print the interrupt reason before invoking die() in exception_common()? Regards, Xiongwei
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 5c3830837f3a..664aecf8ee2e 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1459,6 +1459,7 @@ static bool interrupt_detail_printable(int trap) case INTERRUPT_MACHINE_CHECK: case INTERRUPT_DATA_STORAGE: case INTERRUPT_ALIGNMENT: + case INTERRUPT_PROGRAM: return true; default: return false;