From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH 1/2] net/netfilter/ipvs: Move #define KMSG_COMPONENT to Makefile Date: Thu, 01 Oct 2009 08:55:57 -0700 Message-ID: <1254412557.1799.68.camel@Joe-Laptop.home> References: <0026bcf5aad9ae5036e68fc2dcda9c778d30dc47.1254349375.git.joe@perches.com> <1254352160.2960.119.camel@Joe-Laptop.home> <1254358235.2960.145.camel@Joe-Laptop.home> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Patrick McHardy , "David S. Miller" , Simon Horman , Julian Anastasov , Netfilter Developer Mailing List , netdev@vger.kernel.org, Linux Kernel Mailing List , lvs-devel@vger.kernel.org To: Jan Engelhardt Return-path: In-Reply-To: Sender: lvs-devel-owner@vger.kernel.org List-Id: netfilter-devel.vger.kernel.org On Thu, 2009-10-01 at 10:27 +0200, Jan Engelhardt wrote: > On Thursday 2009-10-01 02:50, Joe Perches wrote: > >I imagine an eventual goal of standardizing the default > >pr_fmt define in kernel.h to > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > >so that all pr_ calls get this unless otherwise > >specified. > > I like that approach. Saves me adding that line to .c > files repeatedly. There aren't too many existing pr_ calls so that this couldn't be considered. Files with pr_ without pr_fmt: $ grep -rPl --include=*.[ch] \ "\bpr_(info|warning|err|alert|notice|crit)\b" * | xargs grep -Lw "pr_fmt" | wc -l 569 Uses of pr_ without pr_fmt: $ grep -rPl --include=*.[ch] \ "\bpr_(info|warning|err|alert|notice|crit)\b" * | xargs grep -Lw "pr_fmt" | xargs grep -P "\bpr_(info|warning|err|alert|notice|crit)\b" | wc -l 2885 If you look at the pr_, it's nearly a mechanical thing to strip the ones with some sort of prefix and add a #define pr_fmt to replace them. Most all of them without prefixes might benefit by using a standardized #define pr_fmt(etc...) in kernel.h, so the actual count of changes isn't that high. > >Or perhaps better, to get rid of pr_fmt(fmt) altogether and > >have printk emit the filename/modulename, function and/or > >code offset by using something like %pS after the level. > I object to that. You would be spamming the dmesg ring buffer > with all that info Of course printks could not change, there are way too many of those to consider doing that globally. But the printks emitted by pr_ might change. Maybe by setting a bit in the string "" or by some other mechanism. > filename: you would have to keep filename strings in the kernel. > Surely I do not find that thrilling when there are ~18000 > non-arch .[ch] files whose pathnames amount to 542K. > Same goes similar for functions. > > modulename: obj-y files would only get "" or something > for KBUILD_MODNAME. Printing that to dmesg is not too useful. The removal of KBUILD_MODNAME could only be done for builds with CONFIG_KALLSYMS or CONFIG_DYNAMIC_DEBUG. It might also be possible to use something like CONFIG_DYNAMIC_DEBUG to control which modules get MODNAME, __func__, __LINE__ or offset emitted by the pr_ via some boot/module/sysconf or FTRACE like parameters. cheers, Joe