5/6] eal/arm64: support register dump for oops

Message ID 20210730084938.2426128-6-jerinj@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series 5/6] eal/arm64: support register dump for oops |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues

Commit Message

Jerin Jacob Kollanukkaran July 30, 2021, 8:49 a.m. UTC
  From: Jerin Jacob <jerinj@marvell.com>

Dump the arm64 arch state register in oops
handling routine.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 lib/eal/unix/eal_oops.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
  

Comments

David Christensen Aug. 2, 2021, 10:49 p.m. UTC | #1
On 7/30/21 1:49 AM, jerinj@marvell.com wrote:
> From: Jerin Jacob <jerinj@marvell.com>
> 
> Dump the arm64 arch state register in oops
> handling routine.
> 
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> ---
>   lib/eal/unix/eal_oops.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
> diff --git a/lib/eal/unix/eal_oops.c b/lib/eal/unix/eal_oops.c
> index da71481ade..7469610d96 100644
> --- a/lib/eal/unix/eal_oops.c
> +++ b/lib/eal/unix/eal_oops.c
> @@ -162,6 +162,25 @@ archinfo_dump(ucontext_t *uc)
>   	stack_code_dump((void *)mc->gregs[REG_RSP], (void *)mc->gregs[REG_RIP]);
>   }
> 
> +#elif defined(RTE_ARCH_ARM64) && defined(RTE_EXEC_ENV_LINUX)
> +
> +static void
> +archinfo_dump(ucontext_t *uc)
> +{
> +	mcontext_t *mc = &uc->uc_mcontext;
> +	int i;
> +
> +	oops_print("PC : 0x%.16llx", mc->pc);
> +	oops_print("SP : 0x%.16llx\n", mc->sp);
> +	for (i = 0; i < 31; i++)
                      ~~~
Maybe <= instead of < ??  31 is a strange number of registers and the 
line feed doesn't seem to line things up for PSTATEn below.

> +		oops_print("X%.2d: 0x%.16llx%s", i, mc->regs[i],
> +			   i & 0x1 ? "\n" : " ");

Dave
  
Jerin Jacob Aug. 16, 2021, 4:24 p.m. UTC | #2
On Tue, Aug 3, 2021 at 4:20 AM David Christensen <drc@linux.vnet.ibm.com> wrote:
>
>
>
> On 7/30/21 1:49 AM, jerinj@marvell.com wrote:
> > From: Jerin Jacob <jerinj@marvell.com>
> >
> > Dump the arm64 arch state register in oops
> > handling routine.
> >
> > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > ---
> >   lib/eal/unix/eal_oops.c | 19 +++++++++++++++++++
> >   1 file changed, 19 insertions(+)
> >
> > diff --git a/lib/eal/unix/eal_oops.c b/lib/eal/unix/eal_oops.c
> > index da71481ade..7469610d96 100644
> > --- a/lib/eal/unix/eal_oops.c
> > +++ b/lib/eal/unix/eal_oops.c
> > @@ -162,6 +162,25 @@ archinfo_dump(ucontext_t *uc)
> >       stack_code_dump((void *)mc->gregs[REG_RSP], (void *)mc->gregs[REG_RIP]);
> >   }
> >
> > +#elif defined(RTE_ARCH_ARM64) && defined(RTE_EXEC_ENV_LINUX)
> > +
> > +static void
> > +archinfo_dump(ucontext_t *uc)
> > +{
> > +     mcontext_t *mc = &uc->uc_mcontext;
> > +     int i;
> > +
> > +     oops_print("PC : 0x%.16llx", mc->pc);
> > +     oops_print("SP : 0x%.16llx\n", mc->sp);
> > +     for (i = 0; i < 31; i++)
>                       ~~~
> Maybe <= instead of < ??  31 is a strange number of registers and the
> line feed doesn't seem to line things up for PSTATEn below.

Based on spec https://elixir.bootlin.com/linux/v4.5/source/arch/arm64/include/uapi/asm/sigcontext.h
it is 0 from 30 as r31 is SP, it is already part as struct sigcontext::sp.


>
> > +             oops_print("X%.2d: 0x%.16llx%s", i, mc->regs[i],
> > +                        i & 0x1 ? "\n" : " ");
>
> Dave
  

Patch

diff --git a/lib/eal/unix/eal_oops.c b/lib/eal/unix/eal_oops.c
index da71481ade..7469610d96 100644
--- a/lib/eal/unix/eal_oops.c
+++ b/lib/eal/unix/eal_oops.c
@@ -162,6 +162,25 @@  archinfo_dump(ucontext_t *uc)
 	stack_code_dump((void *)mc->gregs[REG_RSP], (void *)mc->gregs[REG_RIP]);
 }
 
+#elif defined(RTE_ARCH_ARM64) && defined(RTE_EXEC_ENV_LINUX)
+
+static void
+archinfo_dump(ucontext_t *uc)
+{
+	mcontext_t *mc = &uc->uc_mcontext;
+	int i;
+
+	oops_print("PC : 0x%.16llx", mc->pc);
+	oops_print("SP : 0x%.16llx\n", mc->sp);
+	for (i = 0; i < 31; i++)
+		oops_print("X%.2d: 0x%.16llx%s", i, mc->regs[i],
+			   i & 0x1 ? "\n" : " ");
+
+	oops_print("PSTATE: 0x%.16llx\n", mc->pstate);
+
+	stack_code_dump((void *)mc->sp, (void *)mc->pc);
+}
+
 #else
 
 static void