From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbcGNU3k (ORCPT ); Thu, 14 Jul 2016 16:29:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41730 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751229AbcGNU3h (ORCPT ); Thu, 14 Jul 2016 16:29:37 -0400 Date: Thu, 14 Jul 2016 13:29:36 -0700 From: Andrew Morton To: Borislav Petkov Cc: LKML , Franck Bui , Greg Kroah-Hartman , Ingo Molnar , Linus Torvalds , Peter Zijlstra , Steven Rostedt , Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= Subject: Re: [PATCH -v4 1/2] ratelimit: Extend to print suppressed messages on release Message-Id: <20160714132936.e04a3ca668b67f3afb0a88c0@linux-foundation.org> In-Reply-To: <1467969530-5215-2-git-send-email-bp@alien8.de> References: <1467969530-5215-1-git-send-email-bp@alien8.de> <1467969530-5215-2-git-send-email-bp@alien8.de> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Jul 2016 11:18:49 +0200 Borislav Petkov wrote: > From: Borislav Petkov > > 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++;