From: Joe Perches <joe@perches.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Bill Wendling <morbo@google.com> Cc: Jan Engelhardt <jengelh@inai.de>, Andrew Morton <akpm@linux-foundation.org>, Bill Wendling <isanbard@gmail.com>, Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Dave Hansen <dave.hansen@linux.intel.com>, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>, Phillip Potter <phil@philpotter.co.uk>, Arnd Bergmann <arnd@arndb.de>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Jan Kara <jack@suse.com>, Pablo Neira Ayuso <pablo@netfilter.org>, Jozsef Kadlecsik <kadlec@netfilter.org>, Florian Westphal <fw@strlen.de>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Ross Philipson <ross.philipson@oracle.com>, Daniel Kiper <daniel.kiper@oracle.com>, linux-edac@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>, ACPI Devel Maling List <linux-acpi@vger.kernel.org>, linux-mm@kvack.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Networking <netdev@vger.kernel.org>, alsa-devel@alsa-project.org, clang-built-linux <llvm@lists.linux.dev> Subject: Re: [PATCH 00/12] Clang -Wformat warning fixes Date: Fri, 10 Jun 2022 05:44:18 -0700 [thread overview] Message-ID: <cd59f3eab3d2b4f069f4ebf169b33307eaa9e50d.camel@perches.com> (raw) In-Reply-To: <YqLUn3RdZ9HAKZKu@kroah.com> On Fri, 2022-06-10 at 07:20 +0200, Greg Kroah-Hartman wrote: > On Thu, Jun 09, 2022 at 04:16:16PM -0700, Bill Wendling wrote: > > On Thu, Jun 9, 2022 at 4:03 PM Jan Engelhardt <jengelh@inai.de> wrote: > > > On Friday 2022-06-10 00:49, Bill Wendling wrote: > > > > On Thu, Jun 9, 2022 at 3:25 PM Andrew Morton <akpm@linux-foundation.org> wrote: > > > > > On Thu, 9 Jun 2022 22:16:19 +0000 Bill Wendling <morbo@google.com> wrote: > > > > > > > > > > > This patch set fixes some clang warnings when -Wformat is enabled. > > > > > > > > > > tldr: > > > > > > > > > > - printk(msg); > > > > > + printk("%s", msg); > > > > > > > > > > Otherwise these changes are a > > > > > useless consumer of runtime resources. > > > > Calling a "printf" style function is already insanely expensive. I expect the printk code itself dominates, not the % scan cost. > > > Perhaps you can split vprintk_store in the middle (after the call to > > > vsnprintf), and offer the second half as a function of its own (e.g. > > > "puts"). Then the tldr could be > > > > > > - printk(msg); > > > + puts(msg); > > > > That might be a nice compromise. Andrew, what do you think? > > You would need to do that for all of the dev_printk() variants, so I > doubt that would ever be all that useful as almost no one should be > using a "raw" printk() these days. True. The kernel has ~20K variants like that. $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|notice|info|cont|debug|dbg)|printk)\s*\(".*"\s*\)\s*;' | wc -l 21160 That doesn't include the ~3K uses like #define foo "bar" printk(foo); $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|info|notice|debug|dbg|cont)|printk)\s*\((?:\s*\w+){1,3}\s*\)\s*;'|wc -l 2922 There are apparently only a few hundred uses of variants like: printk("%s", foo) $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|info|notice|debug|dbg|cont)|printk)\s*\(\s*"%s(?:\\n)?"\s*,\s*(?:".*"|\w+)\s*\)\s*;' | wc -l 305 unless I screwed up my greps (which of course is quite possible)
WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Bill Wendling <morbo@google.com> Cc: alsa-devel@alsa-project.org, "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" <x86@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Dave Hansen <dave.hansen@linux.intel.com>, Phillip Potter <phil@philpotter.co.uk>, linux-mm@kvack.org, Eric Dumazet <edumazet@google.com>, "H. Peter Anvin" <hpa@zytor.com>, Bill Wendling <isanbard@gmail.com>, Daniel Kiper <daniel.kiper@oracle.com>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Jozsef Kadlecsik <kadlec@netfilter.org>, ACPI Devel Maling List <linux-acpi@vger.kernel.org>, Ingo Molnar <mingo@redhat.com>, Tom Rix <trix@redhat.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Pablo Neira Ayuso <pablo@netfilter.org>, clang-built-linux <llvm@lists.linux.dev>, coreteam@netfilter.org, Arnd Bergmann <arnd@arndb.de>, Ross Philipson <ross.philipson@oracle.com>, Nathan Chancellor <nathan@kernel.org>, Borislav Petkov <bp@alien8.de>, Thomas Gleixner <tglx@linutronix.de>, linux-edac@vger.kernel.org, Tony Luck <tony.luck@intel.com>, Networking <netdev@vger.kernel.org>, Florian Westphal <fw@strlen.de>, Takashi Iwai <tiwai@suse.com>, LKML <linux-kernel@vger.kernel.org>, Jan Engelhardt <jengelh@inai.de>, netfilter-devel@vger.kernel.org, Jan Kara <jack@suse.com>, Andrew Morton <akpm@linux-foundation.org>, "David S. Miller" <davem@davemloft.net> Subject: Re: [PATCH 00/12] Clang -Wformat warning fixes Date: Fri, 10 Jun 2022 05:44:18 -0700 [thread overview] Message-ID: <cd59f3eab3d2b4f069f4ebf169b33307eaa9e50d.camel@perches.com> (raw) In-Reply-To: <YqLUn3RdZ9HAKZKu@kroah.com> On Fri, 2022-06-10 at 07:20 +0200, Greg Kroah-Hartman wrote: > On Thu, Jun 09, 2022 at 04:16:16PM -0700, Bill Wendling wrote: > > On Thu, Jun 9, 2022 at 4:03 PM Jan Engelhardt <jengelh@inai.de> wrote: > > > On Friday 2022-06-10 00:49, Bill Wendling wrote: > > > > On Thu, Jun 9, 2022 at 3:25 PM Andrew Morton <akpm@linux-foundation.org> wrote: > > > > > On Thu, 9 Jun 2022 22:16:19 +0000 Bill Wendling <morbo@google.com> wrote: > > > > > > > > > > > This patch set fixes some clang warnings when -Wformat is enabled. > > > > > > > > > > tldr: > > > > > > > > > > - printk(msg); > > > > > + printk("%s", msg); > > > > > > > > > > Otherwise these changes are a > > > > > useless consumer of runtime resources. > > > > Calling a "printf" style function is already insanely expensive. I expect the printk code itself dominates, not the % scan cost. > > > Perhaps you can split vprintk_store in the middle (after the call to > > > vsnprintf), and offer the second half as a function of its own (e.g. > > > "puts"). Then the tldr could be > > > > > > - printk(msg); > > > + puts(msg); > > > > That might be a nice compromise. Andrew, what do you think? > > You would need to do that for all of the dev_printk() variants, so I > doubt that would ever be all that useful as almost no one should be > using a "raw" printk() these days. True. The kernel has ~20K variants like that. $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|notice|info|cont|debug|dbg)|printk)\s*\(".*"\s*\)\s*;' | wc -l 21160 That doesn't include the ~3K uses like #define foo "bar" printk(foo); $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|info|notice|debug|dbg|cont)|printk)\s*\((?:\s*\w+){1,3}\s*\)\s*;'|wc -l 2922 There are apparently only a few hundred uses of variants like: printk("%s", foo) $ git grep -P '\b(?:(?:\w+_){1,3}(?:alert|emerg|crit|err|warn|info|notice|debug|dbg|cont)|printk)\s*\(\s*"%s(?:\\n)?"\s*,\s*(?:".*"|\w+)\s*\)\s*;' | wc -l 305 unless I screwed up my greps (which of course is quite possible)
next prev parent reply other threads:[~2022-06-10 12:44 UTC|newest] Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-09 22:16 [PATCH 00/12] Clang -Wformat warning fixes Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 01/12] x86/mce: use correct format characters Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 23:14 ` Randy Dunlap 2022-06-09 23:14 ` Randy Dunlap 2022-06-09 23:18 ` Bill Wendling 2022-06-09 23:18 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 02/12] x86/CPU/AMD: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 03/12] x86/e820: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 04/12] blk-cgroup: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-10 8:10 ` Christoph Hellwig 2022-06-10 8:10 ` Christoph Hellwig 2022-06-09 22:16 ` [PATCH 05/12] fs: quota: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 06/12] PNP: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 07/12] driver/char: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-10 5:18 ` Greg Kroah-Hartman 2022-06-10 5:18 ` Greg Kroah-Hartman 2022-06-13 18:40 ` Bill Wendling 2022-06-13 18:40 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 08/12] cdrom: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-12 16:23 ` Phillip Potter 2022-06-12 16:23 ` Phillip Potter 2022-06-13 18:47 ` Bill Wendling 2022-06-13 18:47 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 09/12] ALSA: seq: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 10/12] " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 11/12] ALSA: control: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-09 22:16 ` [PATCH 12/12] netfilter: conntrack: " Bill Wendling 2022-06-09 22:16 ` Bill Wendling 2022-06-20 14:44 ` Pablo Neira Ayuso 2022-07-11 14:35 ` Pablo Neira Ayuso 2022-07-11 14:35 ` Pablo Neira Ayuso 2022-06-09 22:25 ` [PATCH 00/12] Clang -Wformat warning fixes Andrew Morton 2022-06-09 22:25 ` Andrew Morton 2022-06-09 22:49 ` Bill Wendling 2022-06-09 22:49 ` Bill Wendling 2022-06-09 23:03 ` Jan Engelhardt 2022-06-09 23:03 ` Jan Engelhardt 2022-06-09 23:16 ` Bill Wendling 2022-06-09 23:16 ` Bill Wendling 2022-06-10 1:19 ` Andrew Morton 2022-06-10 1:19 ` Andrew Morton 2022-06-10 5:20 ` Greg Kroah-Hartman 2022-06-10 5:20 ` Greg Kroah-Hartman 2022-06-10 12:44 ` Joe Perches [this message] 2022-06-10 12:44 ` Joe Perches 2022-06-10 8:17 ` David Laight 2022-06-10 8:17 ` David Laight 2022-06-10 8:32 ` Jan Engelhardt 2022-06-10 8:32 ` Jan Engelhardt 2022-06-10 9:14 ` David Laight 2022-06-10 9:14 ` David Laight 2022-06-10 9:22 ` Jan Engelhardt 2022-06-10 9:22 ` Jan Engelhardt 2022-06-10 0:32 ` Nick Desaulniers 2022-06-10 0:32 ` Nick Desaulniers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=cd59f3eab3d2b4f069f4ebf169b33307eaa9e50d.camel@perches.com \ --to=joe@perches.com \ --cc=akpm@linux-foundation.org \ --cc=alsa-devel@alsa-project.org \ --cc=arnd@arndb.de \ --cc=bp@alien8.de \ --cc=coreteam@netfilter.org \ --cc=daniel.kiper@oracle.com \ --cc=dave.hansen@linux.intel.com \ --cc=davem@davemloft.net \ --cc=edumazet@google.com \ --cc=fw@strlen.de \ --cc=gregkh@linuxfoundation.org \ --cc=hpa@zytor.com \ --cc=isanbard@gmail.com \ --cc=jack@suse.com \ --cc=jengelh@inai.de \ --cc=kadlec@netfilter.org \ --cc=kuba@kernel.org \ --cc=linux-acpi@vger.kernel.org \ --cc=linux-edac@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=llvm@lists.linux.dev \ --cc=mingo@redhat.com \ --cc=morbo@google.com \ --cc=nathan@kernel.org \ --cc=ndesaulniers@google.com \ --cc=netdev@vger.kernel.org \ --cc=netfilter-devel@vger.kernel.org \ --cc=pabeni@redhat.com \ --cc=pablo@netfilter.org \ --cc=perex@perex.cz \ --cc=phil@philpotter.co.uk \ --cc=rafael.j.wysocki@intel.com \ --cc=ross.philipson@oracle.com \ --cc=tglx@linutronix.de \ --cc=tiwai@suse.com \ --cc=tony.luck@intel.com \ --cc=trix@redhat.com \ --cc=x86@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.