From patchwork Mon Jul 30 11:58:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 10361 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4229723E02 for ; Mon, 30 Jul 2012 12:01:47 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 10A82A18AD0 for ; Mon, 30 Jul 2012 12:01:46 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so4596899yhp.11 for ; Mon, 30 Jul 2012 05:01:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=9M8UIiuyucOjBhpEU9cK6Xz0uFSztS3cudFZhhFPyOg=; b=Ucuho8HyVySyfk5OP4UEll8x2p+axlnYyn+DhXnE+vfoQeFz7ku7dSEQeyOeUKYb5K mokt0WIc7pwWDbQfMu8pMH7e+EQ7Vu1B2yJ/Arz1R4/ROB1WQqO62CTItvUrGTvFHCc0 sw/t4Y/bBDxq3JYQ8u6mVtkudTr7B+iWN4xr3EB4uY88yLrcMUPvqV51EqIfVDjNcGQp RH/gDOBnlPDGIJ4KRx6HkVlvX92gXOYWd3eCY59YhrxG3/PwwstGT0bw/ele9/m4L3t8 eSY/4fC6jpeNzashlB9xLQvWjsfxOpvSkI2aSC5zjpkE7ndylsFxnpJxWAO3E8JVHkke 7nOQ== Received: by 10.50.160.168 with SMTP id xl8mr2710017igb.25.1343649706524; Mon, 30 Jul 2012 05:01:46 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.87.40 with SMTP id u8csp84584igz; Mon, 30 Jul 2012 05:01:45 -0700 (PDT) Received: by 10.100.244.7 with SMTP id r7mr3074607anh.23.1343649705165; Mon, 30 Jul 2012 05:01:45 -0700 (PDT) Received: from mail-gh0-f178.google.com (mail-gh0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id n64si8818116yhk.124.2012.07.30.05.01.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 05:01:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by ghbf1 with SMTP id f1so5357419ghb.37 for ; Mon, 30 Jul 2012 05:01:44 -0700 (PDT) Received: by 10.66.75.98 with SMTP id b2mr24056313paw.60.1343649704475; Mon, 30 Jul 2012 05:01:44 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id tq4sm7820441pbc.11.2012.07.30.05.01.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 05:01:44 -0700 (PDT) From: Anton Vorontsov To: Russell King , Jason Wessel , Greg Kroah-Hartman , Alan Cox Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Colin Cross , John Stultz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com, kgdb-bugreport@lists.sourceforge.net Subject: [PATCH 03/11] kdb: Implement disable_nmi command Date: Mon, 30 Jul 2012 04:58:12 -0700 Message-Id: <1343649500-18491-3-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20120730115719.GA5742@lizard> References: <20120730115719.GA5742@lizard> X-Gm-Message-State: ALoCoQncZRQSQLEBOYkHvfzycDINzOdkXVl7lrE+5zIhXEjEV7attlqiFgQIJsumNsCa2q4KgNQS This command disables NMI-entry. If NMI source was previously shared with a serial console ("debug port"), this effectively releases the port from KDB exclusive use, and makes the console available for normal use. Of course, NMI can be reenabled, enable_nmi modparam is used for that: echo 1 > /sys/module/kdb/parameters/enable_nmi Signed-off-by: Anton Vorontsov --- kernel/debug/kdb/kdb_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 3ee92a1..1e9f20e 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -2131,6 +2131,24 @@ static int kdb_dmesg(int argc, const char **argv) return 0; } #endif /* CONFIG_PRINTK */ + +static int kdb_disable_nmi(int argc, const char *argv[]) +{ + kgdb_arch_enable_nmi(0); + return 0; +} + +static int kdb_param_enable_nmi(const char *val, const struct kernel_param *kp) +{ + kgdb_arch_enable_nmi(1); + return 0; +} + +static const struct kernel_param_ops kdb_param_ops_enable_nmi = { + .set = kdb_param_enable_nmi, +}; +module_param_cb(enable_nmi, &kdb_param_ops_enable_nmi, NULL, 0600); + /* * kdb_cpu - This function implements the 'cpu' command. * cpu [] @@ -2873,6 +2891,8 @@ static void __init kdb_inittab(void) kdb_register_flags("dmesg", kdb_dmesg, "[lines]", "Display syslog buffer", 0, KDB_SAFE); #endif + kdb_register_flags("disable_nmi", kdb_disable_nmi, "", + "Disable NMI entry to KDB", 0, KDB_SAFE); kdb_register_flags("defcmd", kdb_defcmd, "name \"usage\" \"help\"", "Define a set of commands, down to endefcmd", 0, KDB_SAFE); kdb_register_flags("kill", kdb_kill, "<-signal> ",