From patchwork Thu May 29 08:48:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 31108 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 168DC20068 for ; Thu, 29 May 2014 08:49:10 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 19sf69639ykq.4 for ; Thu, 29 May 2014 01:49:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=gTh0Q0sAJcfodQEL0w9sfe9AIV9gMPoQcx4COnvrVJg=; b=VtkxKgORMH/0uxhZ0OYvA8hHQ4piq+RsOgRtA92AQGXuDIwPW97/PPn8Kv/mZ6kKy7 tgYXWwjFP8Rg6Aphkiyxouaq9jjOZ27VoLP6Z9Om3sIeQTNrtF2THaKFRuQ1a9sWpHVl QtaPLJx69ikQ0yUqfECsxsS0fXWtcwzbRorEOZMQuBr5rJzMXoFv5LgONhCWLmA+0jnz ZQ0jxSCsc/7b0CRsUkZL1bfev4kqDCPGZHqIDpPcekjLd1xPDKqTvhKz2G8sxYEr+gtk BLEHDnS8RuBRHEjw2sUs/pMBuHCsyrjioVYiY44f7aIFAfAsxQ1q8BAFLFyT6e793d11 w3jA== X-Gm-Message-State: ALoCoQkmEansxn/rUJhwp5cT0K9DAnUpUKEcvGreTARMCE5tgEaFzSvDaHtcGsu/4WcWSMfTPC77 X-Received: by 10.58.18.200 with SMTP id y8mr2446182ved.20.1401353349795; Thu, 29 May 2014 01:49:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls480042qgx.9.gmail; Thu, 29 May 2014 01:49:09 -0700 (PDT) X-Received: by 10.58.246.132 with SMTP id xw4mr5370437vec.2.1401353349692; Thu, 29 May 2014 01:49:09 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sb3si8782vdc.24.2014.05.29.01.49.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 01:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id hy4so26308vcb.25 for ; Thu, 29 May 2014 01:49:09 -0700 (PDT) X-Received: by 10.58.201.5 with SMTP id jw5mr5190152vec.6.1401353349621; Thu, 29 May 2014 01:49:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp11323vcb; Thu, 29 May 2014 01:49:08 -0700 (PDT) X-Received: by 10.180.100.41 with SMTP id ev9mr57997863wib.22.1401353348488; Thu, 29 May 2014 01:49:08 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by mx.google.com with ESMTPS id b2si19390580wik.18.2014.05.29.01.49.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 01:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by mail-wi0-f171.google.com with SMTP id cc10so5196282wib.10 for ; Thu, 29 May 2014 01:49:07 -0700 (PDT) X-Received: by 10.180.106.1 with SMTP id gq1mr57762169wib.45.1401353346655; Thu, 29 May 2014 01:49:06 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id k2sm40794wjq.20.2014.05.29.01.49.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 May 2014 01:49:05 -0700 (PDT) From: Daniel Thompson To: Greg Kroah-Hartman Cc: Daniel Thompson , linux-serial@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, John Stultz , Anton Vorontsov , Colin Cross , kernel-team@android.com, Jason Wessel , kgdb-bugreport@lists.sourceforge.net, Jiri Slaby , Dirk Behme Subject: [PATCH tty-next v2 4/4] serial: kgdb_nmi: Improve console integration with KDB I/O Date: Thu, 29 May 2014 09:48:46 +0100 Message-Id: <1401353326-14148-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1401353326-14148-1-git-send-email-daniel.thompson@linaro.org> References: <20140528200344.GA2750@kroah.com> <1401353326-14148-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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,