[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.11.1406241201180.16842@knanqh.ubzr>
Date: Tue, 24 Jun 2014 12:22:50 -0400 (EDT)
From: Nicolas Pitre <nicolas.pitre@...aro.org>
To: Daniel Thompson <daniel.thompson@...aro.org>
cc: Russell King <linux@....linux.org.uk>,
Anton Vorontsov <anton.vorontsov@...aro.org>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
kgdb-bugreport@...ts.sourceforge.net, patches@...aro.org,
linaro-kernel@...ts.linaro.org,
John Stultz <john.stultz@...aro.org>,
Colin Cross <ccross@...roid.com>, kernel-team@...roid.com,
Rob Herring <robherring2@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
Ben Dooks <ben.dooks@...ethink.co.uk>,
Catalin Marinas <catalin.marinas@....com>,
Dave Martin <Dave.Martin@....com>,
Fabio Estevam <festevam@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH v6 4/4] ARM: Add KGDB/KDB FIQ debugger generic code
On Tue, 24 Jun 2014, Daniel Thompson wrote:
> From: Anton Vorontsov <anton.vorontsov@...aro.org>
>
> The FIQ debugger may be used to debug situations when the kernel stuck
> in uninterruptable sections, e.g. the kernel infinitely loops or
> deadlocked in an interrupt or with interrupts disabled.
>
> By default KGDB FIQ is disabled in runtime, but can be enabled with
> kgdb_fiq.enable=1 kernel command line option.
>
> Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
> Signed-off-by: John Stultz <john.stultz@...aro.org>
> Signed-off-by: Daniel Thompson <daniel.thompson@...aro.org>
> Cc: Russell King <linux@....linux.org.uk>
> Cc: Ben Dooks <ben.dooks@...ethink.co.uk>
> Cc: Dave Martin <Dave.Martin@....com>
> ---
> arch/arm/Kconfig | 2 +
> arch/arm/Kconfig.debug | 18 ++++++
> arch/arm/include/asm/kgdb.h | 7 +++
> arch/arm/kernel/Makefile | 1 +
> arch/arm/kernel/kgdb_fiq.c | 124 +++++++++++++++++++++++++++++++++++++++
> arch/arm/kernel/kgdb_fiq_entry.S | 87 +++++++++++++++++++++++++++
> 6 files changed, 239 insertions(+)
> create mode 100644 arch/arm/kernel/kgdb_fiq.c
> create mode 100644 arch/arm/kernel/kgdb_fiq_entry.S
[...]
> +static long kgdb_fiq_setup_stack(void *info)
> +{
> + struct pt_regs regs;
> +
> + regs.ARM_sp = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER) +
> + THREAD_START_SP;
> + WARN_ON(!regs.ARM_sp);
Isn't this rather fatal if you can't allocate any stack? Why not using
BUG_ON(), or better yet propagate a proper error code back?
> +
> + set_fiq_regs(®s);
> + return 0;
> +}
> +
> +/**
> + * kgdb_fiq_enable_nmi - Manage NMI-triggered entry to KGDB
> + * @on: Flag to either enable or disable an NMI
> + *
> + * This function manages NMIs that usually cause KGDB to enter. That is, not
> + * all NMIs should be enabled or disabled, but only those that issue
> + * kgdb_handle_exception().
> + *
> + * The call counts disable requests, and thus allows to nest disables. But
> + * trying to enable already enabled NMI is an error.
> + */
> +static void kgdb_fiq_enable_nmi(bool on)
> +{
> + static atomic_t cnt;
> + int ret;
> +
> + ret = atomic_add_return(on ? 1 : -1, &cnt);
> + if (ret > 1 && on) {
> + /*
> + * There should be only one instance that calls this function
> + * in "enable, disable" order. All other users must call
> + * disable first, then enable. If not, something is wrong.
> + */
> + WARN_ON(1);
> + return;
> + }
Minor style suggestion:
/*
* There should be only one instance that calls this function
* in "enable, disable" order. All other users must call
* disable first, then enable. If not, something is wrong.
*/
if (WARN_ON(ret > 1 && on))
return;
Other than that...
Acked-by: Nicolas Pitre <nico@...aro.org>
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists