Re: [PATCH V2] kernel, add bug_on_warn

From: Prarit Bhargava
Date: Mon Nov 03 2014 - 08:44:30 EST




On 10/30/2014 08:25 PM, Rusty Russell wrote:
> Prarit Bhargava <prarit@xxxxxxxxxx> writes:
>> On 10/22/2014 12:27 AM, Rusty Russell wrote:
>>> Prarit Bhargava <prarit@xxxxxxxxxx> writes:
>>>> There have been several times where I have had to rebuild a kernel to
>>>> cause a panic when hitting a WARN() in the code in order to get a crash
>>>> dump from a system. Sometimes this is easy to do, other times (such as
>>>> in the case of a remote admin) it is not trivial to send new images to the
>>>> user.
>>>
>>> What about during early boot?
>>
>> Hi Rusty,
>>
>> I really don't have a use case for this in early boot. The kernel boots, the
>> initramfs, and then we run whatever init (systemd in my case). A systemd script
>> configures kexec for kdump and that point kdump is "armed". Doing a bug_on_warn
>> before this will simply result in a panicked system. I don't get any "new"
>> information FWIW as I get a stack trace, etc., in both the WARN() and BUG() cases.
>>
>>>
>>> I'd recommend you use core_param(). Less code, and can be set on
>>> commandline.

Yeah, I was just starting to do this and then I saw Hedi's comment about
disabling panic_on_warn during kdump to avoid a situation where the kdump kernel
bogus panics on a warn.

So that makes the setup function look like:

static int __init panic_on_warn_setup(char *s)
{
/* Enabling this on a kdump kernel could cause a bogus panic. */
if (!is_kdump_kernel())
panic_on_warn = 1;
return 0;
}
early_param("panic_on_warn", panic_on_warn_setup);

... so I dunno if core_param would work here :(. It would have been nice if it did.

P.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/