From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbcGPKoi (ORCPT ); Sat, 16 Jul 2016 06:44:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46646 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbcGPKoe (ORCPT ); Sat, 16 Jul 2016 06:44:34 -0400 Date: Sat, 16 Jul 2016 18:44:25 +0800 From: Dave Young To: Borislav Petkov Cc: Andrew Morton , 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 2/2] printk: Add kernel parameter to control writes to /dev/kmsg Message-ID: <20160716104425.GB3031@dhcp-128-65.nay.redhat.com> References: <1467969530-5215-1-git-send-email-bp@alien8.de> <1467969530-5215-3-git-send-email-bp@alien8.de> <20160715062109.GA4515@dhcp-128-65.nay.redhat.com> <20160715124523.GA26501@nazgul.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160715124523.GA26501@nazgul.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 16 Jul 2016 10:44:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/15/16 at 02:45pm, Borislav Petkov wrote: > On Fri, Jul 15, 2016 at 02:21:09PM +0800, Dave Young wrote: > > Sorry for jumping in late. But I just see this today and I really like the > > idea to add a switch to turn off the kmsg writing from userspace because > > I suffer from it also. > > Thanks, I'll send v5 soon. > > > I may missed the background, what is the reason for "ratelimit"? It sounds > > a little odd. I think use default "on" should be safe to keep same behavior > > as before. > > Yeah, so we want to ratelimit by default so that excessive logging > doesn't disturb system operation. People who want to see all that > blubber can do so with "on" so they should be taken care of too. Ratelimit the writing to kmsg sounds not a good way, the ratelimit use cases are for "callbacks" being mentioned in other thread. Basiclly specific printk from same line of a function will be suppressed, that means the supressed messages are somehow same error/message/warnings. But different writings to /dev/msg could be from different userspace software so that the messages being supressed could be different and the *ratelimit* is not fine-grained as *ratelimt* supposed to be. Mis-ratelimit cause critical userspace messages being lost, that is worse than use off as default. Suppose we turn off devkmsg by default distributions can still turn on it with sysctl and for us who do not want the flooding we can use printk.devkmsg=off in kernel cmdline to override it. Of course if we turn off it by default we can print a warning to alert user. BTW, for userspace messages maybe they should not go to same log buffer, maybe a separate log buffer for /dev/msg will be better. Thanks Dave