linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Jason Wessel <jason.wessel@windriver.com>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Gross <agross@kernel.org>,
	kgdb-bugreport@lists.sourceforge.net,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-serial@vger.kernel.org, Sumit Garg <sumit.garg@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Frank Rowand <frowand.list@gmail.com>,
	bp@alien8.de, Bjorn Andersson <bjorn.andersson@linaro.org>,
	Jiri Slaby <jslaby@suse.com>,
	Alexios Zavras <alexios.zavras@intel.com>,
	Allison Randal <allison@lohutok.net>,
	Dave Martin <Dave.Martin@arm.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	James Morse <james.morse@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	jinho lim <jordan.lim@samsung.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 05/11] arm64: Add call_break_hook() to early_brk64() for early kgdb
Date: Tue, 12 May 2020 08:35:53 +0100	[thread overview]
Message-ID: <20200512073552.GA1538@willie-the-truck> (raw)
In-Reply-To: <CAD=FV=W1F-B7SUwxebhhH2HS+fN4sYv4RHvvKud5a+00J0T=SA@mail.gmail.com>

On Mon, May 11, 2020 at 03:45:02PM -0700, Doug Anderson wrote:
> On Mon, May 11, 2020 at 7:59 AM Will Deacon <will@kernel.org> wrote:
> > 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(). */

I /think/ the reason for this is because debug_traps_init() replaces the
BRK vector, so if that runs before the break hooks have been registered
for e.g. BUG() then BUG() won't work during that window. Hmm, so dropping
early_brk64 is problematic after all. Damn.

Is trap_init() early enough for you? If so, we could call debug_traps_init()
from traps_init() after registering the break hooks.

Will

  reply	other threads:[~2020-05-12  7:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 21:13 [PATCH v3 00/11] kgdb: Support late serial drivers; enable early debug w/ boot consoles Douglas Anderson
2020-04-28 21:13 ` [PATCH v3 01/11] kgdb: Disable WARN_CONSOLE_UNLOCKED for all kgdb Douglas Anderson
2020-04-28 21:13 ` [PATCH v3 02/11] Revert "kgdboc: disable the console lock when in kgdb" Douglas Anderson
2020-04-28 21:13 ` [PATCH v3 03/11] kgdboc: Use a platform device to handle tty drivers showing up late Douglas Anderson
2020-04-28 21:13 ` [PATCH v3 04/11] kgdb: Delay "kgdbwait" to dbg_late_init() by default Douglas Anderson
2020-04-30 15:49   ` Daniel Thompson
2020-04-30 16:35     ` Doug Anderson
2020-05-04 14:43       ` [Kgdb-bugreport] " Daniel Thompson
2020-04-28 21:13 ` [PATCH v3 05/11] arm64: Add call_break_hook() to early_brk64() for early kgdb Douglas Anderson
2020-05-11 14:59   ` Will Deacon
2020-05-11 22:45     ` Doug Anderson
2020-05-12  7:35       ` Will Deacon [this message]
2020-05-12 15:27         ` Doug Anderson
2020-05-13  6:17           ` Will Deacon
2020-05-13 23:08             ` Doug Anderson
2020-04-28 21:13 ` [PATCH v3 06/11] kgdb: Prevent infinite recursive entries to the debugger Douglas Anderson
2020-04-30 16:52   ` Daniel Thompson
2020-04-28 21:13 ` [PATCH v3 07/11] kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles Douglas Anderson
2020-05-04 14:13   ` Daniel Thompson
2020-04-28 21:13 ` [PATCH v3 08/11] Documentation: kgdboc: Document new kgdboc_earlycon parameter Douglas Anderson
2020-05-04 14:40   ` Daniel Thompson
2020-04-28 21:13 ` [PATCH v3 09/11] serial: qcom_geni_serial: Support kgdboc_earlycon Douglas Anderson
2020-04-28 21:13 ` [PATCH v3 10/11] serial: 8250_early: " Douglas Anderson
2020-04-28 21:13 ` [PATCH v3 11/11] serial: amba-pl011: " Douglas Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512073552.GA1538@willie-the-truck \
    --to=will@kernel.org \
    --cc=Dave.Martin@arm.com \
    --cc=agross@kernel.org \
    --cc=alexios.zavras@intel.com \
    --cc=allison@lohutok.net \
    --cc=bjorn.andersson@linaro.org \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=daniel.thompson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=ebiederm@xmission.com \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=jason.wessel@windriver.com \
    --cc=jordan.lim@samsung.com \
    --cc=jslaby@suse.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=sumit.garg@linaro.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).