From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751669AbcBBCBg (ORCPT ); Mon, 1 Feb 2016 21:01:36 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35070 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbcBBCBe (ORCPT ); Mon, 1 Feb 2016 21:01:34 -0500 MIME-Version: 1.0 In-Reply-To: <20160201205810.59250879@grimm.local.home> References: <1454369752-20706-1-git-send-email-jeffmerkey@gmail.com> <1454369752-20706-4-git-send-email-jeffmerkey@gmail.com> <20160201205810.59250879@grimm.local.home> Date: Mon, 1 Feb 2016 19:01:33 -0700 Message-ID: Subject: Re: [PATCH v4 4/4] pr_emerg add WARN_XX() debugger options From: Jeffrey Merkey To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Jason@zx2c4.com, aconole@redhat.com, akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, linus.walleij@linaro.org, nicolas.iooss_linux@m4x.org, pmladek@suse.com, tj@kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/16, Steven Rostedt wrote: > On Mon, 1 Feb 2016 16:35:52 -0700 > Jeffrey Merkey wrote: >> --- >> include/linux/printk.h | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/include/linux/printk.h b/include/linux/printk.h >> index 51dd6b8..dcfb270 100644 >> --- a/include/linux/printk.h >> +++ b/include/linux/printk.h >> @@ -252,8 +252,16 @@ extern asmlinkage void dump_stack(void) __cold; >> * and other debug macros are compiled out unless either DEBUG is >> defined >> * or CONFIG_DYNAMIC_DEBUG is set. >> */ >> +#ifdef CONFIG_DEBUG_WARN >> +#define pr_emerg(fmt, ...) \ >> +({ \ >> + printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__); \ >> + BUG(); \ > > This look rather heavy handed for a debug feature. This will crash any > kernel on a pr-emerg(), similar to a panic on warning. Not only that, > for cases that cal pr_emerg() more than once, it crashes on the first > instance. > > What about adding a condition that can be set set in /proc/sys/kernel/ > A file called something like crash_on_print_emerg ? > > BUG_ON(crash_on_pr_emerg); > > -- Steve > If a debugger is loaded it will not crash, just enter the debugger. But yes, it will int3 if set and no debugger has been loaded to handle the int3 condition. Hmmm. Maybe its better just to skip calling pr_emerg and put this logic as a single call somewhere else. Jeff