Message ID | 20220712161452.4142444-3-mark.rutland@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: report EL1 exceptions better | expand |
On Tue, Jul 12, 2022 at 05:14:49PM +0100, Mark Rutland wrote: > Recently, we reworked a lot of code to consistentlt pass ESR_ELx as a > 64-bit quantity. However, we missed that this can be passed into die() > and __die() as the 'err' parameter where it is truncated to a 32-bit > int. Reviewed-by: Mark Brown <broonie@kernel.org>
On 7/12/22 21:44, Mark Rutland wrote: > Recently, we reworked a lot of code to consistentlt pass ESR_ELx as a > 64-bit quantity. However, we missed that this can be passed into die() > and __die() as the 'err' parameter where it is truncated to a 32-bit > int. > > As notify_die() already takes 'err' as a long, this patch changes die() > and __die() to also take 'err' as a long, ensuring that the full value > of ESR_ELx is retained. > > At the same time, die() is updated to consistently log 'err' as a > zero-padded 64-bit quantity. > > Subsequent patches will pass the ESR_ELx value to die() for a number of > exceptions. > > Signed-off-by: Mark Rutland <mark.rutland@arm.com> > Cc: Alexandru Elisei <alexandru.elisei@arm.com> > Cc: Amit Daniel Kachhap <amit.kachhap@arm.com> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: James Morse <james.morse@arm.com> > Cc: Mark Brown <broonie@kernel.org> > Cc: Will Deacon <will@kernel.org> > --- Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> > arch/arm64/include/asm/system_misc.h | 2 +- > arch/arm64/kernel/traps.c | 6 +++--- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h > index 0eb7709422e2..c34344256762 100644 > --- a/arch/arm64/include/asm/system_misc.h > +++ b/arch/arm64/include/asm/system_misc.h > @@ -18,7 +18,7 @@ > > struct pt_regs; > > -void die(const char *msg, struct pt_regs *regs, int err); > +void die(const char *msg, struct pt_regs *regs, long err); > > struct siginfo; > void arm64_notify_die(const char *str, struct pt_regs *regs, > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > index eac4f7a83175..da8ffef6f7c5 100644 > --- a/arch/arm64/kernel/traps.c > +++ b/arch/arm64/kernel/traps.c > @@ -180,12 +180,12 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs) > > #define S_SMP " SMP" > > -static int __die(const char *str, int err, struct pt_regs *regs) > +static int __die(const char *str, long err, struct pt_regs *regs) Just curious, argument order is bit strange here ? > { > static int die_counter; > int ret; > > - pr_emerg("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", > + pr_emerg("Internal error: %s: %016lx [#%d]" S_PREEMPT S_SMP "\n", > str, err, ++die_counter); > > /* trap and error numbers are mostly meaningless on ARM */ > @@ -206,7 +206,7 @@ static DEFINE_RAW_SPINLOCK(die_lock); > /* > * This function is protected against re-entrancy. > */ > -void die(const char *str, struct pt_regs *regs, int err) > +void die(const char *str, struct pt_regs *regs, long err) > { > int ret; > unsigned long flags;
diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h index 0eb7709422e2..c34344256762 100644 --- a/arch/arm64/include/asm/system_misc.h +++ b/arch/arm64/include/asm/system_misc.h @@ -18,7 +18,7 @@ struct pt_regs; -void die(const char *msg, struct pt_regs *regs, int err); +void die(const char *msg, struct pt_regs *regs, long err); struct siginfo; void arm64_notify_die(const char *str, struct pt_regs *regs, diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index eac4f7a83175..da8ffef6f7c5 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -180,12 +180,12 @@ static void dump_kernel_instr(const char *lvl, struct pt_regs *regs) #define S_SMP " SMP" -static int __die(const char *str, int err, struct pt_regs *regs) +static int __die(const char *str, long err, struct pt_regs *regs) { static int die_counter; int ret; - pr_emerg("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", + pr_emerg("Internal error: %s: %016lx [#%d]" S_PREEMPT S_SMP "\n", str, err, ++die_counter); /* trap and error numbers are mostly meaningless on ARM */ @@ -206,7 +206,7 @@ static DEFINE_RAW_SPINLOCK(die_lock); /* * This function is protected against re-entrancy. */ -void die(const char *str, struct pt_regs *regs, int err) +void die(const char *str, struct pt_regs *regs, long err) { int ret; unsigned long flags;
Recently, we reworked a lot of code to consistentlt pass ESR_ELx as a 64-bit quantity. However, we missed that this can be passed into die() and __die() as the 'err' parameter where it is truncated to a 32-bit int. As notify_die() already takes 'err' as a long, this patch changes die() and __die() to also take 'err' as a long, ensuring that the full value of ESR_ELx is retained. At the same time, die() is updated to consistently log 'err' as a zero-padded 64-bit quantity. Subsequent patches will pass the ESR_ELx value to die() for a number of exceptions. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Alexandru Elisei <alexandru.elisei@arm.com> Cc: Amit Daniel Kachhap <amit.kachhap@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Mark Brown <broonie@kernel.org> Cc: Will Deacon <will@kernel.org> --- arch/arm64/include/asm/system_misc.h | 2 +- arch/arm64/kernel/traps.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)