[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200601135244.al7rtetn6o4bolgs@holly.lan>
Date: Mon, 1 Jun 2020 14:52:44 +0100
From: Daniel Thompson <daniel.thompson@...aro.org>
To: Douglas Anderson <dianders@...omium.org>
Cc: Jason Wessel <jason.wessel@...driver.com>, sumit.garg@...aro.org,
akashast@...eaurora.org, mka@...omium.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
kgdb-bugreport@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kgdb: Don't call the deinit under spinlock
On Tue, May 26, 2020 at 02:20:06PM -0700, Douglas Anderson wrote:
> When I combined kgdboc_earlycon with an inflight patch titled ("soc:
> qcom-geni-se: Add interconnect support to fix earlycon crash") [1]
> things went boom. Specifically I got a crash during the transition
> between kgdboc_earlycon and the main kgdboc that looked like this:
>
> Call trace:
> <snip>
> ...
>
> The problem was that we were holding the "kgdb_registration_lock"
> while calling into code that didn't expect to be called in spinlock
> context.
>
> Let's slightly defer when we call the deinit code so that it's not
> done under spinlock.
>
> NOTE: this does mean that the "deinit" call of the old kgdb IO module
> is now made _after_ the init of the new IO module, but presumably
> that's OK.
>
> [1] https://lkml.kernel.org/r/1588919619-21355-3-git-send-email-akashast@codeaurora.org
>
> Fixes: 220995622da5 ("kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles")
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
Just found this in my inbox... which suggested I forgot to post an
"Applied" last week when I pushed it for linux-next.
Expect the kgdb PR for this cycle shortly!
Daniel.
> ---
>
> kernel/debug/debug_core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
> index 4d59aa907fdc..ef94e906f05a 100644
> --- a/kernel/debug/debug_core.c
> +++ b/kernel/debug/debug_core.c
> @@ -1089,7 +1089,6 @@ int kgdb_register_io_module(struct kgdb_io *new_dbg_io_ops)
> }
> pr_info("Replacing I/O driver %s with %s\n",
> old_dbg_io_ops->name, new_dbg_io_ops->name);
> - old_dbg_io_ops->deinit();
> }
>
> if (new_dbg_io_ops->init) {
> @@ -1104,8 +1103,10 @@ int kgdb_register_io_module(struct kgdb_io *new_dbg_io_ops)
>
> spin_unlock(&kgdb_registration_lock);
>
> - if (old_dbg_io_ops)
> + if (old_dbg_io_ops) {
> + old_dbg_io_ops->deinit();
> return 0;
> + }
>
> pr_info("Registered I/O driver %s\n", new_dbg_io_ops->name);
>
> --
> 2.27.0.rc0.183.gde8f92d652-goog
>
Powered by blists - more mailing lists