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: 1254411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id CB178DF24C for ; Mon, 30 Jul 2012 12:16:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Svooe-00086b-KR; Mon, 30 Jul 2012 12:11:18 +0000 Received: from mail-gg0-f177.google.com ([209.85.161.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Svofe-0006Gg-0m for linux-arm-kernel@lists.infradead.org; Mon, 30 Jul 2012 12:01:59 +0000 Received: by ggcs5 with SMTP id s5so4795688ggc.36 for ; Mon, 30 Jul 2012 05:01:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=9M8UIiuyucOjBhpEU9cK6Xz0uFSztS3cudFZhhFPyOg=; b=E1G8lGbskfUn/fNtp1uufqNnW4FWeqfBlu5SXNOGoEf+Qv0HFmUYYRKPMv6JRKB4Ck rmXCObqVj8zhqSlWkfiHfaiwzzeEPexf9JWPJ0EJmQir7Mjae32+ALpWHfuhGoF93wP9 1uBU+vUxFvBEOWQY0x3HKXGPtv+tTQ+xB7c7EFi32jkBb66eTpz04lxS7QvQ04Bn2Enn j5nW8/GHkznG6yNUFYJfGzqmQtkbbbY0gdddBV8xKtZSi5P0mtJ0PxXzHLDuaz20awai hmGPzP2uSC8IPlAMp7pXf4jsDDsyMKb9XQ/cmaSUo3uVCfmD2YqyjAfT44L79dGnpc3h pqpg== 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 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: ALoCoQnzdHpCntOT1rGya8WUmA7IkEQF2JCsNnPbj9drWGVT5GuuAnecdonczM/IMtsCqgUq/Twp X-Spam-Note: CRM114 invocation failed X-Spam-Note: SpamAssassin invocation failed Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , John Stultz , Colin Cross , kernel-team@android.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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> ",