From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754942AbZJAPz6 (ORCPT ); Thu, 1 Oct 2009 11:55:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754644AbZJAPz5 (ORCPT ); Thu, 1 Oct 2009 11:55:57 -0400 Received: from mail.perches.com ([173.55.12.10]:1584 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753524AbZJAPzz (ORCPT ); Thu, 1 Oct 2009 11:55:55 -0400 Subject: Re: [PATCH 1/2] net/netfilter/ipvs: Move #define KMSG_COMPONENT to Makefile From: Joe Perches To: Jan Engelhardt 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 In-Reply-To: References: <0026bcf5aad9ae5036e68fc2dcda9c778d30dc47.1254349375.git.joe@perches.com> <1254352160.2960.119.camel@Joe-Laptop.home> <1254358235.2960.145.camel@Joe-Laptop.home> Content-Type: text/plain; charset="UTF-8" Date: Thu, 01 Oct 2009 08:55:57 -0700 Message-Id: <1254412557.1799.68.camel@Joe-Laptop.home> Mime-Version: 1.0 X-Mailer: Evolution 2.28.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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