From: Douglas Anderson <dianders@chromium.org> To: jason.wessel@windriver.com, daniel.thompson@linaro.org, gregkh@linuxfoundation.org Cc: corbet@lwn.net, frowand.list@gmail.com, bjorn.andersson@linaro.org, linux-serial@vger.kernel.org, mingo@redhat.com, hpa@zytor.com, jslaby@suse.com, kgdb-bugreport@lists.sourceforge.net, sumit.garg@linaro.org, will@kernel.org, tglx@linutronix.de, agross@kernel.org, catalin.marinas@arm.com, bp@alien8.de, Douglas Anderson <dianders@chromium.org>, Alexios Zavras <alexios.zavras@intel.com>, Allison Randal <allison@lohutok.net>, Dave Martin <Dave.Martin@arm.com>, Enrico Weigelt <info@metux.net>, "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-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 05/12] arm64: Add call_break_hook() to early_brk64() for early kgdb Date: Thu, 7 May 2020 13:08:43 -0700 [thread overview] Message-ID: <20200507130644.v4.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid> (raw) In-Reply-To: <20200507200850.60646-1-dianders@chromium.org> In order to make early kgdb work properly we need early_brk64() to be able to call into it. This is as easy as adding a call into call_break_hook() just like we do later in the normal brk_handler(). Once we do this we can let kgdb know that it can break into the debugger a little earlier (specifically when parsing early_param's). NOTE: without this patch it turns out that arm64 can't do breakpoints even at dbg_late_init(), so if we decide something about this patch is wrong we might need to move dbg_late_init() a little later. Signed-off-by: Douglas Anderson <dianders@chromium.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> --- Changes in v4: - Add "if KGDB" to "select ARCH_HAS_EARLY_DEBUG" in Kconfig. Changes in v3: - Change boolean weak function to KConfig. Changes in v2: None arch/arm64/Kconfig | 1 + arch/arm64/include/asm/debug-monitors.h | 2 ++ arch/arm64/kernel/debug-monitors.c | 2 +- arch/arm64/kernel/traps.c | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 40fb05d96c60..3d78f581269c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -13,6 +13,7 @@ config ARM64 select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI + select ARCH_HAS_EARLY_DEBUG if KGDB select ARCH_HAS_FAST_MULTIPLIER select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h index 7619f473155f..2d82a0314d29 100644 --- a/arch/arm64/include/asm/debug-monitors.h +++ b/arch/arm64/include/asm/debug-monitors.h @@ -97,6 +97,8 @@ void unregister_user_break_hook(struct break_hook *hook); void register_kernel_break_hook(struct break_hook *hook); void unregister_kernel_break_hook(struct break_hook *hook); +int call_break_hook(struct pt_regs *regs, unsigned int esr); + u8 debug_monitors_arch(void); enum dbg_active_el { 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; + return bug_handler(regs, esr) != DBG_HOOK_HANDLED; } -- 2.26.2.645.ge9eca65c58-goog
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: jason.wessel@windriver.com, daniel.thompson@linaro.org, gregkh@linuxfoundation.org Cc: Mark Rutland <mark.rutland@arm.com>, catalin.marinas@arm.com, bjorn.andersson@linaro.org, hpa@zytor.com, will@kernel.org, corbet@lwn.net, frowand.list@gmail.com, jinho lim <jordan.lim@samsung.com>, agross@kernel.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, Dave Martin <Dave.Martin@arm.com>, Masami Hiramatsu <mhiramat@kernel.org>, jslaby@suse.com, Alexios Zavras <alexios.zavras@intel.com>, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, Allison Randal <allison@lohutok.net>, sumit.garg@linaro.org, Douglas Anderson <dianders@chromium.org>, linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>, "Eric W. Biederman" <ebiederm@xmission.com>, Enrico Weigelt <info@metux.net> Subject: [PATCH v4 05/12] arm64: Add call_break_hook() to early_brk64() for early kgdb Date: Thu, 7 May 2020 13:08:43 -0700 [thread overview] Message-ID: <20200507130644.v4.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid> (raw) In-Reply-To: <20200507200850.60646-1-dianders@chromium.org> In order to make early kgdb work properly we need early_brk64() to be able to call into it. This is as easy as adding a call into call_break_hook() just like we do later in the normal brk_handler(). Once we do this we can let kgdb know that it can break into the debugger a little earlier (specifically when parsing early_param's). NOTE: without this patch it turns out that arm64 can't do breakpoints even at dbg_late_init(), so if we decide something about this patch is wrong we might need to move dbg_late_init() a little later. Signed-off-by: Douglas Anderson <dianders@chromium.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> --- Changes in v4: - Add "if KGDB" to "select ARCH_HAS_EARLY_DEBUG" in Kconfig. Changes in v3: - Change boolean weak function to KConfig. Changes in v2: None arch/arm64/Kconfig | 1 + arch/arm64/include/asm/debug-monitors.h | 2 ++ arch/arm64/kernel/debug-monitors.c | 2 +- arch/arm64/kernel/traps.c | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 40fb05d96c60..3d78f581269c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -13,6 +13,7 @@ config ARM64 select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI + select ARCH_HAS_EARLY_DEBUG if KGDB select ARCH_HAS_FAST_MULTIPLIER select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h index 7619f473155f..2d82a0314d29 100644 --- a/arch/arm64/include/asm/debug-monitors.h +++ b/arch/arm64/include/asm/debug-monitors.h @@ -97,6 +97,8 @@ void unregister_user_break_hook(struct break_hook *hook); void register_kernel_break_hook(struct break_hook *hook); void unregister_kernel_break_hook(struct break_hook *hook); +int call_break_hook(struct pt_regs *regs, unsigned int esr); + u8 debug_monitors_arch(void); enum dbg_active_el { 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; + return bug_handler(regs, esr) != DBG_HOOK_HANDLED; } -- 2.26.2.645.ge9eca65c58-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-05-07 20:09 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-07 20:08 [PATCH v4 00/12] kgdb: Support late serial drivers; enable early debug w/ boot consoles Douglas Anderson 2020-05-07 20:08 ` Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 01/12] kgdb: Disable WARN_CONSOLE_UNLOCKED for all kgdb Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 02/12] Revert "kgdboc: disable the console lock when in kgdb" Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 03/12] kgdboc: Use a platform device to handle tty drivers showing up late Douglas Anderson 2020-05-18 16:46 ` Daniel Thompson 2020-05-07 20:08 ` [PATCH v4 04/12] kgdb: Delay "kgdbwait" to dbg_late_init() by default Douglas Anderson 2020-05-15 16:18 ` Daniel Thompson 2020-05-07 20:08 ` Douglas Anderson [this message] 2020-05-07 20:08 ` [PATCH v4 05/12] arm64: Add call_break_hook() to early_brk64() for early kgdb Douglas Anderson 2020-05-13 23:12 ` Doug Anderson 2020-05-13 23:12 ` Doug Anderson 2020-05-07 20:08 ` [PATCH v4 06/12] kgdb: Prevent infinite recursive entries to the debugger Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 07/12] kgdboc: Remove useless #ifdef CONFIG_KGDB_SERIAL_CONSOLE in kgdboc Douglas Anderson 2020-05-11 16:02 ` Daniel Thompson 2020-05-07 20:08 ` [PATCH v4 08/12] kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 09/12] Documentation: kgdboc: Document new kgdboc_earlycon parameter Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 10/12] serial: qcom_geni_serial: Support kgdboc_earlycon Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 11/12] serial: 8250_early: " Douglas Anderson 2020-05-07 20:08 ` [PATCH v4 12/12] serial: amba-pl011: " Douglas Anderson 2020-05-14 16:21 ` [PATCH v4 00/12] kgdb: Support late serial drivers; enable early debug w/ boot consoles Daniel Thompson 2020-05-14 16:21 ` Daniel Thompson 2020-05-14 16:34 ` Doug Anderson 2020-05-14 16:34 ` Doug Anderson 2020-05-14 16:36 ` Greg Kroah-Hartman 2020-05-14 16:36 ` Greg Kroah-Hartman 2020-05-19 10:37 ` Daniel Thompson 2020-05-19 10:37 ` Daniel Thompson 2020-05-19 10:36 ` Daniel Thompson 2020-05-19 10:36 ` Daniel Thompson
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=20200507130644.v4.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid \ --to=dianders@chromium.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=ebiederm@xmission.com \ --cc=frowand.list@gmail.com \ --cc=gregkh@linuxfoundation.org \ --cc=hpa@zytor.com \ --cc=info@metux.net \ --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 \ --cc=will@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.