From: Daniel Thompson <daniel.thompson@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-serial@vger.kernel.org
Cc: patches@linaro.org, linaro-kernel@lists.linaro.org,
Daniel Thompson <daniel.thompson@linaro.org>,
linux-kernel@vger.kernel.org,
John Stultz <john.stultz@linaro.org>,
Anton Vorontsov <anton.vorontsov@linaro.org>,
Colin Cross <ccross@android.com>,
kernel-team@android.com,
Jason Wessel <jason.wessel@windriver.com>,
kgdb-bugreport@lists.sourceforge.net, Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 4/4] serial: kgdb_nmi: Improve console integration with KDB I/O
Date: Wed, 14 May 2014 15:55:35 +0100 [thread overview]
Message-ID: <1400079335-32125-5-git-send-email-daniel.thompson@linaro.org> (raw)
In-Reply-To: <1400079335-32125-1-git-send-email-daniel.thompson@linaro.org>
kgdb_nmi_tty_enabled is used for two unrelated purposes, namely to
suppress normal TTY input handling and to suppress console output
(although it has no effect at all on TTY output). A much better way to
handle muting the console is to not have to mute it in the first place!
That's what this patch does.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
---
drivers/tty/serial/kgdb_nmi.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index 20d21d0..cfadf29 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -44,13 +44,22 @@ MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)");
static bool kgdb_nmi_tty_enabled;
+static int kgdb_nmi_console_setup(struct console *co, char *options)
+{
+ /* The NMI console uses the dbg_io_ops to issue console messages. To
+ * avoid duplicate messages during kdb sessions we must inform kdb's
+ * I/O utilities that messages sent to the console will automatically
+ * be displayed on the dbg_io.
+ */
+ dbg_io_ops->is_console = true;
+
+ return 0;
+}
+
static void kgdb_nmi_console_write(struct console *co, const char *s, uint c)
{
int i;
- if (!kgdb_nmi_tty_enabled || atomic_read(&kgdb_active) >= 0)
- return;
-
for (i = 0; i < c; i++)
dbg_io_ops->write_char(s[i]);
}
@@ -65,6 +74,7 @@ static struct tty_driver *kgdb_nmi_console_device(struct console *co, int *idx)
static struct console kgdb_nmi_console = {
.name = "ttyNMI",
+ .setup = kgdb_nmi_console_setup,
.write = kgdb_nmi_console_write,
.device = kgdb_nmi_console_device,
.flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED,
--
1.9.0
prev parent reply other threads:[~2014-05-14 14:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 14:55 [PATCH 0/4] serial: kgdb_nmi: Allow ttyNMIX to act as primary console Daniel Thompson
2014-05-14 14:55 ` [PATCH 1/4] serial: core: Consistent LF handling for poll_put_char Daniel Thompson
2014-05-14 15:08 ` Jason Wessel
2014-05-15 11:06 ` Daniel Thompson
2014-05-28 20:03 ` Greg Kroah-Hartman
2014-05-29 8:48 ` [PATCH tty-next v2 0/4] serial: kgdb_nmi: Allow ttyNMIX to act as primary console Daniel Thompson
2014-05-29 8:48 ` [PATCH tty-next v2 1/4] serial: cpm_uart: No LF conversion in put_poll_char() Daniel Thompson
2014-05-29 8:48 ` [PATCH tty-next v2 2/4] serial: kgdb_nmi: Use container_of() to locate private data Daniel Thompson
2014-05-29 8:48 ` [PATCH tty-next v2 3/4] serial: kgdb_nmi: Switch from tasklets to real timers Daniel Thompson
2014-05-29 8:48 ` [PATCH tty-next v2 4/4] serial: kgdb_nmi: Improve console integration with KDB I/O Daniel Thompson
2014-05-14 14:55 ` [PATCH 2/4] serial: kgdb_nmi: Use container_of() to locate private data Daniel Thompson
2014-05-14 14:55 ` [PATCH 3/4] serial: kgdb_nmi: Switch from tasklets to real timers Daniel Thompson
2014-05-14 14:55 ` Daniel Thompson [this message]
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=1400079335-32125-5-git-send-email-daniel.thompson@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=anton.vorontsov@linaro.org \
--cc=ccross@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=jason.wessel@windriver.com \
--cc=john.stultz@linaro.org \
--cc=jslaby@suse.cz \
--cc=kernel-team@android.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=patches@linaro.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: 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).