Re: [PATCH 1/2] panic: ratelimit panic messages

From: Dave Young
Date: Sat Jan 15 2011 - 03:29:28 EST


On Thu, Jan 6, 2011 at 6:51 AM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Â4 Jan 2011 22:38:30 -0500
> Don Zickus <dzickus@xxxxxxxxxx> wrote:
>
>> Sometimes when things go bad, so much spew is coming on the console it is hard
>> to figure out what happened. ÂThis patch allows you to ratelimit the panic
>> messages with the intent that the first panic message will provide the info
>> we need to figure out what happened.
>>
>> Adds new kernel param 'panic_ratelimit=on/<integer in seconds>'
>>
>
> Terminological whinge: panic() is a specific kernel API which ends up
> doing a sort-of-oops thing. ÂSo the graph is
>
>    Âpanic      -> oops
>    Âother-things  Â-> oops
>
> Your patch doesn't affect only panics - it also affects oops, BUG(),
> etc. ÂSo I'd suggest that this patch should do s/panic/oops/g.
>
>> ---
>> ÂDocumentation/kernel-parameters.txt | Â Â6 ++++++
>> Âkernel/panic.c           Â|  30 ++++++++++++++++++++++++++++++
>> Â2 files changed, 36 insertions(+), 0 deletions(-)
>>
>> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
>> index 316c723..1416964 100644
>> --- a/Documentation/kernel-parameters.txt
>> +++ b/Documentation/kernel-parameters.txt
>> @@ -1807,6 +1807,12 @@ and is between 256 and 4096 characters. It is defined in the file
>> Â Â Â panic= Â Â Â Â Â[KNL] Kernel behaviour on panic
>> Â Â Â Â Â Â Â Â Â Â Â Format: <timeout>
>>
>> + Â Â panic_ratelimit= Â Â Â Â[KNL] ratelimit the panic messages
>> + Â Â Â Â Â Â Â Â Â Â Useful for slowing down multiple panics to capture
>> + Â Â Â Â Â Â Â Â Â Â the first one before it scrolls off the screen
>> + Â Â Â Â Â Â Â Â Â Â Format: "on" or some integer in seconds
>> + Â Â Â Â Â Â Â Â Â Â "on" defaults to 10 minutes
>> +
>
> We keep on hacking away at this and things never seem to get much
> better. ÂIt's still the case that a large number of our oops reports
> are damaged because the important parts of the oops trace scrolled off
> the screen.
>
> I therefore propose
>
> Â Â Â Âoops_lines_delay=N,M
>
> which will cause the kernel to pause for M milliseconds after emitting
> N lines of oops output. ÂBonus marks for handling linewrap!

I ever try to do similar things to printk_delay, something like
printk_lines_delay,
or give printk_delay one more parameter of lines.

What do you think about this approach?

>
> Start the line counter at oops_begin() or thereabouts and then do the
> delay after N lines have been emitted. ÂI guess that counter should
> _not_ be invalidated in oops_end(): if the oops generates 12 lines and
> then another 100 lines of random printk crap are printed, we still want
> to put a pause after the 13th line of that random crap, so we can view
> the oops.
>
> The oops_lines_delay implemetnation should count lines from all CPUs
> and should block all CPUs during the delay.
>
> I think this would solve the problem which you're seeing, as well as
> the much larger my-oops-scrolled-off problem?
>
> --
> 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/
>



--
Regards
dave
--
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/