Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443744 > unrolled thread

Re: [PATCH -v4 1/2] ratelimit: Extend to print suppressed messages on release

Started byAndrew Morton <akpm@linux-foundation.org>
First post2016-07-14 22:30 +0200
Last post2016-07-15 06:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH -v4 1/2] ratelimit: Extend to print suppressed messages  on release Andrew Morton <akpm@linux-foundation.org> - 2016-07-14 22:30 +0200
    Re: [PATCH -v4 1/2] ratelimit: Extend to print suppressed messages  on release Borislav Petkov <bp@alien8.de> - 2016-07-15 06:10 +0200

#1443744 — Re: [PATCH -v4 1/2] ratelimit: Extend to print suppressed messages on release

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-07-14 22:30 +0200
SubjectRe: [PATCH -v4 1/2] ratelimit: Extend to print suppressed messages on release
Message-ID<rUVqG-5SB-29@gated-at.bofh.it>
On Fri,  8 Jul 2016 11:18:49 +0200 Borislav Petkov <bp@alien8.de> wrote:

> From: Borislav Petkov <bp@suse.de>
> 
> Extend the ratelimiting facility to print the amount of suppressed lines
> when it is being released.

Why?  What's driving this?  What are the benefits to our users?  Are
there any downsides or back-compatibility issues?

I see from the code that this is not actually enabled by default.  The
client code must use ratelimit_set_flags() to select this behaviour,
and the second patch uses this.  Please include all such info in the
changelog.

> Separated from a previous patch by Linus.
> 
> Also, make the ON_RELEASE image not use "callbacks" as it is misleading.

"image"?

I don't understand this sentence.  What's misleading about what?  Much
more detail please.

>
> ...
>
> --- a/lib/ratelimit.c
> +++ b/lib/ratelimit.c
> @@ -46,12 +46,14 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
>  		rs->begin = jiffies;
>  
>  	if (time_is_before_jiffies(rs->begin + rs->interval)) {
> -		if (rs->missed)
> -			printk(KERN_WARNING "%s: %d callbacks suppressed\n",
> -				func, rs->missed);
> +		if (rs->missed) {
> +			if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
> +				pr_warn("%s: %d callbacks suppressed\n", func, rs->missed);
> +				rs->missed = 0;
> +			}
> +		}

hm, what's the difference between an output line being suppressed and a
callback being suppressed?  I think I've forgotten how this code works ;)

>  		rs->begin   = jiffies;
>  		rs->printed = 0;
> -		rs->missed  = 0;
>  	}
>  	if (rs->burst && rs->burst > rs->printed) {
>  		rs->printed++;

[toc] | [next] | [standalone]


#1443929

FromBorislav Petkov <bp@alien8.de>
Date2016-07-15 06:10 +0200
Message-ID<rV2BP-25M-5@gated-at.bofh.it>
In reply to#1443744
Hi Andrew,

thanks for taking a look.

On Thu, Jul 14, 2016 at 01:29:36PM -0700, Andrew Morton wrote:
> Why?  What's driving this?  What are the benefits to our users?  Are
> there any downsides or back-compatibility issues?
> 
> I see from the code that this is not actually enabled by default.  The
> client code must use ratelimit_set_flags() to select this behaviour,
> and the second patch uses this.  Please include all such info in the
> changelog.

How about:

"This use case is aimed at short-termed, burst-like users of the
ratelimiting facility for which we want to output the suppressed lines
stats only once, after it has been disposed of. For an example, see
usage in /dev/kmsg."

?

> > Separated from a previous patch by Linus.
> > 
> > Also, make the ON_RELEASE image not use "callbacks" as it is misleading.
> 
> "image"?

Bah, it should say

"Also, change the printk line we issue on release to not use "callbacks"
as it is misleading. We're not suppressing callbacks but printk calls."

> > @@ -46,12 +46,14 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
> >  		rs->begin = jiffies;
> >  
> >  	if (time_is_before_jiffies(rs->begin + rs->interval)) {
> > -		if (rs->missed)
> > -			printk(KERN_WARNING "%s: %d callbacks suppressed\n",
> > -				func, rs->missed);
> > +		if (rs->missed) {
> > +			if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
> > +				pr_warn("%s: %d callbacks suppressed\n", func, rs->missed);
> > +				rs->missed = 0;
> > +			}
> > +		}
> 
> hm, what's the difference between an output line being suppressed and a
> callback being suppressed?  I think I've forgotten how this code works ;)

Right, ___ratelimit() gets as @func arg the name of the current calling
function:

#define __ratelimit(state) ___ratelimit(state, __func__)

I'm strongly assuming this is the "callback" ___ratelimit() is talking
about :-)

In our case, we don't have callbacks but /dev/kmsg users and I thought
the most generic way of referring to them would be by not doing so at
all but simply talking about output lines being suppressed.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web