[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=W1F-B7SUwxebhhH2HS+fN4sYv4RHvvKud5a+00J0T=SA@mail.gmail.com>
Date: Mon, 11 May 2020 15:45:02 -0700
From: Doug Anderson <dianders@...omium.org>
To: Will Deacon <will@...nel.org>
Cc: Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Gross <agross@...nel.org>,
kgdb-bugreport@...ts.sourceforge.net,
Catalin Marinas <catalin.marinas@....com>,
linux-serial@...r.kernel.org, Sumit Garg <sumit.garg@...aro.org>,
Jonathan Corbet <corbet@....net>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Frank Rowand <frowand.list@...il.com>, bp@...en8.de,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Jiri Slaby <jslaby@...e.com>,
Alexios Zavras <alexios.zavras@...el.com>,
Allison Randal <allison@...utok.net>,
Dave Martin <Dave.Martin@....com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
James Morse <james.morse@....com>,
Mark Rutland <mark.rutland@....com>,
Masami Hiramatsu <mhiramat@...nel.org>,
jinho lim <jordan.lim@...sung.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 05/11] arm64: Add call_break_hook() to early_brk64()
for early kgdb
Hi,
On Mon, May 11, 2020 at 7:59 AM Will Deacon <will@...nel.org> wrote:
>
> Hi Doug,
>
> On Tue, Apr 28, 2020 at 02:13:45PM -0700, Douglas Anderson wrote:
> > diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> > index 48222a4760c2..59c353dfc8e9 100644
> > --- a/arch/arm64/kernel/debug-monitors.c
> > +++ b/arch/arm64/kernel/debug-monitors.c
> > @@ -297,7 +297,7 @@ void unregister_kernel_break_hook(struct break_hook *hook)
> > unregister_debug_hook(&hook->node);
> > }
> >
> > -static int call_break_hook(struct pt_regs *regs, unsigned int esr)
> > +int call_break_hook(struct pt_regs *regs, unsigned int esr)
> > {
> > struct break_hook *hook;
> > struct list_head *list;
> > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> > index cf402be5c573..a8173f0c1774 100644
> > --- a/arch/arm64/kernel/traps.c
> > +++ b/arch/arm64/kernel/traps.c
> > @@ -1044,6 +1044,9 @@ int __init early_brk64(unsigned long addr, unsigned int esr,
> > if ((comment & ~KASAN_BRK_MASK) == KASAN_BRK_IMM)
> > return kasan_handler(regs, esr) != DBG_HOOK_HANDLED;
> > #endif
> > + if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED)
> > + return 0;
>
> I think this just means we're not running debug_traps_init() early enough,
> and actually the KASAN early handler is unnecessary too.
>
> If we call debug_traps_init() directly from setup_arch() and drop the
> arch_initcall(), can we then drop early_brk64 entirely?
It seems to work in my testing. ...but the worry I have is the
comment right before trap_init(). It says:
/* This registration must happen early, before debug_traps_init(). */
By moving debug_traps_init() early we're violating that comment. Do I
just remove that comment, or was there a good reason for it? ...or am
I reading it wrong and I should have read it as if it said:
/* NOTE: this registration happens early, before debug_traps_init(). */
...then removing it is fine. Maybe that's right?
I coded this up and put it on the Chrome OS gerrit at
<https://crrev.com/c/2195061>. I'm happy to post this on the list as
a loner patch to replace this one or spin the whole series depending
on what people want.
-Doug
Powered by blists - more mailing lists