Convert default pr_fmt from empty to KBUILD_MODNAME
Subsystems (47)
cover Convert default pr_fmt from empty to KBUILD_MODNAME
pr_<level> logging uses allow a prefix to be specified with a specific #define pr_fmt
The default of pr_fmt in printk.h is #define pr_fmt(fmt) fmt so no prefixing of logging output is generically done.
There are several output logging uses like dump_stack() that are unprefixed and should remain unprefixed.
This patch series attempts to convert the default #define of pr_fmt to KBUILD_MODNAME ": " fmt and as well update the various bits of the kernel that should _not_ be prefixed by adding #define pr_fmt(fmt) fmt to those compilation units that do not want output message prefixing.
There are about 1200 uses of #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt that could be removed if the default is changed.
A script that does this removal (and removes any blank lines that follow) for the linux-kernel tree is included below:
$ git grep -P --name-only "define\s+pr_fmt\b" | \
grep -v include/linux/printk.h | \
xargs perl -i -e 'local $/; while (<>) {s/(\n)*[ \t]*#[ \t]*define[ \t]+pr_fmt[ \t]*\([ \t]*(\w+)[ \t]*\)[ \t]*KBUILD_MODNAME[ \t]*\": \"[ \t]*\2[ \t]*\n\s*/\1\n/; s/^\n//; print;}'This script should be run after this patch series is applied.
The above script output diff is currently:
1198 files changed, 70 insertions(+), 2241 deletions(-)
Joe Perches (18):
kernel: Use pr_fmt
lib: Use pr_fmt
printk: Convert pr_fmt from blank define to KBUILD_MODNAME
x86: Remove pr_fmt duplicate logging prefixes
x86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes
net: Remove pr_fmt duplicate logging prefixes
blk-mq: Remove pr_fmt duplicate logging prefixes
random: Remove pr_fmt duplicate logging prefixes
ptp: Remove pr_fmt duplicate logging prefixes
efifb: Remove pr_fmt duplicate logging prefixes
proc: Remove pr_fmt duplicate logging prefixes
uprobes: Remove pr_fmt duplicate logging prefixes
printk: Remove pr_fmt duplicate logging prefixes lib/mpi: Remove pr_fmt duplicate logging prefixes
security: Remove pr_fmt duplicate logging prefixes
aoe: Remove pr_fmt duplicate logging prefixes
security: encrypted-keys: Remove pr_fmt duplicate logging prefixes
rcu: Use pr_fmt to prefix "rcu: " to logging output
arch/x86/events/amd/ibs.c | 2 +-
arch/x86/kernel/cpu/mtrr/Makefile | 2 +-
arch/x86/kernel/cpu/mtrr/{main.c => mtrr.c} | 33 ++++++-------
arch/x86/kernel/e820.c | 32 ++++++------
arch/x86/kernel/hpet.c | 5 +-
arch/x86/kernel/uprobes.c | 4 +-
arch/x86/mm/numa.c | 22 ++++-----
block/blk-mq.c | 9 ++--
drivers/block/aoe/aoeblk.c | 29 ++++++-----
drivers/block/aoe/aoechr.c | 11 ++---
drivers/block/aoe/aoecmd.c | 34 ++++++-------
drivers/block/aoe/aoedev.c | 19 +++-----
drivers/block/aoe/aoemain.c | 6 +--
drivers/block/aoe/aoenet.c | 19 +++-----
drivers/char/hw_random/via-rng.c | 10 ++--
drivers/char/random.c | 16 +++---
drivers/ptp/ptp_clock.c | 4 +-
drivers/video/fbdev/efifb.c | 48 +++++++++---------
fs/proc/root.c | 6 +--
include/linux/printk.h | 2 +-
kernel/acct.c | 2 +
kernel/async.c | 14 +++---
kernel/audit_tree.c | 2 +-
kernel/backtracetest.c | 8 +--
kernel/crash_core.c | 29 ++++++-----
kernel/events/uprobes.c | 3 +-
kernel/exit.c | 2 +
kernel/hung_task.c | 13 +++--
kernel/kprobes.c | 20 +++++---
kernel/module.c | 59 +++++++++++------------
kernel/panic.c | 3 ++
kernel/params.c | 13 +++--
kernel/pid.c | 2 +
kernel/printk/printk.c | 2 +-
kernel/profile.c | 2 +
kernel/range.c | 2 +-
kernel/rcu/rcu_segcblist.c | 2 +
kernel/rcu/rcuperf.c | 10 ++--
kernel/rcu/rcutorture.c | 46 +++++++++---------
kernel/rcu/srcutiny.c | 2 +
kernel/rcu/srcutree.c | 5 +-
kernel/rcu/tiny.c | 3 ++
kernel/rcu/tree.c | 8 +--
kernel/rcu/tree_plugin.h | 67 +++++++++++++++-----------
kernel/rcu/update.c | 19 +++++---
kernel/relay.c | 5 +-
kernel/seccomp.c | 4 +-
kernel/signal.c | 10 ++--
kernel/smpboot.c | 5 +-
kernel/taskstats.c | 4 +-
kernel/torture.c | 6 ++-
kernel/tracepoint.c | 3 ++
kernel/workqueue.c | 2 +
lib/cpu_rmap.c | 15 +++---
lib/crc32test.c | 2 +
lib/earlycpio.c | 5 +-
lib/find_bit_benchmark.c | 2 +
lib/kobject.c | 36 +++++++-------
lib/kobject_uevent.c | 27 +++++------
lib/mpi/mpicoder.c | 10 ++--
lib/nmi_backtrace.c | 3 ++
lib/percpu_ida.c | 4 +-
lib/percpu_test.c | 2 +
lib/random32.c | 10 ++--
lib/stmp_device.c | 2 +
lib/string.c | 2 +
lib/swiotlb.c | 4 +-
lib/test_debug_virtual.c | 2 +
lib/test_rhashtable.c | 44 +++++++++--------
lib/test_sort.c | 2 +
lib/ubsan.c | 61 ++++++++++++-----------
net/ipv4/ipconfig.c | 59 ++++++++++-------------
net/ipv4/ipmr.c | 2 +-
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 9 ++--
net/ipv6/ip6mr.c | 2 +-
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 6 +--
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 4 +-
net/netfilter/nf_conntrack_helper.c | 11 ++---
net/netfilter/nf_conntrack_standalone.c | 2 +-
net/socket.c | 2 +-
security/keys/encrypted-keys/encrypted.c | 63 +++++++++++-------------
security/selinux/selinuxfs.c | 29 ++++++-----
82 files changed, 580 insertions(+), 532 deletions(-)
rename arch/x86/kernel/cpu/mtrr/{main.c => mtrr.c} (96%)Signature · 1 line
2.15.0
PATCH 1/18 kernel: Use pr_fmt
Sometime in the future, it would be useful to convert pr_fmt from a default simple define to use a default prefix with KBUILD_MODNAME.
There are files in kernel/ that use pr_<level>, some with an embedded prefix, that also do not have a specific pr_fmt define.
Add pr_fmt for those files.
There are some differences in output as some messages are now prefixed with their KBUILD_MODNAME.
Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formats
--- kernel/acct.c | 2 ++ kernel/async.c | 14 ++++++------ kernel/audit_tree.c | 2 +- kernel/backtracetest.c | 8 +++---- kernel/crash_core.c | 29 ++++++++++++++----------- kernel/exit.c | 2 ++ kernel/hung_task.c | 13 +++++------ kernel/kprobes.c | 20 ++++++++++------- kernel/module.c | 59 +++++++++++++++++++++++--------------------------- kernel/panic.c | 3 +++ kernel/params.c | 13 ++++++----- kernel/pid.c | 2 ++ kernel/profile.c | 2 ++ kernel/range.c | 2 +- kernel/relay.c | 5 ++++- kernel/seccomp.c | 4 +++- kernel/signal.c | 10 +++++---- kernel/smpboot.c | 5 ++++- kernel/taskstats.c | 4 +++- kernel/torture.c | 6 +++-- kernel/tracepoint.c | 3 +++ kernel/workqueue.c | 2 ++ 22 files changed, 122 insertions(+), 88 deletions(-)
kernel/acct.c +2 -0
@@ -44,6 +44,8 @@* a struct file opened for write. Fixed. 2/6/2000, AV. */ +#define pr_fmt (fmt) fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/acct.h>
kernel/async.c +7 -7
@@ -120,8 +120,8 @@ static void async_run_entry_fn(struct work_struct *work)/* 1) run (and print duration) */ if (initcall_debug && system_state <SYSTEM_RUNNING ) {pr_debug ("calling %lli_%pF @ %i\n" , - (long long )entry->cookie, - entry->func,task_pid_nr (current)); + (long long )entry->cookie, + entry->func,task_pid_nr (current)); calltime =ktime_get (); } entry->func (entry->data, entry->cookie);
@@ -129,9 +129,9 @@ static void async_run_entry_fn(struct work_struct *work) rettime =ktime_get (); delta =ktime_sub (rettime, calltime);pr_debug ("initcall %lli_%pF returned 0 after %lld usecs\n" , - (long long )entry->cookie, - entry->func, - (long long )ktime_to_ns (delta) >>10 ); + (long long )entry->cookie, + entry->func, + (long long )ktime_to_ns (delta) >>10 ); }/* 2) remove self from the pending queues */
@@ -300,8 +300,8 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, struct async_domain delta =ktime_sub (endtime, starttime);pr_debug ("async_continuing @ %i after %lli usec\n" , -task_pid_nr (current), - (long long )ktime_to_ns (delta) >>10 ); +task_pid_nr (current), + (long long )ktime_to_ns (delta) >>10 ); } }EXPORT_SYMBOL_GPL (async_synchronize_cookie_domain);
kernel/audit_tree.c +1 -1
@@ -739,7 +739,7 @@ static int audit_launch_prune(void) prune_thread =kthread_run (prune_tree_thread,NULL ,"audit_prune_tree" );if (IS_ERR (prune_thread)) { -pr_err ("cannot start thread audit_prune_tree" ); +pr_err ("cannot start thread audit_prune_tree\n" ); prune_thread =NULL ;return -ENOMEM ; }
kernel/backtracetest.c +4 -4
@@ -19,7 +19,7 @@static void backtrace_test_normal (void ) { -pr_info ("Testing a backtrace from process context.\n" ); +pr_info ("Testing a backtrace from process context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );dump_stack ();
@@ -37,7 +37,7 @@ static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);static void backtrace_test_irq (void ) { -pr_info ("Testing a backtrace from irq context.\n" ); +pr_info ("Testing a backtrace from irq context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );init_completion (&backtrace_work);
@@ -51,7 +51,7 @@ static void backtrace_test_saved(void)struct stack_trace trace;unsigned long entries[8 ]; -pr_info ("Testing a saved backtrace.\n" ); +pr_info ("Testing a saved backtrace\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" ); trace.nr_entries =0 ;
@@ -65,7 +65,7 @@ static void backtrace_test_saved(void)#else static void backtrace_test_saved (void ) { -pr_info ("Saved backtrace test skipped.\n" ); +pr_info ("Saved backtrace test skipped\n" ); }#endif
kernel/crash_core.c +16 -13
@@ -6,6 +6,8 @@* Version 2. See the file COPYING for more details. */ +#define pr_fmt (fmt) "crashkernel: " fmt +#include <linux/crash_core.h> #include <linux/utsname.h> #include <linux/vmalloc.h>
@@ -49,12 +51,12 @@ static int __init parse_crashkernel_mem(char *cmdline,/* get the start of the range */ start =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (*cur !='-' ) { -pr_warn ("crashkernel: '-' expected\n" ); +pr_warn ("'-' expected\n" );return -EINVAL ; } cur++;
@@ -63,18 +65,18 @@ static int __init parse_crashkernel_mem(char *cmdline,if (*cur !=':' ) { end =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (end <= start) { -pr_warn ("crashkernel: end <= start\n" ); +pr_warn ("end <= start\n" );return -EINVAL ; } }if (*cur !=':' ) { -pr_warn ("crashkernel: ':' expected\n" ); +pr_warn ("':' expected\n" );return -EINVAL ; } cur++;
@@ -86,7 +88,7 @@ static int __init parse_crashkernel_mem(char *cmdline, } cur = tmp;if (size >= system_ram) { -pr_warn ("crashkernel: invalid size\n" ); +pr_warn ("invalid size\n" );return -EINVAL ; }
@@ -108,8 +110,9 @@ static int __init parse_crashkernel_mem(char *cmdline,return -EINVAL ; } } - }else -pr_info ("crashkernel size resulted in zero bytes\n" ); + }else { +pr_info ("size resulted in zero bytes\n" ); + }return 0 ; }
@@ -129,14 +132,14 @@ static int __init parse_crashkernel_simple(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }if (*cur =='@' ) *crash_base =memparse (cur+1 , &cur);else if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }
@@ -167,18 +170,18 @@ static int __init parse_crashkernel_suffix(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }/* check with suffix */ if (strncmp (cur, suffix,strlen (suffix))) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; } cur +=strlen (suffix);if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }
kernel/exit.c +2 -0
@@ -4,6 +4,8 @@* Copyright (C) 1991, 1992 Linus Torvalds */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/sched/autogroup.h>
kernel/hung_task.c +6 -7
@@ -113,14 +113,13 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)if (sysctl_hung_task_warnings) {if (sysctl_hung_task_warnings >0 ) sysctl_hung_task_warnings--; -pr_err ("INFO: task %s:%d blocked for more than %ld seconds.\n" , - t->comm, t->pid, timeout); +pr_err ("INFO: task %s:%d blocked for more than %ld seconds\n" , + t->comm, t->pid, timeout);pr_err (" %s %s %.*s\n" , -print_tainted (),init_utsname ()->release, - (int )strcspn (init_utsname ()->version," " ), -init_utsname ()->version); -pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" -" disables this message.\n" ); +print_tainted (),init_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->version); +pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\" disables this message\n" );sched_show_task (t); hung_task_show_lock = true; }
kernel/kprobes.c +12 -8
@@ -31,6 +31,9 @@* <[email protected]> and Prasanna S Panchamukhi * <[email protected]> added function-return probes. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kprobes.h> #include <linux/hash.h> #include <linux/init.h>
@@ -985,7 +988,8 @@ static int arm_kprobe_ftrace(struct kprobe *p) ret =ftrace_set_filter_ip (&kprobe_ftrace_ops, (unsigned long )p->addr,0 ,0 );if (ret) { -pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , p->addr, ret); +pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , + p->addr, ret);return ret; }
@@ -2198,7 +2202,7 @@ static int __init populate_kprobe_blacklist(unsigned long *start,if (!kernel_text_address (entry) || !kallsyms_lookup_size_offset (entry, &size, &offset)) {pr_err ("Failed to find blacklist at %p\n" , - (void *)entry); + (void *)entry);continue ; }
@@ -2281,8 +2285,8 @@ static int __init init_kprobes(void) err =populate_kprobe_blacklist (__start_kprobe_blacklist, __stop_kprobe_blacklist);if (err) { -pr_err ("kprobes: failed to populate blacklist: %d\n" , err); -pr_err ("Please take care of using kprobes.\n" ); +pr_err ("failed to populate blacklist: %d\n" , err); +pr_err ("Please take care of using kprobes\n" ); }if (kretprobe_blacklist_size) {
@@ -2488,10 +2492,10 @@ static int arm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally enabled, but failed to arm %d out of %d probes\n" , +pr_warn ("globally enabled, but failed to arm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally enabled\n" ); +pr_info ("globally enabled\n" ); already_enabled:mutex_unlock (&kprobe_mutex);
@@ -2531,10 +2535,10 @@ static int disarm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally disabled, but failed to disarm %d out of %d probes\n" , +pr_warn ("globally disabled, but failed to disarm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally disabled\n" ); +pr_info ("globally disabled\n" );mutex_unlock (&kprobe_mutex);
kernel/module.c +27 -32
180 lines not on this page · raw message
kernel/panic.c +3 -0
@@ -8,6 +8,9 @@* This function is used through-out the kernel (including mm and fs) * to indicate a major problem. */ + +#define pr_fmt (fmt) fmt +#include <linux/debug_locks.h> #include <linux/sched/debug.h> #include <linux/interrupt.h>
kernel/params.c +8 -5
@@ -15,6 +15,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h>
@@ -141,8 +144,8 @@ static int parse_one(char *param,if (!val && !(params[i].ops->flags &KERNEL_PARAM_OPS_FL_NOARG ))return -EINVAL ; -pr_debug ("handling %s with %p\n" , param, - params[i].ops->set); +pr_debug ("handling %s with %p\n" , + param, params[i].ops->set);kernel_param_lock (params[i].mod);param_check_unsafe (¶ms[i]); err = params[i].ops->set (val, ¶ms[i]);
@@ -496,8 +499,8 @@ int param_set_copystring(const char *val, const struct kernel_param *kp)const struct kparam_string *kps = kp->str;if (strlen (val)+1 > kps->maxlen) { -pr_err ("%s: string doesn't fit in %u chars.\n" , - kp->name, kps->maxlen-1 ); +pr_err ("%s: string doesn't fit in %u chars\n" , + kp->name, kps->maxlen -1 );return -ENOSPC ; }strcpy (kps->string, val);
@@ -763,7 +766,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)#endif if (err) {kobject_put (&mk->kobj); -pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable.\n" , +pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable\n" , name, err);return NULL ; }
kernel/pid.c +2 -0
@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/export.h> #include <linux/slab.h>
kernel/profile.c +2 -0
@@ -14,6 +14,8 @@* Oracle, 2004 */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/profile.h> #include <linux/bootmem.h>
kernel/range.c +1 -1
@@ -102,7 +102,7 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].start = end; }else {pr_err ("%s: run out of slot in ranges\n" , - __func__); + __func__); } range[j].end = start;continue ;
kernel/relay.c +4 -1
@@ -12,6 +12,9 @@* * This file is released under the GPL. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/errno.h> #include <linux/stddef.h> #include <linux/slab.h>
@@ -527,7 +530,7 @@ int relay_prepare_cpu(unsigned int cpu)continue ; buf =relay_open_buf (chan, cpu);if (!buf) { -pr_err ("relay: cpu %d buffer creation failed\n" , cpu); +pr_err ("cpu %d buffer creation failed\n" , cpu);mutex_unlock (&relay_channels_mutex);return -ENOMEM ; }
kernel/seccomp.c +3 -1
@@ -14,6 +14,8 @@* of Berkeley Packet Filters/Linux Socket Filters. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/refcount.h> #include <linux/audit.h> #include <linux/compat.h>
@@ -1323,7 +1325,7 @@ static int __init seccomp_sysctl_init(void) hdr =register_sysctl_paths (seccomp_sysctl_path, seccomp_sysctl_table);if (!hdr) -pr_warn ("seccomp: sysctl registration failed\n" ); +pr_warn ("sysctl registration failed\n" );else kmemleak_not_leak (hdr);
kernel/signal.c +6 -4
@@ -10,6 +10,8 @@* to allow signals to be sent reliably. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/slab.h> #include <linux/export.h> #include <linux/init.h>
@@ -235,7 +237,7 @@ static inline void print_dropped_signal(int sig)return ;pr_info ("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n" , - current->comm, current->pid, sig); + current->comm, current->pid, sig); }/**
@@ -1118,10 +1120,10 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,static void print_fatal_signal (int signr) {struct pt_regs *regs =signal_pt_regs (); -pr_info ("potentially unexpected fatal signal %d.\n" , signr); +pr_info ("potentially unexpected fatal signal %d\n" , signr);#if defined(__i386__) && !defined(__arch_um__) -pr_info ("code at %08lx: " , regs->ip); +pr_info ("code at %08lx:" , regs->ip); {int i;for (i =0 ; i <16 ; i++) {
@@ -1129,7 +1131,7 @@ static void print_fatal_signal(int signr)if (get_user (insn, (unsigned char *)(regs->ip + i)))break ; -pr_cont ("%02x " , insn); +pr_cont (" %02x" , insn); } }pr_cont ("\n" );
kernel/smpboot.c +4 -1
@@ -1,6 +1,9 @@/* * Common SMP CPU bringup/teardown functions */ + +#define pr_fmt (fmt) "SMP: " fmt +#include <linux/cpu.h> #include <linux/err.h> #include <linux/smp.h>
@@ -54,7 +57,7 @@ static inline void idle_init(unsigned int cpu)if (!tsk) { tsk =fork_idle (cpu);if (IS_ERR (tsk)) -pr_err ("SMP: fork_idle() failed for CPU %u\n" , cpu); +pr_err ("fork_idle() failed for CPU %u\n" , cpu);else per_cpu (idle_threads, cpu) = tsk; }
kernel/taskstats.c +3 -1
@@ -16,6 +16,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/taskstats_kern.h> #include <linux/tsacct_kern.h>
@@ -690,7 +692,7 @@ static int __init taskstats_init(void)return rc; family_registered =1 ; -pr_info ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION ); +pr_info ("registered version %d\n" ,TASKSTATS_GENL_VERSION );return 0 ; }
kernel/torture.c +4 -2
@@ -20,6 +20,9 @@* Author: Paul E. McKenney <[email protected]> * Based on kernel/rcu/torture.c. */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -99,8 +102,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,return false;if (verbose) -pr_alert ("%s" TORTURE_FLAG -"torture_onoff task: offlining %d\n" , +pr_alert ("%s" TORTURE_FLAG "torture_onoff task: offlining %d\n" , torture_type, cpu); starttime = jiffies; (*n_offl_attempts)++;
kernel/tracepoint.c +3 -0
@@ -15,6 +15,9 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/mutex.h> #include <linux/types.h>
kernel/workqueue.c +2 -0
@@ -24,6 +24,8 @@* Please read Documentation/core-api/workqueue.rst for details. */ +#define pr_fmt (fmt) fmt +#include <linux/export.h> #include <linux/kernel.h> #include <linux/sched.h>
Signature · 1 line
2.15.0
PATCH 2/18 lib: Use pr_fmt
In reply to Joe PerchesSometime in the future, it would be useful to convert pr_fmt from a default simple define to use a default prefix with KBUILD_MODNAME.
There are files in lib/ that use pr_<level>, some with an embedded prefix, that also do not have a specific pr_fmt define.
Add pr_fmt for those files.
There are some differences in output as some logging output now is prefixed with the appropriate KBUILD_MODNAME.
Miscellanea:
o Simplify debugging macros to only require a single function definition by moving #define DEBUG into the definition and removing the empty function definition
o Function alignment neatening
o Use %s, __func__ instead of embedding function names as strings
o Add missing newline terminations
--- lib/cpu_rmap.c | 15 +++++------- lib/crc32test.c | 2 ++ lib/earlycpio.c | 5 ++-- lib/find_bit_benchmark.c | 2 ++ lib/kobject.c | 36 ++++++++++++++-------------- lib/kobject_uevent.c | 27 ++++++++++----------- lib/nmi_backtrace.c | 3 +++ lib/percpu_ida.c | 4 +++- lib/percpu_test.c | 2 ++ lib/random32.c | 10 ++++---- lib/stmp_device.c | 2 ++ lib/string.c | 2 ++ lib/swiotlb.c | 4 +++- lib/test_debug_virtual.c | 2 ++ lib/test_rhashtable.c | 44 ++++++++++++++++++---------------- lib/test_sort.c | 2 ++ lib/ubsan.c | 61 ++++++++++++++++++++++++------------------------ 17 files changed, 122 insertions(+), 101 deletions(-)
lib/cpu_rmap.c +6 -9
@@ -7,6 +7,8 @@* by the Free Software Foundation, incorporated herein by reference. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/cpu_rmap.h> #include <linux/interrupt.h> #include <linux/export.h>
@@ -110,26 +112,21 @@ static bool cpu_rmap_copy_neigh(struct cpu_rmap *rmap, unsigned int cpu,return false; } -#ifdef DEBUG static void debug_print_rmap (const struct cpu_rmap *rmap,const char *prefix) { +#ifdef DEBUG unsigned index;unsigned int cpu; -pr_info ("cpu_rmap %p, %s:\n" , rmap, prefix); +pr_info ("%p, %s:\n" , rmap, prefix);for_each_possible_cpu (cpu) { index = rmap->near[cpu].index;pr_info ("cpu %d -> obj %u (distance %u)\n" , cpu, index, rmap->near[cpu].dist); } -} -#else -static inline void -debug_print_rmap (const struct cpu_rmap *rmap,const char *prefix) -{ -}#endif +}/** * cpu_rmap_add - add object to a rmap
@@ -258,7 +255,7 @@ irq_cpu_rmap_notify(struct irq_affinity_notify *notify, const cpumask_t *mask) rc =cpu_rmap_update (glue->rmap, glue->index, mask);if (rc) -pr_warning ("irq_cpu_rmap_notify: update failed: %d\n" , rc); +pr_warn ("%s: update failed: %d\n" , __func__, rc); }/**
lib/crc32test.c +2 -0
@@ -24,6 +24,8 @@* Version 2. See the file COPYING for more details. */ +#define pr_fmt (fmt) fmt +#include <linux/crc32.h> #include <linux/module.h> #include <linux/sched.h>
lib/earlycpio.c +2 -3
@@ -130,9 +130,8 @@ struct cpio_data find_cpio_data(const char *path, void *data, *nextoff = (long )nptr - (long )data;if (ch[C_NAMESIZE ] - mypathsize >=MAX_CPIO_FILE_NAME ) { -pr_warn ( -"File %s exceeding MAX_CPIO_FILE_NAME [%d]\n" , - p,MAX_CPIO_FILE_NAME ); +pr_warn ("File %s exceeding MAX_CPIO_FILE_NAME [%d]\n" , + p,MAX_CPIO_FILE_NAME ); }strlcpy (cd.name, p + mypathsize,MAX_CPIO_FILE_NAME );
lib/find_bit_benchmark.c +2 -0
@@ -24,6 +24,8 @@* - sparse bitmap with few set bits at random positions. */ +#define pr_fmt (fmt) fmt +#include <linux/bitops.h> #include <linux/kernel.h> #include <linux/list.h>
lib/kobject.c +19 -17
@@ -10,6 +10,8 @@* about using the kobject interface. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kobject.h> #include <linux/string.h> #include <linux/export.h>
@@ -129,8 +131,8 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length) *(path + --length) ='/' ; } -pr_debug ("kobject: '%s' (%p): %s: path = '%s'\n" ,kobject_name (kobj), - kobj, __func__, path); +pr_debug ("'%s' (%p): %s: path = '%s'\n" , +kobject_name (kobj), kobj, __func__, path); }/**
@@ -220,7 +222,7 @@ static int kobject_add_internal(struct kobject *kobj) kobj->parent = parent; } -pr_debug ("kobject: '%s' (%p): %s: parent: '%s', set: '%s'\n" , +pr_debug ("'%s' (%p): %s: parent: '%s', set: '%s'\n" ,kobject_name (kobj), kobj, __func__, parent ?kobject_name (parent) :"<NULL>" , kobj->kset ?kobject_name (&kobj->kset->kobj) :"<NULL>" );
@@ -333,7 +335,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype) }if (kobj->state_initialized) {/* do not error out as sometimes we can recover */ -pr_err ("kobject (%p): tried to init an initialized object, something is seriously wrong.\n" , +pr_err ("(%p): tried to init an initialized object, something is seriously wrong\n" , kobj);dump_stack (); }
@@ -343,7 +345,7 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)return ; error: -pr_err ("kobject (%p): %s\n" , kobj, err_str); +pr_err ("(%p): %s\n" , kobj, err_str);dump_stack (); }EXPORT_SYMBOL (kobject_init);
@@ -356,7 +358,7 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj, retval =kobject_set_name_vargs (kobj, fmt, vargs);if (retval) { -pr_err ("kobject: can not set name properly!\n" ); +pr_err ("can not set name properly!\n" );return retval; } kobj->parent = parent;
@@ -398,7 +400,7 @@ int kobject_add(struct kobject *kobj, struct kobject *parent,return -EINVAL ;if (!kobj->state_initialized) { -pr_err ("kobject '%s' (%p): tried to add an uninitialized object, something is seriously wrong.\n" , +pr_err ("'%s' (%p): tried to add an uninitialized object, something is seriously wrong.n" ,kobject_name (kobj), kobj);dump_stack ();return -EINVAL ;
@@ -616,36 +618,36 @@ static void kobject_cleanup(struct kobject *kobj)struct kobj_type *t =get_ktype (kobj);const char *name = kobj->name; -pr_debug ("kobject: '%s' (%p): %s, parent %p\n" , +pr_debug ("'%s' (%p): %s, parent %p\n" ,kobject_name (kobj), kobj, __func__, kobj->parent);if (t && !t->release) -pr_debug ("kobject: '%s' (%p): does not have a release() function, it is broken and must be fixed.\n" , +pr_debug ("'%s' (%p): does not have a release() function, it is broken and must be fixed.\n" ,kobject_name (kobj), kobj);/* send "remove" if the caller did not do it but sent "add" */ if (kobj->state_add_uevent_sent && !kobj->state_remove_uevent_sent) { -pr_debug ("kobject: '%s' (%p): auto cleanup 'remove' event\n" , +pr_debug ("'%s' (%p): auto cleanup 'remove' event\n" ,kobject_name (kobj), kobj);kobject_uevent (kobj,KOBJ_REMOVE ); }/* remove from sysfs if the caller did not do it */ if (kobj->state_in_sysfs) { -pr_debug ("kobject: '%s' (%p): auto cleanup kobject_del\n" , +pr_debug ("'%s' (%p): auto cleanup kobject_del\n" ,kobject_name (kobj), kobj);kobject_del (kobj); }if (t && t->release) { -pr_debug ("kobject: '%s' (%p): calling ktype release\n" , +pr_debug ("'%s' (%p): calling ktype release\n" ,kobject_name (kobj), kobj); t->release (kobj); }/* free name if we allocated it */ if (name) { -pr_debug ("kobject: '%s': free name\n" , name); +pr_debug ("'%s': free name\n" , name);kfree_const (name); } }
@@ -663,8 +665,8 @@ static void kobject_release(struct kref *kref) struct kobject *kobj = container_of(kref, struct kobject, kref);#ifdef CONFIG_DEBUG_KOBJECT_RELEASE unsigned long delay =HZ +HZ * (get_random_int () &0x3 ); -pr_info ("kobject: '%s' (%p): %s, parent %p (delayed %ld)\n" , -kobject_name (kobj), kobj, __func__, kobj->parent, delay); +pr_info ("'%s' (%p): %s, parent %p (delayed %ld)\n" , +kobject_name (kobj), kobj, __func__, kobj->parent, delay);INIT_DELAYED_WORK (&kobj->release, kobject_delayed_cleanup);schedule_delayed_work (&kobj->release, delay);
@@ -693,7 +695,7 @@ EXPORT_SYMBOL(kobject_put);static void dynamic_kobj_release (struct kobject *kobj) { -pr_debug ("kobject: (%p): %s\n" , kobj, __func__); +pr_debug ("(%p): %s\n" , kobj, __func__);kfree (kobj); }
@@ -863,7 +865,7 @@ EXPORT_SYMBOL_GPL(kset_find_obj);static void kset_release (struct kobject *kobj) { struct kset *kset = container_of(kobj, struct kset, kobj); -pr_debug ("kobject: '%s' (%p): %s\n" , +pr_debug ("'%s' (%p): %s\n" ,kobject_name (kobj), kobj, __func__);kfree (kset); }
lib/kobject_uevent.c +12 -15
@@ -13,6 +13,8 @@* Greg Kroah-Hartman <[email protected]> */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/spinlock.h> #include <linux/string.h> #include <linux/kobject.h>
@@ -464,8 +466,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,int i =0 ;int retval =0 ; -pr_debug ("kobject: '%s' (%p): %s\n" , -kobject_name (kobj), kobj, __func__); +pr_debug ("'%s' (%p): %s\n" ,kobject_name (kobj), kobj, __func__);/* search the kset we belong to */ top_kobj = kobj;
@@ -473,9 +474,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, top_kobj = top_kobj->parent;if (!top_kobj->kset) { -pr_debug ("kobject: '%s' (%p): %s: attempted to send uevent " -"without kset!\n" ,kobject_name (kobj), kobj, - __func__); +pr_debug ("'%s' (%p): %s: attempted to send uevent without kset!\n" , +kobject_name (kobj), kobj, __func__);return -EINVAL ; }
@@ -484,16 +484,14 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,/* skip the event, if uevent_suppress is set*/ if (kobj->uevent_suppress) { -pr_debug ("kobject: '%s' (%p): %s: uevent_suppress " -"caused the event to drop!\n" , -kobject_name (kobj), kobj, __func__); +pr_debug ("'%s' (%p): %s: uevent_suppress caused the event to drop!\n" , +kobject_name (kobj), kobj, __func__);return 0 ; }/* skip the event, if the filter returns zero. */ if (uevent_ops && uevent_ops->filter)if (!uevent_ops->filter (kset, kobj)) { -pr_debug ("kobject: '%s' (%p): %s: filter function " -"caused the event to drop!\n" , +pr_debug ("'%s' (%p): %s: filter function caused the event to drop!\n" ,kobject_name (kobj), kobj, __func__);return 0 ; }
@@ -504,8 +502,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,else subsystem =kobject_name (&kset->kobj);if (!subsystem) { -pr_debug ("kobject: '%s' (%p): %s: unset subsystem caused the " -"event to drop!\n" ,kobject_name (kobj), kobj, +pr_debug ("'%s' (%p): %s: unset subsystem caused the event to drop!\n" , +kobject_name (kobj), kobj, __func__);return 0 ; }
@@ -546,9 +544,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,if (uevent_ops && uevent_ops->uevent) { retval = uevent_ops->uevent (kset, kobj, env);if (retval) { -pr_debug ("kobject: '%s' (%p): %s: uevent() returned " -"%d\n" ,kobject_name (kobj), kobj, - __func__, retval); +pr_debug ("'%s' (%p): %s: uevent() returned %d\n" , +kobject_name (kobj), kobj, __func__, retval); goto exit; } }
lib/nmi_backtrace.c +3 -0
@@ -13,6 +13,9 @@* * Bits copied from original nmi.c file */ + +#define pr_fmt (fmt) fmt +#include <linux/cpumask.h> #include <linux/delay.h> #include <linux/kprobes.h>
lib/percpu_ida.c +3 -1
@@ -14,6 +14,8 @@* General Public License for more details. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/bitmap.h> #include <linux/bitops.h>
@@ -299,7 +301,7 @@ int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags,/* Guard against overflow */ if (nr_tags > (unsigned )INT_MAX +1 ) { -pr_err ("percpu_ida_init(): nr_tags too large\n" ); +pr_err ("%s: nr_tags too large\n" , __func__);return -EINVAL ; }
lib/percpu_test.c +2 -0
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> /* validate @native and @pcp counter values match @expected */
lib/random32.c +6 -4
@@ -32,6 +32,8 @@* s1 > 1, s2 > 7, s3 > 15, s4 > 127. */ +#define pr_fmt (fmt) "prandom: " fmt +#include <linux/types.h> #include <linux/percpu.h> #include <linux/export.h>
@@ -437,9 +439,9 @@ static void __init prandom_state_selftest(void) }if (error) -pr_warn ("prandom: seed boundary self test failed\n" ); +pr_warn ("seed boundary self test failed\n" );else -pr_info ("prandom: seed boundary self test passed\n" ); +pr_info ("seed boundary self test passed\n" );for (i =0 ; i <ARRAY_SIZE (test2); i++) {struct rnd_state state;
@@ -458,8 +460,8 @@ static void __init prandom_state_selftest(void) }if (errors) -pr_warn ("prandom: %d/%d self tests failed\n" , errors, runs); +pr_warn ("%d/%d self tests failed\n" , errors, runs);else -pr_info ("prandom: %d self tests passed\n" , runs); +pr_info ("%d self tests passed\n" , runs); }#endif
lib/stmp_device.c +2 -0
@@ -12,6 +12,8 @@* (at your option) any later version. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/io.h> #include <linux/errno.h> #include <linux/delay.h>
lib/string.c +2 -0
@@ -20,6 +20,8 @@* - Kissed strtok() goodbye */ +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/string.h> #include <linux/ctype.h>
lib/swiotlb.c +3 -1
@@ -17,6 +17,8 @@* 08/12/11 beckyb Add highmem support */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/cache.h> #include <linux/dma-direct.h> #include <linux/mm.h>
@@ -165,7 +167,7 @@ void swiotlb_print_info(void)unsigned char *vstart, *vend;if (no_iotlb_memory) { -pr_warn ("software IO TLB: No low mem\n" ); +pr_warn ("No low mem\n" );return ; }
lib/test_debug_virtual.c +2 -0
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) fmt +#include <linux/kernel.h> #include <linux/module.h> #include <linux/export.h>
lib/test_rhashtable.c +24 -20
156 lines not on this page · raw message
lib/test_sort.c +2 -0
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/sort.h> #include <linux/slab.h> #include <linux/module.h>
lib/ubsan.c +30 -31
141 lines not on this page · raw message
Signature · 1 line
2.15.0
PATCH 6/18 net: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesUsing KBUILD_MODNAME as the default pr_fmt prefix caused some duplication on logging prefixes in net/.
Remove the duplicate prefixes.
--- net/ipv4/ipconfig.c | 59 ++++++++++++-------------- net/ipv4/ipmr.c | 2 +- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 9 ++-- net/ipv6/ip6mr.c | 2 +- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 6 +-- net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 4 +- net/netfilter/nf_conntrack_helper.c | 11 ++--- net/netfilter/nf_conntrack_standalone.c | 2 +- net/socket.c | 2 +- 9 files changed, 43 insertions(+), 54 deletions(-)
net/ipv4/ipconfig.c +26 -33
@@ -224,7 +224,7 @@ static int __init ic_open_devs(void)if (!(dev->flags &IFF_LOOPBACK ) && !netdev_uses_dsa (dev))continue ;if (dev_change_flags (dev, dev->flags |IFF_UP ) <0 ) -pr_err ("IP-Config: Failed to open %s\n" , dev->name); +pr_err ("Failed to open %s\n" , dev->name); }for_each_netdev (&init_net, dev) {
@@ -242,8 +242,7 @@ static int __init ic_open_devs(void)continue ; oflags = dev->flags;if (dev_change_flags (dev, oflags |IFF_UP ) <0 ) { -pr_err ("IP-Config: Failed to open %s\n" , - dev->name); +pr_err ("Failed to open %s\n" , dev->name);continue ; }if (!(d =kmalloc (sizeof (struct ic_device ),GFP_KERNEL ))) {
@@ -260,7 +259,7 @@ static int __init ic_open_devs(void)else d->xid =0 ; ic_proto_have_if |= able; -pr_debug ("IP-Config: %s UP (able=%d, xid=%08x)\n" , +pr_debug ("%s UP (able=%d, xid=%08x)\n" , dev->name, able, d->xid); } }
@@ -287,7 +286,7 @@ static int __init ic_open_devs(void) elapsed =jiffies_to_msecs (jiffies - start); wait = (CONF_CARRIER_TIMEOUT - elapsed +500 )/1000 ; -pr_info ("Waiting up to %d more seconds for network.\n" , wait); +pr_info ("Waiting up to %d more seconds for network\n" , wait); next_msg = jiffies +msecs_to_jiffies (CONF_CARRIER_TIMEOUT /12 ); } have_carrier:
@@ -297,10 +296,9 @@ static int __init ic_open_devs(void)if (!ic_first_dev) {if (user_dev_name[0 ]) -pr_err ("IP-Config: Device `%s' not found\n" , - user_dev_name); +pr_err ("Device `%s' not found\n" , user_dev_name);else -pr_err ("IP-Config: No network devices available\n" ); +pr_err ("No network devices available\n" );return -ENODEV ; }return 0 ;
@@ -317,7 +315,7 @@ static void __init ic_close_devs(void) next = d->next; dev = d->dev;if (d != ic_dev && !netdev_uses_dsa (dev)) { -pr_debug ("IP-Config: Downing %s\n" , dev->name); +pr_debug ("Downing %s\n" , dev->name);dev_change_flags (dev, d->flags); }kfree (d);
@@ -351,20 +349,17 @@ static int __init ic_setup_if(void)strcpy (ir.ifr_ifrn.ifrn_name, ic_dev->dev->name);set_sockaddr (sin, ic_myaddr,0 );if ((err =devinet_ioctl (&init_net,SIOCSIFADDR , &ir)) <0 ) { -pr_err ("IP-Config: Unable to set interface address (%d)\n" , - err); +pr_err ("Unable to set interface address (%d)\n" , err);return -1 ; }set_sockaddr (sin, ic_netmask,0 );if ((err =devinet_ioctl (&init_net,SIOCSIFNETMASK , &ir)) <0 ) { -pr_err ("IP-Config: Unable to set interface netmask (%d)\n" , - err); +pr_err ("Unable to set interface netmask (%d)\n" , err);return -1 ; }set_sockaddr (sin, ic_myaddr | ~ic_netmask,0 );if ((err =devinet_ioctl (&init_net,SIOCSIFBRDADDR , &ir)) <0 ) { -pr_err ("IP-Config: Unable to set interface broadcast address (%d)\n" , - err); +pr_err ("Unable to set interface broadcast address (%d)\n" , err);return -1 ; }/* Handle the case where we need non-standard MTU on the boot link (a network
@@ -374,7 +369,7 @@ static int __init ic_setup_if(void)if (ic_dev_mtu !=0 ) {rtnl_lock ();if ((err =dev_set_mtu (ic_dev->dev, ic_dev_mtu)) <0 ) -pr_err ("IP-Config: Unable to set interface mtu to %d (%d)\n" , +pr_err ("Unable to set interface mtu to %d (%d)\n" , ic_dev_mtu, err);rtnl_unlock (); }
@@ -391,7 +386,7 @@ static int __init ic_setup_routes(void)memset (&rm,0 ,sizeof (rm));if ((ic_gateway ^ ic_myaddr) & ic_netmask) { -pr_err ("IP-Config: Gateway not on directly connected network\n" ); +pr_err ("Gateway not on directly connected network\n" );return -1 ; }set_sockaddr ((struct sockaddr_in *) &rm.rt_dst,0 ,0 );
@@ -399,8 +394,7 @@ static int __init ic_setup_routes(void)set_sockaddr ((struct sockaddr_in *) &rm.rt_gateway, ic_gateway,0 ); rm.rt_flags =RTF_UP |RTF_GATEWAY ;if ((err =ip_rt_ioctl (&init_net,SIOCADDRT , &rm)) <0 ) { -pr_err ("IP-Config: Cannot add default route (%d)\n" , - err); +pr_err ("Cannot add default route (%d)\n" , err);return -1 ; } }
@@ -433,12 +427,11 @@ static int __init ic_defaults(void)else if (IN_CLASSC (ntohl (ic_myaddr))) ic_netmask =htonl (IN_CLASSC_NET );else { -pr_err ("IP-Config: Unable to guess netmask for address %pI4\n" , +pr_err ("Unable to guess netmask for address %pI4\n" , &ic_myaddr);return -1 ; } -pr_notice ("IP-Config: Guessing netmask %pI4\n" , - &ic_netmask); +pr_notice ("Guessing netmask %pI4\n" , &ic_netmask); }return 0 ;
@@ -834,8 +827,8 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_delse if (dev->type ==ARPHRD_FDDI ) b->htype =ARPHRD_ETHER ;else { -pr_warn ("Unknown ARP type 0x%04x for device %s\n" , dev->type, - dev->name); +pr_warn ("Unknown ARP type 0x%04x for device %s\n" , + dev->type, dev->name); b->htype = dev->type;/* can cause undefined behavior */ }
@@ -1169,7 +1162,7 @@ static int __init ic_dynamic(void)* are missing, and without DHCP/BOOTP/RARP we are unable to get it. */ if (!ic_proto_enabled) { -pr_err ("IP-Config: Incomplete network configuration information\n" ); +pr_err ("Incomplete network configuration information\n" );return -1 ; }
@@ -1281,7 +1274,7 @@ static int __init ic_dynamic(void)return -1 ; } -pr_info ("IP-Config: Got %s answer from %pI4, my address is %pI4\n" , +pr_info ("Got %s answer from %pI4, my address is %pI4\n" , ((ic_got_reply &IC_RARP ) ?"RARP" : (ic_proto_enabled &IC_USE_DHCP ) ?"DHCP" :"BOOTP" ), &ic_addrservaddr, &ic_myaddr);
@@ -1479,7 +1472,7 @@ static int __init ip_auto_config(void)if (!ic_enable)return 0 ; -pr_debug ("IP-Config: Entered.\n" ); +pr_debug ("Entered\n" );#ifdef IPCONFIG_DYNAMIC try_try_again:#endif
@@ -1529,22 +1522,22 @@ static int __init ip_auto_config(void)*/ #ifdef CONFIG_ROOT_NFS if (ROOT_DEV == Root_NFS) { -pr_err ("IP-Config: Retrying forever (NFS root)...\n" ); +pr_err ("Retrying forever (NFS root)...\n" ); goto try_try_again; }#endif if (--retries) { -pr_err ("IP-Config: Reopening network devices...\n" ); +pr_err ("Reopening network devices...\n" ); goto try_try_again; }/* Oh, well. At least we tried. */ -pr_err ("IP-Config: Auto-configuration of network failed\n" ); +pr_err ("Auto-configuration of network failed\n" ); return -1; }#else /* !DYNAMIC */ -pr_err ("IP-Config: Incomplete network configuration information\n" ); +pr_err ("Incomplete network configuration information\n" );ic_close_devs ();return -1 ;#endif /* IPCONFIG_DYNAMIC */
@@ -1574,7 +1567,7 @@ static int __init ip_auto_config(void)/* * Clue in the operator. */ -pr_info ("IP-Config: Complete:\n" ); +pr_info ("Complete:\n" ); pr_info(" device=%s, hwaddr=%*phC, ipaddr=%pI4, mask=%pI4, gw=%pI4\n", ic_dev->dev->name, ic_dev->dev->addr_len, ic_dev->dev->dev_addr,
@@ -1718,7 +1711,7 @@ static int __init ip_auto_config_setup(char *addrs)if ((cp =strchr (ip,':' ))) *cp++ ='\0' ;if (strlen (ip) >0 ) { -pr_debug ("IP-Config: Parameter #%d: `%s'\n" , num, ip); +pr_debug ("Parameter #%d: `%s'\n" , num, ip);switch (num) {case 0 :if ((ic_myaddr =in_aton (ip)) ==ANY )
net/ipv4/ipmr.c +1 -1
@@ -1259,7 +1259,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt, ret =rhltable_insert_key (&mrt->mfc_hash, &c->cmparg, &c->_c.mnode, ipmr_rht_params);if (ret) { -pr_err ("ipmr: rhtable insert error %d\n" , ret); +pr_err ("rhtable insert error %d\n" , ret);ipmr_cache_free (c);return ret; }
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +4 -5
@@ -83,8 +83,7 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,/* Check bogus IP headers */ if (*dataoff > skb->len) { -pr_debug ("nf_conntrack_ipv4: bogus IPv4 packet: " -"nhoff %u, ihl %u, skblen %u\n" , +pr_debug ("bogus IPv4 packet: nhoff %u, ihl %u, skblen %u\n" , nhoff, iph->ihl <<2 , skb->len);return -NF_ACCEPT ; }
@@ -268,7 +267,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)else return 0 ; } -pr_debug ("SO_ORIGINAL_DST: Can't find %pI4/%u-%pI4/%u.\n" , +pr_debug ("SO_ORIGINAL_DST: Can't find %pI4/%u-%pI4/%u\n" , &tuple.src.u3.ip,ntohs (tuple.src.u.tcp.port), &tuple.dst.u3.ip,ntohs (tuple.dst.u.tcp.port));return -ENOENT ;
@@ -432,7 +431,7 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) ret =register_pernet_subsys (&ipv4_net_ops);if (ret <0 ) { -pr_err ("nf_conntrack_ipv4: can't register pernet ops\n" ); +pr_err ("can't register pernet ops\n" ); goto cleanup_sockopt; }
@@ -443,7 +442,7 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) ret =nf_ct_l3proto_register (&nf_conntrack_l3proto_ipv4);if (ret <0 ) { -pr_err ("nf_conntrack_ipv4: can't register ipv4 proto.\n" ); +pr_err ("can't register ipv4 proto\n" ); goto cleanup_l4proto; }
net/ipv6/ip6mr.c +1 -1
@@ -1458,7 +1458,7 @@ static int ip6mr_mfc_add(struct net *net, struct mr_table *mrt, err =rhltable_insert_key (&mrt->mfc_hash, &c->cmparg, &c->_c.mnode, ip6mr_rht_params);if (err) { -pr_err ("ip6mr: rhtable insert error %d\n" , err); +pr_err ("rhtable insert error %d\n" , err);ip6mr_cache_free (c);return err; }
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +3 -3
@@ -77,7 +77,7 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,if (skb_copy_bits (skb, nhoff + offsetof(struct ipv6hdr , nexthdr), &nexthdr,sizeof (nexthdr)) !=0 ) { -pr_debug ("ip6_conntrack_core: can't get nexthdr\n" ); +pr_debug ("can't get nexthdr\n" );return -NF_ACCEPT ; } protoff =ipv6_skip_exthdr (skb, extoff, &nexthdr, &frag_off);
@@ -86,7 +86,7 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,* IPv6 and possibly extensions headers, but it is tracked anyway */ if (protoff <0 || (frag_off &htons (~0x7 )) !=0 ) { -pr_debug ("ip6_conntrack_core: can't find proto in pkt\n" ); +pr_debug ("can't find proto in pkt\n" );return -NF_ACCEPT ; }
@@ -432,7 +432,7 @@ static int __init nf_conntrack_l3proto_ipv6_init(void) ret =nf_ct_l3proto_register (&nf_conntrack_l3proto_ipv6);if (ret <0 ) { -pr_err ("nf_conntrack_ipv6: can't register ipv6 proto.\n" ); +pr_err ("can't register ipv6 proto\n" ); goto cleanup_l4proto; }return ret;
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c +2 -2
@@ -111,12 +111,12 @@ static int __init nf_defrag_init(void) ret =nf_ct_frag6_init ();if (ret <0 ) { -pr_err ("nf_defrag_ipv6: can't initialize frag6.\n" ); +pr_err ("can't initialize frag6\n" );return ret; } ret =register_pernet_subsys (&defrag6_net_ops);if (ret <0 ) { -pr_err ("nf_defrag_ipv6: can't register pernet ops\n" ); +pr_err ("can't register pernet ops\n" ); goto cleanup_frag6; }return ret;
net/netfilter/nf_conntrack_helper.c +4 -7
@@ -74,7 +74,7 @@ static int nf_conntrack_helper_init_sysctl(struct net *net)register_net_sysctl (net,"net/netfilter" , table);if (!net->ct.helper_sysctl_header) { -pr_err ("nf_conntrack_helper: can't register to sysctl.\n" ); +pr_err ("can't register to sysctl\n" ); goto out_register; }return 0 ;
@@ -202,7 +202,7 @@ nf_ct_helper_ext_add(struct nf_conn *ct,if (help)INIT_HLIST_HEAD (&help->expectations);else -pr_debug ("failed to add helper extension area" ); +pr_debug ("failed to add helper extension area\n" );return help; }EXPORT_SYMBOL_GPL (nf_ct_helper_ext_add);
@@ -215,10 +215,7 @@ nf_ct_lookup_helper(struct nf_conn *ct, struct net *net)return NULL ;if (!__nf_ct_helper_find (&ct->tuplehash[IP_CT_DIR_REPLY ].tuple))return NULL ; -pr_info ("nf_conntrack: default automatic helper assignment " -"has been turned off for security reasons and CT-based " -" firewall rule not found. Use the iptables CT target " -"to attach helpers instead.\n" ); +pr_info ("default automatic helper assignment has been turned off for security reasons and CT-based firewall rule not found. Use the iptables CT target to attach helpers instead.\n" ); net->ct.auto_assign_helper_warned =1 ;return NULL ; }
@@ -553,7 +550,7 @@ int nf_conntrack_helper_init(void) ret =nf_ct_extend_register (&helper_extend);if (ret <0 ) { -pr_err ("nf_ct_helper: Unable to register helper extension.\n" ); +pr_err ("Unable to register helper extension\n" ); goto out_extend; }
net/netfilter/nf_conntrack_standalone.c +1 -1
@@ -720,7 +720,7 @@ static int __init nf_conntrack_standalone_init(void) nf_ct_netfilter_header =register_net_sysctl (&init_net,"net" , nf_ct_netfilter_table);if (!nf_ct_netfilter_header) { -pr_err ("nf_conntrack: can't register to sysctl.\n" ); +pr_err ("can't register to sysctl\n" ); ret = -ENOMEM ; goto out_sysctl; }
net/socket.c +1 -1
@@ -1248,7 +1248,7 @@ int __sock_create(struct net *net, int family, int type, int protocol,*/ sock =sock_alloc ();if (!sock) { -net_warn_ratelimited ("socket: no more sockets\n" ); +net_warn_ratelimited ("no more sockets\n" );return -ENFILE ;/* Not exactly a match, but its the closest posix thing */ }
Signature · 1 line
2.15.0
PATCH 7/18 blk-mq: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- block/blk-mq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
block/blk-mq.c +4 -5
@@ -2782,13 +2782,13 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) }while (set->queue_depth);if (!set->queue_depth || err) { -pr_err ("blk-mq: failed to allocate request map\n" ); +pr_err ("failed to allocate request map\n" );return -ENOMEM ; }if (depth != set->queue_depth) -pr_info ("blk-mq: reduced tag depth (%u -> %u)\n" , - depth, set->queue_depth); +pr_info ("reduced tag depth (%u -> %u)\n" , + depth, set->queue_depth);return 0 ; }
@@ -2845,8 +2845,7 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)return -EINVAL ;if (set->queue_depth >BLK_MQ_MAX_DEPTH ) { -pr_info ("blk-mq: reduced tag depth to %u\n" , -BLK_MQ_MAX_DEPTH ); +pr_info ("reduced tag depth to %u\n" ,BLK_MQ_MAX_DEPTH ); set->queue_depth =BLK_MQ_MAX_DEPTH ; }
Signature · 1 line
2.15.0
PATCH 8/18 random: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- drivers/char/hw_random/via-rng.c | 10 +++++----- drivers/char/random.c | 16 +++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-)
drivers/char/hw_random/via-rng.c +5 -5
@@ -24,6 +24,8 @@* warranty of any kind, whether express or implied. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <crypto/padlock.h> #include <linux/module.h> #include <linux/kernel.h>
@@ -137,8 +139,7 @@ static int via_rng_init(struct hwrng *rng)* register */ if (((c->x86 ==6 ) && (c->x86_model >=0x0f )) || (c->x86 >6 )){if (!boot_cpu_has (X86_FEATURE_XSTORE_EN )) { -pr_err (PFX "can't enable hardware RNG " -"if XSTORE is not enabled\n" ); +pr_err ("can't enable hardware RNG if XSTORE is not enabled\n" );return -ENODEV ; }return 0 ;
@@ -176,7 +177,7 @@ static int via_rng_init(struct hwrng *rng)unneeded */ rdmsr (MSR_VIA_RNG , lo, hi);if ((lo &VIA_RNG_ENABLE ) ==0 ) { -pr_err (PFX "cannot enable VIA C3 RNG, aborting\n" ); +pr_err ("cannot enable VIA C3 RNG, aborting\n" );return -ENODEV ; }
@@ -202,8 +203,7 @@ static int __init mod_init(void)pr_info ("VIA RNG detected\n" ); err =hwrng_register (&via_rng);if (err) { -pr_err (PFX "RNG registering failed (%d)\n" , - err); +pr_err ("RNG registering failed (%d)\n" , err); goto out; } out:
drivers/char/random.c +7 -9
@@ -693,7 +693,7 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits) }if (unlikely (entropy_count <0 )) { -pr_warn ("random: negative entropy/overflow: pool %s count %d\n" , +pr_warn ("negative entropy/overflow: pool %s count %d\n" , r->name, entropy_count);WARN_ON (1 ); entropy_count =0 ;
@@ -857,7 +857,7 @@ static int crng_fast_load(const char *cp, size_t len)invalidate_batched_entropy (); crng_init =1 ;wake_up_interruptible (&crng_init_wait); -pr_notice ("random: fast init done\n" ); +pr_notice ("fast init done\n" ); }return 1 ; }
@@ -942,16 +942,14 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) crng_init =2 ;process_random_ready_list ();wake_up_interruptible (&crng_init_wait); -pr_notice ("random: crng init done\n" ); +pr_notice ("crng init done\n" );if (unseeded_warning.missed) { -pr_notice ("random: %d get_random_xx warning(s) missed " -"due to ratelimiting\n" , +pr_notice ("%d get_random_xx warning(s) missed due to ratelimiting\n" , unseeded_warning.missed); unseeded_warning.missed =0 ; }if (urandom_warning.missed) { -pr_notice ("random: %d urandom warning(s) missed " -"due to ratelimiting\n" , +pr_notice ("%d urandom warning(s) missed due to ratelimiting\n" , urandom_warning.missed); urandom_warning.missed =0 ; }
@@ -1380,7 +1378,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, ibytes =0 ;if (unlikely (entropy_count <0 )) { -pr_warn ("random: negative entropy count: pool %s count %d\n" , +pr_warn ("negative entropy count: pool %s count %d\n" , r->name, entropy_count);WARN_ON (1 ); entropy_count =0 ;
@@ -1596,7 +1594,7 @@ static void _warn_unseeded_randomness(const char *func_name, void *caller, print_once = true;#endif if (__ratelimit (&unseeded_warning)) -pr_notice ("random: %s called from %pS with crng_init=%d\n" , +pr_notice ("%s called from %pS with crng_init=%d\n" , func_name, caller, crng_init); }
Signature · 1 line
2.15.0
PATCH 9/18 ptp: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- drivers/ptp/ptp_clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ptp/ptp_clock.c +2 -2
@@ -396,13 +396,13 @@ static int __init ptp_init(void) ptp_class =class_create (THIS_MODULE ,"ptp" );if (IS_ERR (ptp_class)) { -pr_err ("ptp: failed to allocate class\n" ); +pr_err ("failed to allocate class\n" );return PTR_ERR (ptp_class); } err =alloc_chrdev_region (&ptp_devt,0 ,MINORMASK +1 ,"ptp" );if (err <0 ) { -pr_err ("ptp: failed to allocate device region\n" ); +pr_err ("failed to allocate device region\n" ); goto no_region; }
Signature · 1 line
2.15.0
PATCH 10/18 efifb: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- drivers/video/fbdev/efifb.c | 48 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 25 deletions(-)
drivers/video/fbdev/efifb.c +23 -25
@@ -250,13 +250,13 @@ static int efifb_probe(struct platform_device *dev) }else {/* We cannot make this fatal. Sometimes this comes from magic spaces our resource handlers simply don't know about */ -pr_warn ("efifb: cannot reserve video memory at 0x%lx\n" , +pr_warn ("cannot reserve video memory at 0x%lx\n" , efifb_fix.smem_start); } info =framebuffer_alloc (sizeof (u32) *16 , &dev->dev);if (!info) { -pr_err ("efifb: cannot allocate framebuffer\n" ); +pr_err ("cannot allocate framebuffer\n" ); err = -ENOMEM ; goto err_release_mem; }
@@ -277,23 +277,23 @@ static int efifb_probe(struct platform_device *dev)else info->screen_base =ioremap_wc (efifb_fix.smem_start, efifb_fix.smem_len);if (!info->screen_base) { -pr_err ("efifb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n" , - efifb_fix.smem_len, efifb_fix.smem_start); +pr_err ("abort, cannot ioremap video memory 0x%x @ 0x%lx\n" , + efifb_fix.smem_len, efifb_fix.smem_start); err = -EIO ; goto err_release_fb; } -pr_info ("efifb: framebuffer at 0x%lx, using %dk, total %dk\n" , - efifb_fix.smem_start, size_remap/1024 , size_total/1024 ); -pr_info ("efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n" , - efifb_defined.xres, efifb_defined.yres, - efifb_defined.bits_per_pixel, efifb_fix.line_length, - screen_info.pages); +pr_info ("framebuffer at 0x%lx, using %dk, total %dk\n" , + efifb_fix.smem_start, size_remap/1024 , size_total/1024 ); +pr_info ("mode is %dx%dx%d, linelength=%d, pages=%d\n" , + efifb_defined.xres, efifb_defined.yres, + efifb_defined.bits_per_pixel, efifb_fix.line_length, + screen_info.pages); efifb_defined.xres_virtual = efifb_defined.xres; efifb_defined.yres_virtual = efifb_fix.smem_len / efifb_fix.line_length; -pr_info ("efifb: scrolling: redraw\n" ); +pr_info ("scrolling: redraw\n" ); efifb_defined.yres_virtual = efifb_defined.yres;/* some dummy values for timing to make fbset happy */
@@ -311,17 +311,15 @@ static int efifb_probe(struct platform_device *dev) efifb_defined.transp.offset = screen_info.rsvd_pos; efifb_defined.transp.length = screen_info.rsvd_size; -pr_info ("efifb: %s: " -"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n" , -"Truecolor" , - screen_info.rsvd_size, - screen_info.red_size, - screen_info.green_size, - screen_info.blue_size, - screen_info.rsvd_pos, - screen_info.red_pos, - screen_info.green_pos, - screen_info.blue_pos); +pr_info ("Truecolor: size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n" , + screen_info.rsvd_size, + screen_info.red_size, + screen_info.green_size, + screen_info.blue_size, + screen_info.rsvd_pos, + screen_info.red_pos, + screen_info.green_pos, + screen_info.blue_pos); efifb_fix.ypanstep =0 ; efifb_fix.ywrapstep =0 ;
@@ -350,17 +348,17 @@ static int efifb_probe(struct platform_device *dev) err =sysfs_create_groups (&dev->dev.kobj, efifb_groups);if (err) { -pr_err ("efifb: cannot add sysfs attrs\n" ); +pr_err ("cannot add sysfs attrs\n" ); goto err_unmap; } err =fb_alloc_cmap (&info->cmap,256 ,0 );if (err <0 ) { -pr_err ("efifb: cannot allocate colormap\n" ); +pr_err ("cannot allocate colormap\n" ); goto err_groups; } err =register_framebuffer (info);if (err <0 ) { -pr_err ("efifb: cannot register framebuffer\n" ); +pr_err ("cannot register framebuffer\n" ); goto err_fb_dealoc; }fb_info (info,"%s frame buffer device\n" , info->fix.id);
Signature · 1 line
2.15.0
PATCH 15/18 security: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- security/selinux/selinuxfs.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
security/selinux/selinuxfs.c +14 -15
@@ -515,19 +515,19 @@ static int sel_make_policy_nodes(struct selinux_fs_info *fsi) ret =sel_make_bools (fsi);if (ret) { -pr_err ("SELinux: failed to load policy booleans\n" ); +pr_err ("failed to load policy booleans\n" );return ret; } ret =sel_make_classes (fsi);if (ret) { -pr_err ("SELinux: failed to load policy classes\n" ); +pr_err ("failed to load policy classes\n" );return ret; } ret =sel_make_policycap (fsi);if (ret) { -pr_err ("SELinux: failed to load policy capabilities\n" ); +pr_err ("failed to load policy capabilities\n" );return ret; }
@@ -570,7 +570,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf, length =security_load_policy (fsi->state, data, count);if (length) { -pr_warn_ratelimited ("SELinux: failed to load policy\n" ); +pr_warn_ratelimited ("failed to load policy\n" ); goto out; }
@@ -620,8 +620,8 @@ static ssize_t sel_write_context(struct file *file, char *buf, size_t size) length = -ERANGE ;if (len >SIMPLE_TRANSACTION_LIMIT ) { -printk (KERN_ERR "SELinux: %s: context size (%u) exceeds " -"payload max\n" , __func__, len); +pr_err ("%s: context size (%u) exceeds payload max\n" , + __func__, len); goto out; }
@@ -956,8 +956,8 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size) length = -ERANGE ;if (len >SIMPLE_TRANSACTION_LIMIT ) { -printk (KERN_ERR "SELinux: %s: context size (%u) exceeds " -"payload max\n" , __func__, len); +pr_err ("%s: context size (%u) exceeds payload max\n" , + __func__, len); goto out; }
@@ -1147,8 +1147,8 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size) length = -ERANGE ;if (len >SIMPLE_TRANSACTION_LIMIT ) { -printk (KERN_ERR "SELinux: %s: context size (%u) exceeds " -"payload max\n" , __func__, len); +pr_err ("%s: context size (%u) exceeds payload max\n" , + __func__, len); goto out; }
@@ -1389,8 +1389,8 @@ static int sel_make_bools(struct selinux_fs_info *fsi) ret =security_genfs_sid (fsi->state,"selinuxfs" , page,SECCLASS_FILE , &sid);if (ret) { -pr_warn_ratelimited ("SELinux: no sid found, defaulting to security isid for %s\n" , - page); +pr_warn_ratelimited ("no sid found, defaulting to security isid for %s\n" , + page); sid =SECINITSID_SECURITY ; }
@@ -1996,8 +1996,7 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent) goto err;return 0 ; err: -printk (KERN_ERR "SELinux: %s: failed while creating inodes\n" , - __func__); +pr_err ("%s: failed while creating inodes\n" , __func__);selinux_fs_info_free (sb);
@@ -2046,7 +2045,7 @@ static int __init init_sel_fs(void) selinux_null.mnt = selinuxfs_mount =kern_mount (&sel_fs_type);if (IS_ERR (selinuxfs_mount)) { -printk (KERN_ERR "selinuxfs: could not mount!\n" ); +pr_err ("selinuxfs: could not mount!\n" ); err =PTR_ERR (selinuxfs_mount); selinuxfs_mount =NULL ; }
Signature · 6 lines
2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 16/18 aoe: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- drivers/block/aoe/aoeblk.c | 29 ++++++++++++++--------------- drivers/block/aoe/aoechr.c | 11 +++++------ drivers/block/aoe/aoecmd.c | 34 ++++++++++++++++------------------ drivers/block/aoe/aoedev.c | 19 +++++++------------ drivers/block/aoe/aoemain.c | 6 +++--- drivers/block/aoe/aoenet.c | 19 ++++++++----------- 6 files changed, 53 insertions(+), 65 deletions(-)
drivers/block/aoe/aoeblk.c +14 -15
@@ -205,7 +205,7 @@ aoedisk_add_debugfs(struct aoedev *d) entry =debugfs_create_file (p,0444 , aoe_debugfs_dir, d, &aoe_debugfs_fops);if (IS_ERR_OR_NULL (entry)) { -pr_info ("aoe: cannot create debugfs file for %s\n" , +pr_info ("cannot create debugfs file for %s\n" , d->gd->disk_name);return ; }
@@ -237,8 +237,7 @@ aoeblk_open(struct block_device *bdev, fmode_t mode)ulong flags;if (!virt_addr_valid (d)) { -pr_crit ("aoe: invalid device pointer in %s\n" , - __func__); +pr_crit ("invalid device pointer in %s\n" , __func__);WARN_ON (1 );return -ENODEV ; }
@@ -282,8 +281,8 @@ aoeblk_request(struct request_queue *q) d = q->queuedata;if ((d->flags &DEVFL_UP ) ==0 ) { -pr_info_ratelimited ("aoe: device %ld.%d is not up\n" , - d->aoemajor, d->aoeminor); +pr_info_ratelimited ("device %ld.%d is not up\n" , + d->aoemajor, d->aoeminor);while ((rq =blk_peek_request (q))) {blk_start_request (rq);aoe_end_request (d, rq,1 );
@@ -299,7 +298,7 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)struct aoedev *d = bdev->bd_disk->private_data;if ((d->flags &DEVFL_UP ) ==0 ) { -printk (KERN_ERR "aoe: disk not up\n" ); +pr_err ("disk not up\n" );return -ENODEV ; }
@@ -319,7 +318,7 @@ aoeblk_ioctl(struct block_device *bdev, fmode_t mode, uint cmd, ulong arg) d = bdev->bd_disk->private_data;if ((d->flags &DEVFL_UP ) ==0 ) { -pr_err ("aoe: disk not up\n" ); +pr_err ("disk not up\n" );return -ENODEV ; }
@@ -332,7 +331,7 @@ aoeblk_ioctl(struct block_device *bdev, fmode_t mode, uint cmd, ulong arg)/* udev calls scsi_id, which uses SG_IO, resulting in noise */ if (cmd !=SG_IO ) -pr_info ("aoe: unknown ioctl 0x%x\n" , cmd); +pr_info ("unknown ioctl 0x%x\n" , cmd);return -ENOTTY ; }
@@ -370,22 +369,22 @@ aoeblk_gdalloc(void *vp) gd =alloc_disk (AOE_PARTITIONS );if (gd ==NULL ) { -pr_err ("aoe: cannot allocate disk structure for %ld.%d\n" , - d->aoemajor, d->aoeminor); +pr_err ("cannot allocate disk structure for %ld.%d\n" , + d->aoemajor, d->aoeminor); goto err; } mp =mempool_create (MIN_BUFS , mempool_alloc_slab, mempool_free_slab, buf_pool_cache);if (mp ==NULL ) { -printk (KERN_ERR "aoe: cannot allocate bufpool for %ld.%d\n" , - d->aoemajor, d->aoeminor); +pr_err ("cannot allocate bufpool for %ld.%d\n" , + d->aoemajor, d->aoeminor); goto err_disk; } q =blk_init_queue (aoeblk_request, &d->lock);if (q ==NULL ) { -pr_err ("aoe: cannot allocate block queue for %ld.%d\n" , - d->aoemajor, d->aoeminor); +pr_err ("cannot allocate block queue for %ld.%d\n" , + d->aoemajor, d->aoeminor); goto err_mempool; }blk_queue_bounce_limit (q,BLK_BOUNCE_HIGH );
@@ -457,7 +456,7 @@ aoeblk_init(void)return -ENOMEM ; aoe_debugfs_dir =debugfs_create_dir ("aoe" ,NULL );if (IS_ERR_OR_NULL (aoe_debugfs_dir)) { -pr_info ("aoe: cannot create debugfs directory\n" ); +pr_info ("cannot create debugfs directory\n" ); aoe_debugfs_dir =NULL ; }return 0 ;
drivers/block/aoe/aoechr.c +5 -6
@@ -69,8 +69,7 @@ static int interfaces(const char __user *str, size_t size) { if (set_aoe_iflist(str, size)) { -printk (KERN_ERR -"aoe: could not set interface list: too many interfaces\n" ); +pr_err ("could not set interface list: too many interfaces\n" );return -EINVAL ; }return 0 ;
@@ -93,7 +92,7 @@ revalidate(const char __user *str, size_t size) n =sscanf (buf,"e%d.%d" , &major, &minor);if (n !=2 ) { -pr_err ("aoe: invalid device specification %s\n" , buf); +pr_err ("invalid device specification %s\n" , buf);return -EINVAL ; } d =aoedev_by_aoeaddr (major, minor,0 );
@@ -141,7 +140,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags); mp =kmemdup (msg, n,GFP_ATOMIC );if (mp ==NULL ) { -printk (KERN_ERR "aoe: allocation failure, len=%ld\n" , n); +pr_err ("allocation failure, len=%ld\n" , n); goto bail; }
@@ -165,7 +164,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offpswitch ((unsigned long ) filp->private_data) {default : -printk (KERN_INFO "aoe: can't write to that file.\n" ); +pr_info ("can't write to that file\n" );break ;case MINOR_DISCOVER : ret =discover ();
@@ -287,7 +286,7 @@ aoechr_init(void) n =register_chrdev (AOE_MAJOR ,"aoechr" , &aoe_fops);if (n <0 ) { -printk (KERN_ERR "aoe: can't register char device\n" ); +pr_err ("can't register char device\n" );return n; }init_completion (&emsgs_comp);
drivers/block/aoe/aoecmd.c +16 -18
@@ -256,7 +256,7 @@ newframe(struct aoedev *d)int has_untainted;if (!d->targets || !d->targets[0 ]) { -printk (KERN_ERR "aoe: NULL TARGETS!\n" ); +pr_err ("NULL TARGETS!\n" );return NULL ; } tt = d->tgt;/* last used target */
@@ -425,7 +425,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff_head *qu skb =new_skb (sizeof *h +sizeof *ch);if (skb ==NULL ) { -printk (KERN_INFO "aoe: skb alloc failure\n" ); +pr_info ("skb alloc failure\n" ); goto cont; }skb_put (skb,sizeof *h +sizeof *ch);
@@ -463,7 +463,7 @@ resend(struct aoedev *d, struct frame *f) skb = f->skb;if (ifrotate (t) ==NULL ) {/* probably can't happen, but set it up to fail anyway */ -pr_info ("aoe: resend: no interfaces to rotate to.\n" ); +pr_info ("resend: no interfaces to rotate to\n" );ktcomplete (f,NULL );return ; }
@@ -867,7 +867,7 @@ nextbuf(struct aoedev *d) } buf =mempool_alloc (d->bufpool,GFP_ATOMIC );if (buf ==NULL ) { -pr_err ("aoe: nextbuf: unable to mempool_alloc!\n" ); +pr_err ("nextbuf: unable to mempool_alloc!\n" );return NULL ; } bio = d->ip.nxbio;
@@ -968,8 +968,7 @@ ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)memcpy (d->ident, id,sizeof (d->ident));if (d->ssize != ssize) -printk (KERN_INFO -"aoe: %pm e%ld.%d v%04x has %llu sectors\n" , +pr_info ("%pm e%ld.%d v%04x has %llu sectors\n" , t->addr, d->aoemajor, d->aoeminor, d->fw_ver, (long long )ssize);
@@ -1107,9 +1106,9 @@ ktiocomplete(struct frame *f) ahin = (struct aoe_atahdr *) skb->data;skb_pull (skb,sizeof (*ahin));if (ahin->cmdstat &0xa9 ) {/* these bits cleared on success */ -pr_err ("aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%d\n" , - ahout->cmdstat, ahin->cmdstat, - d->aoemajor, d->aoeminor); +pr_err ("ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%d\n" , + ahout->cmdstat, ahin->cmdstat, + d->aoemajor, d->aoeminor); noskb:if (buf) buf->bio->bi_status =BLK_STS_IOERR ; goto out;
@@ -1159,7 +1158,7 @@ noskb: if (buf)spin_unlock_irq (&d->lock);break ;default : -pr_info ("aoe: unrecognized ata command %2.2Xh for %d.%d\n" , +pr_info ("unrecognized ata command %2.2Xh for %d.%d\n" , ahout->cmdstat,be16_to_cpu (get_unaligned (&hin->major)), hin->minor);
@@ -1466,7 +1465,7 @@ addtgt(struct aoedev *d, char *addr, ulong nframes)return *tt = t; nomem: -pr_info ("aoe: cannot allocate memory to add target\n" ); +pr_info ("cannot allocate memory to add target\n" );return NULL ; }
@@ -1483,7 +1482,7 @@ setdbcnt(struct aoedev *d) bcnt = (*t)->minbcnt;if (bcnt != d->maxbcnt) { d->maxbcnt = bcnt; -pr_info ("aoe: e%ld.%d: setting %d byte data frames\n" , +pr_info ("e%ld.%d: setting %d byte data frames\n" , d->aoemajor, d->aoeminor, bcnt); } }
@@ -1510,7 +1509,7 @@ setifbcnt(struct aoetgt *t, struct net_device *nd, int bcnt) }if (nd) {if (p == e) { -pr_err ("aoe: device setifbcnt failure; too many interfaces.\n" ); +pr_err ("device setifbcnt failure; too many interfaces\n" );return ; }dev_hold (nd);
@@ -1543,17 +1542,16 @@ aoecmd_cfg_rsp(struct sk_buff *skb)*/ aoemajor =get_unaligned_be16 (&h->major);if (aoemajor ==0xfff ) { -printk (KERN_ERR "aoe: Warning: shelf address is all ones. " -"Check shelf dip switches.\n" ); +pr_err ("Warning: shelf address is all ones. Check shelf dip switches.\n" );return ; }if (aoemajor ==0xffff ) { -pr_info ("aoe: e%ld.%d: broadcast shelf number invalid\n" , +pr_info ("e%ld.%d: broadcast shelf number invalid\n" , aoemajor, (int ) h->minor);return ; }if (h->minor ==0xff ) { -pr_info ("aoe: e%ld.%d: broadcast slot number invalid\n" , +pr_info ("e%ld.%d: broadcast slot number invalid\n" , aoemajor, (int ) h->minor);return ; }
@@ -1564,7 +1562,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) d =aoedev_by_aoeaddr (aoemajor, h->minor,1 );if (d ==NULL ) { -pr_info ("aoe: device allocation failure\n" ); +pr_info ("device allocation failure\n" );return ; }
drivers/block/aoe/aoedev.c +7 -12
@@ -69,8 +69,7 @@ minor_get_static(ulong *sysminor, ulong aoemaj, int aoemin) };if (aoemin >=NPERSHELF ) { -pr_err ("aoe: %s %d slots per shelf\n" , -"static minor device numbers support only" , +pr_err ("static minor device numbers support only %d slots per shelf\n" ,NPERSHELF ); error =-1 ; goto out;
@@ -78,18 +77,16 @@ minor_get_static(ulong *sysminor, ulong aoemaj, int aoemin) n = aoemaj *NPERSHELF + aoemin;if (n >=N_DEVS ) { -pr_err ("aoe: %s with e%ld.%d\n" , -"cannot use static minor device numbers" , - aoemaj, aoemin); +pr_err ("cannot use static minor device numbers with e%ld.%d\n" , + aoemaj, aoemin); error =-1 ; goto out; }spin_lock_irqsave (&used_minors_lock, flags);if (test_bit (n, used_minors)) { -pr_err ("aoe: %s %lu\n" , -"existing device already has static minor number" , - n); +pr_err ("existing device already has static minor number %lu\n" , + n); error =-1 ; }else set_bit (n, used_minors);
@@ -404,10 +401,8 @@ skbfree(struct sk_buff *skb)while (atomic_read (&skb_shinfo (skb)->dataref) !=1 && i-- >0 )msleep (Sms);if (i <0 ) { -printk (KERN_ERR -"aoe: %s holds ref: %s\n" , - skb->dev ? skb->dev->name :"netif" , -"cannot free skb -- memory leaked." ); +pr_err ("%s holds ref: cannot free skb -- memory leaked\n" , + skb->dev ? skb->dev->name :"netif" );return ; } skb->truesize -= skb->data_len;
drivers/block/aoe/aoemain.c +3 -3
@@ -59,10 +59,10 @@ aoe_init(void) goto cmd_fail; ret =register_blkdev (AOE_MAJOR ,DEVICE_NAME );if (ret <0 ) { -printk (KERN_ERR "aoe: can't register major\n" ); +pr_err ("can't register major\n" ); goto blkreg_fail; } -printk (KERN_INFO "aoe: AoE v%s initialised.\n" ,VERSION ); +pr_info ("AoE v%s initialised\n" ,VERSION );timer_setup (&timer, discover_timer,0 );discover_timer (&timer);
@@ -78,7 +78,7 @@ aoe_init(void) chr_fail:aoedev_exit (); -printk (KERN_INFO "aoe: initialisation failure.\n" ); +pr_info ("initialisation failure\n" );return ret; }
drivers/block/aoe/aoenet.c +8 -11
@@ -61,9 +61,8 @@ tx(int id) __must_hold(&txlock)spin_unlock_irq (&txlock); ifp = skb->dev;if (dev_queue_xmit (skb) ==NET_XMIT_DROP &&net_ratelimit ()) -pr_warn ("aoe: packet could not be sent on %s. %s\n" , - ifp ? ifp->name :"netif" , -"consider increasing tx_queue_len" ); +pr_warn ("packet could not be sent on %s - consider increasing tx_queue_len\n" , + ifp ? ifp->name :"netif" );spin_lock_irq (&txlock); }return 0 ;
@@ -102,7 +101,7 @@ set_aoe_iflist(const char __user *user_str, size_t size)return -EINVAL ;if (copy_from_user (aoe_iflist, user_str, size)) { -printk (KERN_INFO "aoe: copy from user failed\n" ); +pr_info ("copy from user failed\n" );return -EFAULT ; } aoe_iflist[size] =0x00 ;
@@ -160,12 +159,10 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,if (n >NECODES ) n =0 ;if (net_ratelimit ()) -printk (KERN_ERR -"%s%d.%d@%s; ecode=%d '%s'\n" , -"aoe: error packet from " , -get_unaligned_be16 (&h->major), - h->minor, skb->dev->name, - h->err, aoe_errlist[n]); +pr_err ("error packet from %d.%d@%s; ecode=%d '%s'\n" , +get_unaligned_be16 (&h->major), + h->minor, skb->dev->name, + h->err, aoe_errlist[n]); goto exit; }
@@ -180,7 +177,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,default :if (h->cmd >=AOECMD_VEND_MIN )break ;/* don't complain about vendor commands */ -pr_info ("aoe: unknown AoE command type 0x%02x\n" , h->cmd); +pr_info ("unknown AoE command type 0x%02x\n" , h->cmd);break ; }
Signature · 1 line
2.15.0
PATCH 17/18 security: encrypted-keys: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- security/keys/encrypted-keys/encrypted.c | 63 ++++++++++++++------------------ 1 file changed, 28 insertions(+), 35 deletions(-)
security/keys/encrypted-keys/encrypted.c +28 -35
@@ -84,8 +84,7 @@ static int aes_get_sizes(void) tfm =crypto_alloc_skcipher (blkcipher_alg,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (tfm)) { -pr_err ("encrypted_key: failed to alloc_cipher (%ld)\n" , -PTR_ERR (tfm)); +pr_err ("failed to alloc_cipher (%ld)\n" ,PTR_ERR (tfm));return PTR_ERR (tfm); } ivsize =crypto_skcipher_ivsize (tfm);
@@ -106,15 +105,14 @@ static int valid_ecryptfs_desc(const char *ecryptfs_desc)int i;if (strlen (ecryptfs_desc) !=KEY_ECRYPTFS_DESC_LEN ) { -pr_err ("encrypted_key: key description must be %d hexadecimal " -"characters long\n" ,KEY_ECRYPTFS_DESC_LEN ); +pr_err ("key description must be %d hexadecimal characters long\n" , +KEY_ECRYPTFS_DESC_LEN );return -EINVAL ; }for (i =0 ; i <KEY_ECRYPTFS_DESC_LEN ; i++) {if (!isxdigit (ecryptfs_desc[i])) { -pr_err ("encrypted_key: key description must contain " -"only hexadecimal characters\n" ); +pr_err ("key description must contain only hexadecimal characters\n" );return -EINVAL ; } }
@@ -180,7 +178,7 @@ static int datablob_parse(char *datablob, const char **format, keyword =strsep (&datablob," \t" );if (!keyword) { -pr_info ("encrypted_key: insufficient parameters specified\n" ); +pr_info ("insufficient parameters specified\n" );return ret; } key_cmd =match_token (keyword, key_tokens, args);
@@ -188,7 +186,7 @@ static int datablob_parse(char *datablob, const char **format,/* Get optional format: default | ecryptfs */ p =strsep (&datablob," \t" );if (!p) { -pr_err ("encrypted_key: insufficient parameters specified\n" ); +pr_err ("insufficient parameters specified\n" );return ret; }
@@ -205,20 +203,20 @@ static int datablob_parse(char *datablob, const char **format, }if (!*master_desc) { -pr_info ("encrypted_key: master key parameter is missing\n" ); +pr_info ("master key parameter is missing\n" ); goto out; }if (valid_master_desc (*master_desc,NULL ) <0 ) { -pr_info ("encrypted_key: master key parameter \'%s\' " -"is invalid\n" , *master_desc); +pr_info ("master key parameter \'%s\' is invalid\n" , + *master_desc); goto out; }if (decrypted_datalen) { *decrypted_datalen =strsep (&datablob," \t" );if (!*decrypted_datalen) { -pr_info ("encrypted_key: keylen parameter is missing\n" ); +pr_info ("keylen parameter is missing\n" ); goto out; } }
@@ -226,37 +224,35 @@ static int datablob_parse(char *datablob, const char **format,switch (key_cmd) {case Opt_new:if (!decrypted_datalen) { -pr_info ("encrypted_key: keyword \'%s\' not allowed " -"when called from .update method\n" , keyword); +pr_info ("keyword \'%s\' not allowed when called from .update method\n" , + keyword);break ; } ret =0 ;break ;case Opt_load:if (!decrypted_datalen) { -pr_info ("encrypted_key: keyword \'%s\' not allowed " -"when called from .update method\n" , keyword); +pr_info ("keyword \'%s\' not allowed when called from .update method\n" , + keyword);break ; } *hex_encoded_iv =strsep (&datablob," \t" );if (!*hex_encoded_iv) { -pr_info ("encrypted_key: hex blob is missing\n" ); +pr_info ("hex blob is missing\n" );break ; } ret =0 ;break ;case Opt_update:if (decrypted_datalen) { -pr_info ("encrypted_key: keyword \'%s\' not allowed " -"when called from .instantiate method\n" , +pr_info ("keyword \'%s\' not allowed when called from .instantiate method\n" , keyword);break ; } ret =0 ;break ;case Opt_err: -pr_info ("encrypted_key: keyword \'%s\' not recognized\n" , - keyword); +pr_info ("keyword \'%s\' not recognized\n" , keyword);break ; } out:
@@ -344,7 +340,7 @@ static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen, tfm =crypto_alloc_shash (hmac_alg,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (tfm)) { -pr_err ("encrypted_key: can't alloc %s transform: %ld\n" , +pr_err ("can't alloc %s transform: %ld\n" , hmac_alg,PTR_ERR (tfm));return PTR_ERR (tfm); }
@@ -395,22 +391,21 @@ static struct skcipher_request *init_skcipher_req(const u8 *key, tfm =crypto_alloc_skcipher (blkcipher_alg,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (tfm)) { -pr_err ("encrypted_key: failed to load %s transform (%ld)\n" , +pr_err ("failed to load %s transform (%ld)\n" , blkcipher_alg,PTR_ERR (tfm));return ERR_CAST (tfm); } ret =crypto_skcipher_setkey (tfm, key, key_len);if (ret <0 ) { -pr_err ("encrypted_key: failed to setkey (%d)\n" , ret); +pr_err ("failed to setkey (%d)\n" , ret);crypto_free_skcipher (tfm);return ERR_PTR (ret); } req =skcipher_request_alloc (tfm,GFP_KERNEL );if (!req) { -pr_err ("encrypted_key: failed to allocate request for %s\n" , - blkcipher_alg); +pr_err ("failed to allocate request for %s\n" , blkcipher_alg);crypto_free_skcipher (tfm);return ERR_PTR (-ENOMEM ); }
@@ -441,11 +436,10 @@ static struct key *request_master_key(struct encrypted_key_payload *epayload,int ret =PTR_ERR (mkey);if (ret = -ENOTSUPP ) -pr_info ("encrypted_key: key %s not supported" , +pr_info ("key %s not supported\n" , epayload->master_desc);else -pr_info ("encrypted_key: key %s not found" , - epayload->master_desc); +pr_info ("key %s not found\n" , epayload->master_desc); goto out; }
@@ -490,7 +484,7 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload,skcipher_request_free (req);crypto_free_skcipher (tfm);if (ret <0 ) -pr_err ("encrypted_key: failed to encrypt (%d)\n" , ret); +pr_err ("failed to encrypt (%d)\n" , ret);else dump_encrypted_data (epayload, encrypted_datalen); out:
@@ -627,8 +621,7 @@ static struct encrypted_key_payload *encrypted_key_alloc(struct key *key, payload_datalen = decrypted_datalen;if (format && !strcmp (format, key_format_ecryptfs)) {if (dlen !=ECRYPTFS_MAX_KEY_BYTES ) { -pr_err ("encrypted_key: keylen for the ecryptfs format " -"must be equal to %d bytes\n" , +pr_err ("keylen for the ecryptfs format must be equal to %d bytes\n" ,ECRYPTFS_MAX_KEY_BYTES );return ERR_PTR (-EINVAL ); }
@@ -696,7 +689,7 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload, ret =datablob_hmac_verify (epayload, format, master_key, master_keylen);if (ret <0 ) { -pr_err ("encrypted_key: bad hmac (%d)\n" , ret); +pr_err ("bad hmac (%d)\n" , ret); goto out; }
@@ -706,7 +699,7 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload, ret =derived_key_decrypt (epayload, derived_key,sizeof derived_key);if (ret <0 ) -pr_err ("encrypted_key: failed to decrypt key (%d)\n" , ret); +pr_err ("failed to decrypt key (%d)\n" , ret); out:up_read (&mkey->sem);key_put (mkey);
@@ -986,7 +979,7 @@ static int __init init_encrypted(void) hash_tfm =crypto_alloc_shash (hash_alg,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (hash_tfm)) { -pr_err ("encrypted_key: can't allocate %s transform: %ld\n" , +pr_err ("can't allocate %s transform: %ld\n" , hash_alg,PTR_ERR (hash_tfm));return PTR_ERR (hash_tfm); }
Signature · 1 line
2.15.0
PATCH 4/18 x86: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a default simple #define to use KBUILD_MODNAME added some duplicate prefixes.
Remove the duplicate prefixes.
--- arch/x86/events/amd/ibs.c | 2 +- arch/x86/kernel/e820.c | 32 +++++++++++++++++--------------- arch/x86/kernel/hpet.c | 5 ++--- arch/x86/kernel/uprobes.c | 4 ++-- arch/x86/mm/numa.c | 22 +++++++++++----------- 5 files changed, 33 insertions(+), 32 deletions(-)
arch/x86/events/amd/ibs.c +1 -1
@@ -889,7 +889,7 @@ static void force_ibs_eilvt_setup(void)if (!ibs_eilvt_valid ()) goto out; -pr_info ("IBS: LVT offset %d assigned\n" , offset); +pr_info ("LVT offset %d assigned\n" , offset);return ; out:
arch/x86/kernel/e820.c +17 -15
@@ -155,7 +155,8 @@ static void __init __e820__range_add(struct e820_table *table, u64 start, u64 siint x = table->nr_entries;if (x >=ARRAY_SIZE (table->entries)) { -pr_err ("e820: too many entries; ignoring [mem %#010llx-%#010llx]\n" , start, start + size -1 ); +pr_err ("too many entries; ignoring [mem %#010llx-%#010llx]\n" , + start, start + size -1 );return ; }
@@ -190,9 +191,10 @@ void __init e820__print_table(char *who)int i;for (i =0 ; i < e820_table->nr_entries; i++) { -pr_info ("%s: [mem %#018Lx-%#018Lx] " , who, - e820_table->entries[i].addr, - e820_table->entries[i].addr + e820_table->entries[i].size -1 ); +pr_info ("%s: [mem %#018Lx-%#018Lx] " , + who, + e820_table->entries[i].addr, + e820_table->entries[i].addr + e820_table->entries[i].size -1 );e820_print_type (e820_table->entries[i].type);pr_cont ("\n" );
@@ -574,7 +576,7 @@ void __init e820__update_table_print(void)if (e820__update_table (e820_table))return ; -pr_info ("e820: modified physical RAM map:\n" ); +pr_info ("modified physical RAM map:\n" );e820__print_table ("modified" ); }
@@ -636,9 +638,8 @@ __init void e820__setup_pci_gap(void)if (!found) {#ifdef CONFIG_X86_64 gapstart = (max_pfn <<PAGE_SHIFT ) +1024 *1024 ; -pr_err ( -"e820: Cannot find an available gap in the 32-bit address range\n" -"e820: PCI devices with unassigned 32-bit BARs may not work!\n" ); +pr_err ("Cannot find an available gap in the 32-bit address range\n" ); +pr_err ("PCI devices with unassigned 32-bit BARs may not work!\n" );#else gapstart =0x10000000 ;#endif
@@ -649,7 +650,8 @@ __init void e820__setup_pci_gap(void)*/ pci_mem_start = gapstart; -pr_info ("e820: [mem %#010lx-%#010lx] available for PCI devices\n" , gapstart, gapstart + gapsize -1 ); +pr_info ("[mem %#010lx-%#010lx] available for PCI devices\n" , + gapstart, gapstart + gapsize -1 ); }/*
@@ -711,7 +713,7 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len)memcpy (e820_table_firmware, e820_table,sizeof (*e820_table_firmware));early_memunmap (sdata, data_len); -pr_info ("e820: extended physical RAM map:\n" ); +pr_info ("extended physical RAM map:\n" );e820__print_table ("extended" ); }
@@ -780,7 +782,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align) addr =__memblock_alloc_base (size, align,MEMBLOCK_ALLOC_ACCESSIBLE );if (addr) {e820__range_update_kexec (addr, size,E820_TYPE_RAM ,E820_TYPE_RESERVED ); -pr_info ("e820: update e820_table_kexec for e820__memblock_alloc_reserved()\n" ); +pr_info ("update e820_table_kexec for e820__memblock_alloc_reserved()\n" );e820__update_table_kexec (); }
@@ -830,8 +832,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_typeif (last_pfn > max_arch_pfn) last_pfn = max_arch_pfn; -pr_info ("e820: last_pfn = %#lx max_arch_pfn = %#lx\n" , - last_pfn, max_arch_pfn); +pr_info ("last_pfn = %#lx max_arch_pfn = %#lx\n" , + last_pfn, max_arch_pfn);return last_pfn; }
@@ -1005,7 +1007,7 @@ void __init e820__finish_early_params(void)if (e820__update_table (e820_table) <0 )early_panic ("Invalid user supplied memory map" ); -pr_info ("e820: user-defined physical RAM map:\n" ); +pr_info ("user-defined physical RAM map:\n" );e820__print_table ("user" ); } }
@@ -1238,7 +1240,7 @@ void __init e820__memory_setup(void)memcpy (e820_table_kexec, e820_table,sizeof (*e820_table_kexec));memcpy (e820_table_firmware, e820_table,sizeof (*e820_table_firmware)); -pr_info ("e820: BIOS-provided physical RAM map:\n" ); +pr_info ("BIOS-provided physical RAM map:\n" );e820__print_table (who); }
arch/x86/kernel/hpet.c +2 -3
@@ -975,8 +975,7 @@ int __init hpet_enable(void) cfg &= ~(HPET_CFG_ENABLE |HPET_CFG_LEGACY );hpet_writel (cfg,HPET_CFG );if (cfg) -pr_warn ("HPET: Unrecognized bits %#x set in global cfg\n" , - cfg); +pr_warn ("Unrecognized bits %#x set in global cfg\n" , cfg);for (i =0 ; i <= last; ++i) { cfg =hpet_readl (HPET_Tn_CFG (i));
@@ -988,7 +987,7 @@ int __init hpet_enable(void) | HPET_TN_64BIT_CAP | HPET_TN_32BIT | HPET_TN_ROUTE | HPET_TN_FSB | HPET_TN_FSB_CAP);if (cfg) -pr_warn ("HPET: Unrecognized bits %#x set in cfg#%u\n" , +pr_warn ("Unrecognized bits %#x set in cfg#%u\n" , cfg, i); }hpet_print_config ();
arch/x86/kernel/uprobes.c +2 -2
@@ -1079,8 +1079,8 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regsreturn orig_ret_vaddr;if (nleft != rasize) { -pr_err ("uprobe: return address clobbered: pid=%d, %%sp=%#lx, " -"%%ip=%#lx\n" , current->pid, regs->sp, regs->ip); +pr_err ("return address clobbered: pid=%d, %%sp=%#lx, %%ip=%#lx\n" , + current->pid, regs->sp, regs->ip);force_sig_info (SIGSEGV ,SEND_SIG_FORCED , current); }
arch/x86/mm/numa.c +11 -11
@@ -136,13 +136,13 @@ static int __init numa_add_memblk_to(int nid, u64 start, u64 end,/* whine about and ignore invalid blks */ if (start > end || nid <0 || nid >=MAX_NUMNODES ) { -pr_warning ("NUMA: Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n" , - nid, start, end -1 ); +pr_warn ("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n" , + nid, start, end -1 );return 0 ; }if (mi->nr_blks >=NR_NODE_MEMBLKS ) { -pr_err ("NUMA: too many memblk ranges\n" ); +pr_err ("too many memblk ranges\n" );return -EINVAL ; }
@@ -267,14 +267,14 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi)*/ if (bi->end > bj->start && bi->start < bj->end) {if (bi->nid != bj->nid) { -pr_err ("NUMA: node %d [mem %#010Lx-%#010Lx] overlaps with node %d [mem %#010Lx-%#010Lx]\n" , +pr_err ("node %d [mem %#010Lx-%#010Lx] overlaps with node %d [mem %#010Lx-%#010Lx]\n" , bi->nid, bi->start, bi->end -1 , bj->nid, bj->start, bj->end -1 );return -EINVAL ; } -pr_warning ("NUMA: Warning: node %d [mem %#010Lx-%#010Lx] overlaps with itself [mem %#010Lx-%#010Lx]\n" , - bi->nid, bi->start, bi->end -1 , - bj->start, bj->end -1 ); +pr_warn ("Warning: node %d [mem %#010Lx-%#010Lx] overlaps with itself [mem %#010Lx-%#010Lx]\n" , + bi->nid, bi->start, bi->end -1 , + bj->start, bj->end -1 ); }/*
@@ -364,7 +364,7 @@ static int __init numa_alloc_distance(void) phys =memblock_find_in_range (0 ,PFN_PHYS (max_pfn_mapped), size,PAGE_SIZE );if (!phys) { -pr_warning ("NUMA: Warning: can't allocate distance table!\n" ); +pr_warn ("Warning: can't allocate distance table!\n" );/* don't retry until explicitly reset */ numa_distance = (void *)1LU ;return -ENOMEM ;
@@ -410,14 +410,14 @@ void __init numa_set_distance(int from, int to, int distance)if (from >= numa_distance_cnt || to >= numa_distance_cnt || from <0 || to <0 ) { -pr_warn_once ("NUMA: Warning: node ids are out of bound, from=%d to=%d distance=%d\n" , - from, to, distance); +pr_warn_once ("Warning: node ids are out of bound, from=%d to=%d distance=%d\n" , + from, to, distance);return ; }if ((u8 )distance != distance || (from == to && distance !=LOCAL_DISTANCE )) { -pr_warn_once ("NUMA: Warning: invalid distance parameter, from=%d to=%d distance=%d\n" , +pr_warn_once ("Warning: invalid distance parameter, from=%d to=%d distance=%d\n" , from, to, distance);return ; }
Signature · 1 line
2.15.0
PATCH 5/18 x86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes
In reply to Joe PerchesKbuild uses the first file as the name for KBUILD_MODNAME. mtrr uses main.c as its first file, so rename that file to mtrr.c and fixup the Makefile.
Remove the now duplicate "mtrr: " prefixes from the logging calls.
---
arch/x86/kernel/cpu/mtrr/Makefile | 2 +-
arch/x86/kernel/cpu/mtrr/{main.c => mtrr.c} | 33 ++++++++++++++---------------
2 files changed, 17 insertions(+), 18 deletions(-)
rename arch/x86/kernel/cpu/mtrr/{main.c => mtrr.c} (96%)arch/x86/kernel/cpu/mtrr/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-y := main.o if.o generic.o cleanup.o +obj-y := mtrr.o if.o generic.o cleanup.o obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
arch/x86/kernel/cpu/mtrr/mtrr.c renamed from arch/x86/kernel/cpu/mtrr/main.c +16 -17
@@ -100,7 +100,7 @@ static int have_wrcomb(void)if (dev->vendor ==PCI_VENDOR_ID_SERVERWORKS && dev->device ==PCI_DEVICE_ID_SERVERWORKS_LE && dev->revision <=5 ) { -pr_info ("mtrr: Serverworks LE rev < 6 detected. Write-combining disabled.\n" ); +pr_info ("Serverworks LE rev < 6 detected. Write-combining disabled.\n" );pci_dev_put (dev);return 0 ; }
@@ -110,7 +110,7 @@ static int have_wrcomb(void)*/ if (dev->vendor ==PCI_VENDOR_ID_INTEL && dev->device ==PCI_DEVICE_ID_INTEL_82451NX ) { -pr_info ("mtrr: Intel 450NX MMC detected. Write-combining disabled.\n" ); +pr_info ("Intel 450NX MMC detected. Write-combining disabled.\n" );pci_dev_put (dev);return 0 ; }
@@ -312,24 +312,24 @@ int mtrr_add_page(unsigned long base, unsigned long size,return error;if (type >=MTRR_NUM_TYPES ) { -pr_warn ("mtrr: type: %u invalid\n" , type); +pr_warn ("type: %u invalid\n" , type);return -EINVAL ; }/* If the type is WC, check that this processor supports it */ if ((type ==MTRR_TYPE_WRCOMB ) && !have_wrcomb ()) { -pr_warn ("mtrr: your processor doesn't support write-combining\n" ); +pr_warn ("your processor doesn't support write-combining\n" );return -ENOSYS ; }if (!size) { -pr_warn ("mtrr: zero sized request\n" ); +pr_warn ("zero sized request\n" );return -EINVAL ; }if ((base | (base + size -1 )) >> (boot_cpu_data.x86_phys_bits -PAGE_SHIFT )) { -pr_warn ("mtrr: base or size exceeds the MTRR width\n" ); +pr_warn ("base or size exceeds the MTRR width\n" );return -EINVAL ; }
@@ -360,8 +360,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, }else if (types_compatible (type, ltype))continue ; } -pr_warn ("mtrr: 0x%lx000,0x%lx000 overlaps existing" -" 0x%lx000,0x%lx000\n" , base, size, lbase, +pr_warn ("0x%lx000,0x%lx000 overlaps existing 0x%lx000,0x%lx000\n" , base, size, lbase, lsize); goto out; }
@@ -369,7 +368,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,if (ltype != type) {if (types_compatible (type, ltype))continue ; -pr_warn ("mtrr: type mismatch for %lx000,%lx000 old: %s new: %s\n" , +pr_warn ("type mismatch for %lx000,%lx000 old: %s new: %s\n" , base, size,mtrr_attrib_to_str (ltype),mtrr_attrib_to_str (type)); goto out;
@@ -395,7 +394,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, } } }else { -pr_info ("mtrr: no more MTRRs available\n" ); +pr_info ("no more MTRRs available\n" ); } error = i; out:
@@ -407,8 +406,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,static int mtrr_check (unsigned long base,unsigned long size) {if ((base & (PAGE_SIZE -1 )) || (size & (PAGE_SIZE -1 ))) { -pr_warn ("mtrr: size and base must be multiples of 4 kiB\n" ); -pr_debug ("mtrr: size: 0x%lx base: 0x%lx\n" , size, base); +pr_warn ("size and base must be multiples of 4 kiB\n" ); +pr_debug ("size: 0x%lx base: 0x%lx\n" , size, base);dump_stack ();return -1 ; }
@@ -499,22 +498,22 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) } }if (reg <0 ) { -pr_debug ("mtrr: no MTRR for %lx000,%lx000 found\n" , +pr_debug ("no MTRR for %lx000,%lx000 found\n" , base, size); goto out; } }if (reg >= max) { -pr_warn ("mtrr: register: %d too big\n" , reg); +pr_warn ("register: %d too big\n" , reg); goto out; } mtrr_if->get (reg, &lbase, &lsize, <ype);if (lsize <1 ) { -pr_warn ("mtrr: MTRR %d not used\n" , reg); +pr_warn ("MTRR %d not used\n" , reg); goto out; }if (mtrr_usage_table[reg] <1 ) { -pr_warn ("mtrr: reg: %d has count=0\n" , reg); +pr_warn ("reg: %d has count=0\n" , reg); goto out; }if (--mtrr_usage_table[reg] <1 )
@@ -775,7 +774,7 @@ void __init mtrr_bp_init(void) }if (!mtrr_enabled ()) { -pr_info ("MTRR: Disabled\n" ); +pr_info ("Disabled\n" );/* * PAT initialization relies on MTRR's rendezvous handler.
Signature · 1 line
2.15.0
PATCH 11/18 proc: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- fs/proc/root.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/proc/root.c +3 -3
@@ -63,14 +63,14 @@ int proc_parse_options(char *options, struct pid_namespace *pid)return 0 ;if (option <HIDEPID_OFF || option >HIDEPID_INVISIBLE ) { -pr_err ("proc: hidepid value must be between 0 and 2.\n" ); +pr_err ("hidepid value must be between 0 and 2\n" );return 0 ; } pid->hide_pid = option;break ;default : -pr_err ("proc: unrecognized mount option \"%s\" " -"or missing value\n" , p); +pr_err ("unrecognized mount option \"%s\" or missing value\n" , + p);return 0 ; } }
Signature · 1 line
2.15.0
PATCH 18/18 rcu: Use pr_fmt to prefix "rcu: " to logging output
In reply to Joe PerchesUse a consistent logging prefix for all rcu related output.
--- kernel/rcu/rcu_segcblist.c | 2 ++ kernel/rcu/rcuperf.c | 10 ++++--- kernel/rcu/rcutorture.c | 46 +++++++++++++++---------------- kernel/rcu/srcutiny.c | 2 ++ kernel/rcu/srcutree.c | 5 +++- kernel/rcu/tiny.c | 3 +++ kernel/rcu/tree.c | 8 +++--- kernel/rcu/tree_plugin.h | 67 +++++++++++++++++++++++++++------------------- kernel/rcu/update.c | 19 ++++++++----- 9 files changed, 96 insertions(+), 66 deletions(-)
kernel/rcu/rcu_segcblist.c +2 -0
@@ -20,6 +20,8 @@* Authors: Paul E. McKenney <[email protected]> */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/interrupt.h>
kernel/rcu/rcuperf.c +6 -4
@@ -19,6 +19,9 @@* * Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -663,12 +666,11 @@ rcu_perf_init(void)break ; }if (i ==ARRAY_SIZE (perf_ops)) { -pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , - perf_type); +pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , perf_type);pr_alert ("rcu-perf types:" );for (i =0 ; i <ARRAY_SIZE (perf_ops); i++) -pr_alert (" %s" , perf_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , perf_ops[i]->name); +pr_cont ("\n" ); firsterr = -EINVAL ; goto unwind; }
kernel/rcu/rcutorture.c +23 -23
136 lines not on this page · raw message
kernel/rcu/srcutiny.c +2 -0
@@ -21,6 +21,8 @@* Author: Paul McKenney <[email protected]> */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/export.h> #include <linux/mutex.h> #include <linux/preempt.h>
kernel/rcu/srcutree.c +4 -1
@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/export.h> #include <linux/mutex.h> #include <linux/percpu.h>
@@ -390,7 +392,8 @@ void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced) }if (WARN_ON (rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)) !=SRCU_STATE_IDLE ) ||WARN_ON (srcu_readers_active (sp))) { -pr_info ("%s: Active srcu_struct %p state: %d\n" , __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq))); +pr_info ("%s: Active srcu_struct %p state: %d\n" , + __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)));return ;/* Caller forgot to stop doing call_srcu()? */ }free_percpu (sp->sda);
kernel/rcu/tiny.c +3 -0
@@ -22,6 +22,9 @@* For detailed explanation of Read-Copy Update mechanism see - * Documentation/RCU */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/completion.h> #include <linux/interrupt.h> #include <linux/notifier.h>
kernel/rcu/tree.c +5 -3
@@ -27,6 +27,9 @@* For detailed explanation of Read-Copy Update mechanism see - * Documentation/RCU */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -1360,8 +1363,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gp_seq)* See Documentation/RCU/stallwarn.txt for info on how to debug * RCU CPU stall warnings. */ -pr_err ("INFO: %s detected stalls on CPUs/tasks:" , - rsp->name); +pr_err ("INFO: %s detected stalls on CPUs/tasks:" , rsp->name);print_cpu_stall_info_begin ();rcu_for_each_leaf_node (rsp, rnp) {raw_spin_lock_irqsave_rcu_node (rnp, flags);
@@ -3984,7 +3986,7 @@ static void __init rcu_init_geometry(void)if (rcu_fanout_leaf ==RCU_FANOUT_LEAF && nr_cpu_ids ==NR_CPUS )return ; -pr_info ("RCU: Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , +pr_info ("Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , rcu_fanout_leaf, nr_cpu_ids);/*
kernel/rcu/tree_plugin.h +39 -28
128 lines not on this page · raw message
kernel/rcu/update.c +12 -7
@@ -30,6 +30,9 @@* http://lse.sourceforge.net/locking/rcupdate.html * */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -844,9 +847,10 @@ static void __init rcu_tasks_bootup_oddness(void) {#ifdef CONFIG_TASKS_RCU if (rcu_task_stall_timeout !=RCU_TASK_STALL_TIMEOUT ) -pr_info ("\tTasks-RCU CPU stall warnings timeout set to %d (rcu_task_stall_timeout).\n" , rcu_task_stall_timeout); +pr_info ("\tTasks-RCU CPU stall warnings timeout set to %d (rcu_task_stall_timeout)\n" , + rcu_task_stall_timeout);else -pr_info ("\tTasks RCU enabled.\n" ); +pr_info ("\tTasks RCU enabled\n" );#endif /* #ifdef CONFIG_TASKS_RCU */ }
@@ -945,15 +949,16 @@ void rcu_early_boot_tests(void) {}void __init rcupdate_announce_bootup_oddness (void ) {if (rcu_normal) -pr_info ("\tNo expedited grace period (rcu_normal).\n" ); +pr_info ("\tNo expedited grace period (rcu_normal)\n" );else if (rcu_normal_after_boot) -pr_info ("\tNo expedited grace period (rcu_normal_after_boot).\n" ); +pr_info ("\tNo expedited grace period (rcu_normal_after_boot)\n" );else if (rcu_expedited) -pr_info ("\tAll grace periods are expedited (rcu_expedited).\n" ); +pr_info ("\tAll grace periods are expedited (rcu_expedited)\n" );if (rcu_cpu_stall_suppress) -pr_info ("\tRCU CPU stall warnings suppressed (rcu_cpu_stall_suppress).\n" ); +pr_info ("\tRCU CPU stall warnings suppressed (rcu_cpu_stall_suppress)\n" );if (rcu_cpu_stall_timeout !=CONFIG_RCU_CPU_STALL_TIMEOUT ) -pr_info ("\tRCU CPU stall warnings timeout set to %d (rcu_cpu_stall_timeout).\n" , rcu_cpu_stall_timeout); +pr_info ("\tRCU CPU stall warnings timeout set to %d (rcu_cpu_stall_timeout)\n" , + rcu_cpu_stall_timeout);rcu_tasks_bootup_oddness (); }
Signature · 1 line
2.15.0
PATCH 14/18 lib/mpi: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- lib/mpi/mpicoder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/mpi/mpicoder.c +5 -5
@@ -47,7 +47,7 @@ MPI mpi_read_raw_data(const void *xbuffer, size_t nbytes) nbits = nbytes *8 ;if (nbits >MAX_EXTERN_MPI_BITS ) { -pr_info ("MPI: mpi too large (%u bits)\n" , nbits); +pr_info ("mpi too large (%u bits)\n" , nbits);return NULL ; }if (nbytes >0 )
@@ -89,14 +89,14 @@ MPI mpi_read_from_buffer(const void *xbuffer, unsigned *ret_nread) nbits = buffer[0 ] <<8 | buffer[1 ];if (nbits >MAX_EXTERN_MPI_BITS ) { -pr_info ("MPI: mpi too large (%u bits)\n" , nbits); +pr_info ("mpi too large (%u bits)\n" , nbits);return ERR_PTR (-EINVAL ); } nbytes =DIV_ROUND_UP (nbits,8 );if (nbytes +2 > *ret_nread) { -pr_info ("MPI: mpi larger than buffer nbytes=%u ret_nread=%u\n" , - nbytes, *ret_nread); +pr_info ("mpi larger than buffer nbytes=%u ret_nread=%u\n" , + nbytes, *ret_nread);return ERR_PTR (-EINVAL ); }
@@ -369,7 +369,7 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes) nbits = nbytes *8 ;if (nbits >MAX_EXTERN_MPI_BITS ) {sg_miter_stop (&miter); -pr_info ("MPI: mpi too large (%u bits)\n" , nbits); +pr_info ("mpi too large (%u bits)\n" , nbits);return NULL ; }
Signature · 1 line
2.15.0
PATCH 13/18 printk: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -2673,7 +2673,7 @@ void register_console(struct console *newcon)if (newcon->flags &CON_EXTENDED )if (!nr_ext_console_drivers++) -pr_info ("printk: continuation disabled due to ext consoles, expect more fragments in /dev/kmsg\n" ); +pr_info ("continuation disabled due to ext consoles, expect more fragments in /dev/kmsg\n" );if (newcon->flags &CON_PRINTBUFFER ) {/*
Signature · 1 line
2.15.0
PATCH 12/18 uprobes: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesConverting pr_fmt from a simple define to use KBUILD_MODNAME added some duplicate logging prefixes to existing uses.
Remove them.
--- kernel/events/uprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/events/uprobes.c +1 -2
@@ -1469,8 +1469,7 @@ static int dup_utask(struct task_struct *t, struct uprobe_task *o_utask)static void uprobe_warn (struct task_struct *t,const char *msg) { -pr_warn ("uprobe: %s:%d failed to %s\n" , - current->comm, current->pid, msg); +pr_warn ("%s:%d failed to %s\n" , current->comm, current->pid, msg); }static void dup_xol_work (struct callback_head *work)
Signature · 1 line
2.15.0
PATCH 3/18 printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Joe PerchesThere are more than 1000 uses of #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Make that the default define so these uses can be removed later via script.
--- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/printk.h +1 -1
@@ -285,7 +285,7 @@ static inline void printk_safe_flush_on_panic(void)extern int kptr_restrict;#ifndef pr_fmt -#define pr_fmt (fmt) fmt +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#endif /*
Signature · 1 line
2.15.0
Re: [PATCH 01/18] kernel: Use pr_fmt
In reply to Joe PerchesQuoted 34 lines · Joe Perches
Sometime in the future, it would be useful to convert
pr_fmtfrom a default simple define to use a default prefix withKBUILD_MODNAME.There are files in
kernel/that use pr_<level>, some with an embedded prefix, that also do not have a specificpr_fmtdefine.Add
pr_fmtfor those files.There are some differences in output as some messages are now prefixed with their
KBUILD_MODNAME.Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formatsSigned-off-by Joe Perches <[email protected]>--- kernel/acct.c | 2 ++ kernel/async.c | 14 ++++++------ kernel/audit_tree.c | 2 +- kernel/backtracetest.c | 8 +++---- kernel/crash_core.c | 29 ++++++++++++++----------- kernel/exit.c | 2 ++ kernel/hung_task.c | 13 +++++------ kernel/kprobes.c | 20 ++++++++++------- kernel/module.c | 59 +++++++++++++++++++++++--------------------------- kernel/panic.c | 3 +++ kernel/params.c | 13 ++++++----- kernel/pid.c | 2 ++ kernel/profile.c | 2 ++ kernel/range.c | 2 +- kernel/relay.c | 5 ++++-
Quoted 8 lines
kernel/seccomp.c | 4 +++- kernel/signal.c | 10 +++++---- kernel/smpboot.c | 5 ++++- kernel/taskstats.c | 4 +++- kernel/torture.c | 6 +++-- kernel/tracepoint.c | 3 +++ kernel/workqueue.c | 2 ++ 22 files changed, 122 insertions(+), 88 deletions(-)
The audit_tree.c changes look fine to me.
Quoted 811 lines
kernel/acct.c +2
-0@@ -44,6 +44,8 @@* a struct file opened for write. Fixed. 2/6/2000, AV. */ +#define pr_fmt (fmt) fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/acct.h> kernel/async.c +7
-7@@ -120,8 +120,8 @@ static void async_run_entry_fn(struct work_struct *work)/* 1) run (and print duration) */ if (initcall_debug && system_state <SYSTEM_RUNNING ) {pr_debug ("calling %lli_%pF @ %i\n" , - (long long )entry->cookie, - entry->func,task_pid_nr (current)); + (long long )entry->cookie, + entry->func,task_pid_nr (current)); calltime =ktime_get (); } entry->func (entry->data, entry->cookie);@@ -129,9 +129,9 @@ static void async_run_entry_fn(struct work_struct *work) rettime =ktime_get (); delta =ktime_sub (rettime, calltime);pr_debug ("initcall %lli_%pF returned 0 after %lld usecs\n" , - (long long )entry->cookie, - entry->func, - (long long )ktime_to_ns (delta) >>10 ); + (long long )entry->cookie, + entry->func, + (long long )ktime_to_ns (delta) >>10 ); }/* 2) remove self from the pending queues */ @@ -300,8 +300,8 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, struct async_domain delta =ktime_sub (endtime, starttime);pr_debug ("async_continuing @ %i after %lli usec\n" , -task_pid_nr (current), - (long long )ktime_to_ns (delta) >>10 ); +task_pid_nr (current), + (long long )ktime_to_ns (delta) >>10 ); } }EXPORT_SYMBOL_GPL (async_synchronize_cookie_domain);kernel/audit_tree.c +1
-1@@ -739,7 +739,7 @@ static int audit_launch_prune(void) prune_thread =kthread_run (prune_tree_thread,NULL ,"audit_prune_tree" );if (IS_ERR (prune_thread)) { -pr_err ("cannot start thread audit_prune_tree" ); +pr_err ("cannot start thread audit_prune_tree\n" ); prune_thread =NULL ;return -ENOMEM ; }kernel/backtracetest.c +4
-4@@ -19,7 +19,7 @@static void backtrace_test_normal (void ) { -pr_info ("Testing a backtrace from process context.\n" ); +pr_info ("Testing a backtrace from process context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );dump_stack ();@@ -37,7 +37,7 @@ static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);static void backtrace_test_irq (void ) { -pr_info ("Testing a backtrace from irq context.\n" ); +pr_info ("Testing a backtrace from irq context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );init_completion (&backtrace_work);@@ -51,7 +51,7 @@ static void backtrace_test_saved(void)struct stack_trace trace;unsigned long entries[8 ]; -pr_info ("Testing a saved backtrace.\n" ); +pr_info ("Testing a saved backtrace\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" ); trace.nr_entries =0 ;@@ -65,7 +65,7 @@ static void backtrace_test_saved(void)#else static void backtrace_test_saved (void ) { -pr_info ("Saved backtrace test skipped.\n" ); +pr_info ("Saved backtrace test skipped\n" ); }#endif kernel/crash_core.c +16
-13@@ -6,6 +6,8 @@* Version 2. See the file COPYING for more details. */ +#define pr_fmt (fmt) "crashkernel: " fmt +#include <linux/crash_core.h> #include <linux/utsname.h> #include <linux/vmalloc.h> @@ -49,12 +51,12 @@ static int __init parse_crashkernel_mem(char *cmdline,/* get the start of the range */ start =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (*cur !='-' ) { -pr_warn ("crashkernel: '-' expected\n" ); +pr_warn ("'-' expected\n" );return -EINVAL ; } cur++;@@ -63,18 +65,18 @@ static int __init parse_crashkernel_mem(char *cmdline,if (*cur !=':' ) { end =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (end <= start) { -pr_warn ("crashkernel: end <= start\n" ); +pr_warn ("end <= start\n" );return -EINVAL ; } }if (*cur !=':' ) { -pr_warn ("crashkernel: ':' expected\n" ); +pr_warn ("':' expected\n" );return -EINVAL ; } cur++;@@ -86,7 +88,7 @@ static int __init parse_crashkernel_mem(char *cmdline, } cur = tmp;if (size >= system_ram) { -pr_warn ("crashkernel: invalid size\n" ); +pr_warn ("invalid size\n" );return -EINVAL ; }@@ -108,8 +110,9 @@ static int __init parse_crashkernel_mem(char *cmdline,return -EINVAL ; } } - }else -pr_info ("crashkernel size resulted in zero bytes\n" ); + }else { +pr_info ("size resulted in zero bytes\n" ); + }return 0 ; }@@ -129,14 +132,14 @@ static int __init parse_crashkernel_simple(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }if (*cur =='@' ) *crash_base =memparse (cur+1 , &cur);else if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }@@ -167,18 +170,18 @@ static int __init parse_crashkernel_suffix(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }/* check with suffix */ if (strncmp (cur, suffix,strlen (suffix))) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; } cur +=strlen (suffix);if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }kernel/exit.c +2
-0@@ -4,6 +4,8 @@* Copyright (C) 1991, 1992 Linus Torvalds */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/sched/autogroup.h> kernel/hung_task.c +6
-7@@ -113,14 +113,13 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)if (sysctl_hung_task_warnings) {if (sysctl_hung_task_warnings >0 ) sysctl_hung_task_warnings--; -pr_err ("INFO: task %s:%d blocked for more than %ld seconds.\n" , - t->comm, t->pid, timeout); +pr_err ("INFO: task %s:%d blocked for more than %ld seconds\n" , + t->comm, t->pid, timeout);pr_err (" %s %s %.*s\n" , -print_tainted (),init_utsname ()->release, - (int )strcspn (init_utsname ()->version," " ), -init_utsname ()->version); -pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" -" disables this message.\n" ); +print_tainted (),init_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->version); +pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\" disables this message\n" );sched_show_task (t); hung_task_show_lock = true; }kernel/kprobes.c +12
-8@@ -31,6 +31,9 @@* <[email protected]> and Prasanna S Panchamukhi * <[email protected]> added function-return probes. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kprobes.h> #include <linux/hash.h> #include <linux/init.h> @@ -985,7 +988,8 @@ static int arm_kprobe_ftrace(struct kprobe *p) ret =ftrace_set_filter_ip (&kprobe_ftrace_ops, (unsigned long )p->addr,0 ,0 );if (ret) { -pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , p->addr, ret); +pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , + p->addr, ret);return ret; }@@ -2198,7 +2202,7 @@ static int __init populate_kprobe_blacklist(unsigned long *start,if (!kernel_text_address (entry) || !kallsyms_lookup_size_offset (entry, &size, &offset)) {pr_err ("Failed to find blacklist at %p\n" , - (void *)entry); + (void *)entry);continue ; }@@ -2281,8 +2285,8 @@ static int __init init_kprobes(void) err =populate_kprobe_blacklist (__start_kprobe_blacklist, __stop_kprobe_blacklist);if (err) { -pr_err ("kprobes: failed to populate blacklist: %d\n" , err); -pr_err ("Please take care of using kprobes.\n" ); +pr_err ("failed to populate blacklist: %d\n" , err); +pr_err ("Please take care of using kprobes\n" ); }if (kretprobe_blacklist_size) {@@ -2488,10 +2492,10 @@ static int arm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally enabled, but failed to arm %d out of %d probes\n" , +pr_warn ("globally enabled, but failed to arm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally enabled\n" ); +pr_info ("globally enabled\n" ); already_enabled:mutex_unlock (&kprobe_mutex);@@ -2531,10 +2535,10 @@ static int disarm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally disabled, but failed to disarm %d out of %d probes\n" , +pr_warn ("globally disabled, but failed to disarm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally disabled\n" ); +pr_info ("globally disabled\n" );mutex_unlock (&kprobe_mutex);kernel/module.c +27
-32@@ -16,6 +16,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/extable.h> #include <linux/moduleloader.h> @@ -523,21 +526,17 @@ static bool check_symbol(const struct symsearch *syms,if (syms->licence ==GPL_ONLY )return false;if (syms->licence ==WILL_BE_GPL_ONLY && fsa->warn) { -pr_warn ("Symbol %s is being used by a non-GPL module, " -"which will not be allowed in the future\n" , +pr_warn ("Symbol %s is being used by a non-GPL module, which will not be allowed in the future.\n" , fsa->name); } }#ifdef CONFIG_UNUSED_SYMBOLS if (syms->unused && fsa->warn) { -pr_warn ("Symbol %s is marked as UNUSED, however this module is " -"using it.\n" , fsa->name); +pr_warn ("Symbol %s is marked as UNUSED, however this module is using it.\n" , + fsa->name);pr_warn ("This symbol will go away in the future.\n" ); -pr_warn ("Please evaluate if this is the right api to use and " -"if it really is, submit a report to the linux kernel " -"mailing list together with submitting your code for " -"inclusion.\n" ); +pr_warn ("Please evaluate if this is the right api to use and if it really is, submit a report to the linux kernel mailing list together with submitting your code for inclusion.\n" ); }#endif @@ -843,7 +842,7 @@ static int add_module_usage(struct module *a, struct module *b) {struct module_use *use; -pr_debug ("Allocating new usage for %s.\n" , a->name); +pr_debug ("Allocating new usage for %s\n" , a->name); use =kmalloc (sizeof (*use),GFP_ATOMIC );if (!use)return -ENOMEM ;@@ -1265,7 +1264,7 @@ static int try_to_force_load(struct module *mod, const char *reason) {#ifdef CONFIG_MODULE_FORCE_LOAD if (!test_taint (TAINT_FORCED_MODULE )) -pr_warn ("%s: %s: kernel tainted.\n" , mod->name, reason); +pr_warn ("%s: %s: kernel tainted\n" , mod->name, reason);add_taint_module (mod,TAINT_FORCED_MODULE ,LOCKDEP_NOW_UNRELIABLE );return 0 ;#else @@ -1435,7 +1434,7 @@ resolve_symbol_wait(struct module *mod, !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) || PTR_ERR(ksym) != -EBUSY, 30 * HZ) <= 0) { -pr_warn ("%s: gave up waiting for init of module %s.\n" , +pr_warn ("%s: gave up waiting for init of module %s\n" , mod->name, owner); }return ksym;@@ -2224,8 +2223,7 @@ static int verify_export_symbols(struct module *mod)for (i =0 ; i <ARRAY_SIZE (arr); i++) {for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {if (find_symbol (s->name, &owner,NULL , true, false)) { -pr_err ("%s: exports duplicate symbol %s" -" (owned by %s)\n" , +pr_err ("%s: exports duplicate symbol %s (owned by %s)\n" , mod->name, s->name,module_name (owner));return -ENOEXEC ; }@@ -2257,14 +2255,14 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)supposed to happen. */ pr_debug ("Common symbol: %s\n" , name);pr_warn ("%s: please compile with -fno-common\n" , - mod->name); + mod->name); ret = -ENOEXEC ;break ;case SHN_ABS :/* Don't need to do anything */ pr_debug ("Absolute symbol: 0x%08lx\n" , - (long )sym[i].st_value); + (long )sym[i].st_value);break ;case SHN_LIVEPATCH :@@ -2454,7 +2452,7 @@ static void set_license(struct module *mod, const char *license)if (!license_is_gpl_compatible (license)) {if (!test_taint (TAINT_PROPRIETARY_MODULE )) -pr_warn ("%s: module license '%s' taints kernel.\n" , +pr_warn ("%s: module license '%s' taints kernel\n" , mod->name, license);add_taint_module (mod,TAINT_PROPRIETARY_MODULE ,LOCKDEP_NOW_UNRELIABLE );@@ -2717,7 +2715,7 @@ static void dynamic_debug_setup(struct module *mod, struct _ddebug *debug, unsig#ifdef CONFIG_DYNAMIC_DEBUG if (ddebug_add_module (debug, num, mod->name))pr_err ("dynamic debug error adding module: %s\n" , - debug->modname); + debug->modname);#endif }@@ -2849,7 +2847,7 @@ static int check_modinfo_livepatch(struct module *mod, struct load_info *info)static int check_modinfo_livepatch (struct module *mod,struct load_info *info) {if (get_modinfo (info,"livepatch" )) { -pr_err ("%s: module is marked as livepatch module, but livepatch support is disabled" , +pr_err ("%s: module is marked as livepatch module, but livepatch support is disabled\n" , mod->name);return -ENOEXEC ; }@@ -2863,7 +2861,7 @@ static void check_modinfo_retpoline(struct module *mod, struct load_info *info)if (retpoline_module_ok (get_modinfo (info,"retpoline" )))return ; -pr_warn ("%s: loading module not compiled with retpoline compiler.\n" , +pr_warn ("%s: loading module not compiled with retpoline compiler\n" , mod->name); }@@ -3037,8 +3035,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)if (get_modinfo (info,"staging" )) {add_taint_module (mod,TAINT_CRAP ,LOCKDEP_STILL_OK ); -pr_warn ("%s: module is from the staging directory, the quality " -"is unknown, you have been warned.\n" , mod->name); +pr_warn ("%s: module is from the staging directory, the quality is unknown, you have been warned\n" , + mod->name); } err =check_modinfo_livepatch (mod, info);@@ -3089,8 +3087,8 @@ static int find_module_sections(struct module *mod, struct load_info *info)* This shouldn't happen with same compiler and binutils * building all parts of the module. */ -pr_warn ("%s: has both .ctors and .init_array.\n" , - mod->name); +pr_warn ("%s: has both .ctors and .init_array\n" , + mod->name); return -EINVAL; }#endif @@ -3227,7 +3225,7 @@ static int check_module_license_and_versions(struct module *mod) LOCKDEP_NOW_UNRELIABLE);if (!prev_taint &&test_taint (TAINT_PROPRIETARY_MODULE )) -pr_warn ("%s: module license taints kernel.\n" , mod->name); +pr_warn ("%s: module license taints kernel\n" , mod->name);#ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !mod->crcs)@@ -3459,8 +3457,7 @@ static noinline int do_init_module(struct module *mod) goto fail_free_freeinit; }if (ret >0 ) { -pr_warn ("%s: '%s'->init suspiciously returned %d, it should " -"follow 0/-E convention\n" +pr_warn ("%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n" "%s: loading module anyway...\n" , __func__, mod->name, ret, __func__);dump_stack ();@@ -3686,9 +3683,8 @@ static int load_module(struct load_info *info, const char __user *uargs,#ifdef CONFIG_MODULE_SIG mod->sig_ok = info->sig_ok;if (!mod->sig_ok) { -pr_notice_once ("%s: module verification failed: signature " -"and/or required key missing - tainting " -"kernel\n" , mod->name); +pr_notice_once ("%s: module verification failed: signature and/or required key missing - tainting kernel\n" , + mod->name);add_taint_module (mod,TAINT_UNSIGNED_MODULE ,LOCKDEP_STILL_OK ); }#endif @@ -3763,7 +3759,7 @@ static int load_module(struct load_info *info, const char __user *uargs, goto coming_cleanup; }else if (after_dashes) {pr_warn ("%s: parameters '%s' after `--' ignored\n" , - mod->name, after_dashes); + mod->name, after_dashes); }/* Link in to sysfs. */ @@ -3843,8 +3839,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,if (err)return err; -pr_debug ("init_module: umod=%p, len=%lu, uargs=%p\n" , - umod, len, uargs); +pr_debug ("init_module: umod=%p, len=%lu, uargs=%p\n" , umod, len, uargs); err =copy_module_from_user (umod, len, &info);if (err)kernel/panic.c +3
-0@@ -8,6 +8,9 @@* This function is used through-out the kernel (including mm and fs) * to indicate a major problem. */ + +#define pr_fmt (fmt) fmt +#include <linux/debug_locks.h> #include <linux/sched/debug.h> #include <linux/interrupt.h> kernel/params.c +8
-5@@ -15,6 +15,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> @@ -141,8 +144,8 @@ static int parse_one(char *param,if (!val && !(params[i].ops->flags &KERNEL_PARAM_OPS_FL_NOARG ))return -EINVAL ; -pr_debug ("handling %s with %p\n" , param, - params[i].ops->set); +pr_debug ("handling %s with %p\n" , + param, params[i].ops->set);kernel_param_lock (params[i].mod);param_check_unsafe (¶ms[i]); err = params[i].ops->set (val, ¶ms[i]);@@ -496,8 +499,8 @@ int param_set_copystring(const char *val, const struct kernel_param *kp)const struct kparam_string *kps = kp->str;if (strlen (val)+1 > kps->maxlen) { -pr_err ("%s: string doesn't fit in %u chars.\n" , - kp->name, kps->maxlen-1 ); +pr_err ("%s: string doesn't fit in %u chars\n" , + kp->name, kps->maxlen -1 );return -ENOSPC ; }strcpy (kps->string, val);@@ -763,7 +766,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)#endif if (err) {kobject_put (&mk->kobj); -pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable.\n" , +pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable\n" , name, err);return NULL ; }kernel/pid.c +2
-0@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/export.h> #include <linux/slab.h> kernel/profile.c +2
-0@@ -14,6 +14,8 @@* Oracle, 2004 */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/profile.h> #include <linux/bootmem.h> kernel/range.c +1
-1@@ -102,7 +102,7 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].start = end; }else {pr_err ("%s: run out of slot in ranges\n" , - __func__); + __func__); } range[j].end = start;continue ;kernel/relay.c +4
-1@@ -12,6 +12,9 @@* * This file is released under the GPL. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/errno.h> #include <linux/stddef.h> #include <linux/slab.h> @@ -527,7 +530,7 @@ int relay_prepare_cpu(unsigned int cpu)continue ; buf =relay_open_buf (chan, cpu);if (!buf) { -pr_err ("relay: cpu %d buffer creation failed\n" , cpu); +pr_err ("cpu %d buffer creation failed\n" , cpu);mutex_unlock (&relay_channels_mutex);return -ENOMEM ; }kernel/seccomp.c +3
-1@@ -14,6 +14,8 @@* of Berkeley Packet Filters/Linux Socket Filters. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/refcount.h> #include <linux/audit.h> #include <linux/compat.h> @@ -1323,7 +1325,7 @@ static int __init seccomp_sysctl_init(void) hdr =register_sysctl_paths (seccomp_sysctl_path, seccomp_sysctl_table);if (!hdr) -pr_warn ("seccomp: sysctl registration failed\n" ); +pr_warn ("sysctl registration failed\n" );else kmemleak_not_leak (hdr);kernel/signal.c +6
-4@@ -10,6 +10,8 @@* to allow signals to be sent reliably. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/slab.h> #include <linux/export.h> #include <linux/init.h> @@ -235,7 +237,7 @@ static inline void print_dropped_signal(int sig)return ;pr_info ("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n" , - current->comm, current->pid, sig); + current->comm, current->pid, sig); }/** @@ -1118,10 +1120,10 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,static void print_fatal_signal (int signr) {struct pt_regs *regs =signal_pt_regs (); -pr_info ("potentially unexpected fatal signal %d.\n" , signr); +pr_info ("potentially unexpected fatal signal %d\n" , signr);#if defined(__i386__) && !defined(__arch_um__) -pr_info ("code at %08lx: " , regs->ip); +pr_info ("code at %08lx:" , regs->ip); {int i;for (i =0 ; i <16 ; i++) {@@ -1129,7 +1131,7 @@ static void print_fatal_signal(int signr)if (get_user (insn, (unsigned char *)(regs->ip + i)))break ; -pr_cont ("%02x " , insn); +pr_cont (" %02x" , insn); } }pr_cont ("\n" );kernel/smpboot.c +4
-1@@ -1,6 +1,9 @@/* * Common SMP CPU bringup/teardown functions */ + +#define pr_fmt (fmt) "SMP: " fmt +#include <linux/cpu.h> #include <linux/err.h> #include <linux/smp.h> @@ -54,7 +57,7 @@ static inline void idle_init(unsigned int cpu)if (!tsk) { tsk =fork_idle (cpu);if (IS_ERR (tsk)) -pr_err ("SMP: fork_idle() failed for CPU %u\n" , cpu); +pr_err ("fork_idle() failed for CPU %u\n" , cpu);else per_cpu (idle_threads, cpu) = tsk; }kernel/taskstats.c +3
-1@@ -16,6 +16,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/taskstats_kern.h> #include <linux/tsacct_kern.h> @@ -690,7 +692,7 @@ static int __init taskstats_init(void)return rc; family_registered =1 ; -pr_info ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION ); +pr_info ("registered version %d\n" ,TASKSTATS_GENL_VERSION );return 0 ; }kernel/torture.c +4
-2@@ -20,6 +20,9 @@* Author: Paul E. McKenney <[email protected]> * Based on kernel/rcu/torture.c. */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -99,8 +102,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,return false;if (verbose) -pr_alert ("%s" TORTURE_FLAG -"torture_onoff task: offlining %d\n" , +pr_alert ("%s" TORTURE_FLAG "torture_onoff task: offlining %d\n" , torture_type, cpu); starttime = jiffies; (*n_offl_attempts)++;kernel/tracepoint.c +3
-0@@ -15,6 +15,9 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/mutex.h> #include <linux/types.h> kernel/workqueue.c +2
-1@@ -24,6 +24,8 @@* Please read Documentation/core-api/workqueue.rst for details. */ +#define pr_fmt (fmt) fmt +#include <linux/export.h> #include <linux/kernel.h> #include <linux/sched.h> --2.15.0
Signature · 2 lines
paul moore www.paul-moore.com
Re: [PATCH 15/18] security: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesQuoted 9 lines · Joe Perches
Converting
pr_fmtfrom a simple define to useKBUILD_MODNAMEadded some duplicate logging prefixes to existing uses.Remove them.
Signed-off-by Joe Perches <[email protected]>--- security/selinux/selinuxfs.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
Quoted 102 lines
security/selinux/selinuxfs.c +14
-16@@ -515,19 +515,19 @@ static int sel_make_policy_nodes(struct selinux_fs_info *fsi) ret =sel_make_bools (fsi);if (ret) { -pr_err ("SELinux: failed to load policy booleans\n" ); +pr_err ("failed to load policy booleans\n" );return ret; } ret =sel_make_classes (fsi);if (ret) { -pr_err ("SELinux: failed to load policy classes\n" ); +pr_err ("failed to load policy classes\n" );return ret; } ret =sel_make_policycap (fsi);if (ret) { -pr_err ("SELinux: failed to load policy capabilities\n" ); +pr_err ("failed to load policy capabilities\n" );return ret; }@@ -570,7 +570,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf, length =security_load_policy (fsi->state, data, count);if (length) { -pr_warn_ratelimited ("SELinux: failed to load policy\n" ); +pr_warn_ratelimited ("failed to load policy\n" ); goto out; }@@ -620,8 +620,8 @@ static ssize_t sel_write_context(struct file *file, char *buf, size_t size) length = -ERANGE ;if (len >SIMPLE_TRANSACTION_LIMIT ) { -printk (KERN_ERR "SELinux: %s: context size (%u) exceeds " -"payload max\n" , __func__, len); +pr_err ("%s: context size (%u) exceeds payload max\n" , + __func__, len); goto out; }@@ -956,8 +956,8 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size) length = -ERANGE ;if (len >SIMPLE_TRANSACTION_LIMIT ) { -printk (KERN_ERR "SELinux: %s: context size (%u) exceeds " -"payload max\n" , __func__, len); +pr_err ("%s: context size (%u) exceeds payload max\n" , + __func__, len); goto out; }@@ -1147,8 +1147,8 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size) length = -ERANGE ;if (len >SIMPLE_TRANSACTION_LIMIT ) { -printk (KERN_ERR "SELinux: %s: context size (%u) exceeds " -"payload max\n" , __func__, len); +pr_err ("%s: context size (%u) exceeds payload max\n" , + __func__, len); goto out; }@@ -1389,8 +1389,8 @@ static int sel_make_bools(struct selinux_fs_info *fsi) ret =security_genfs_sid (fsi->state,"selinuxfs" , page,SECCLASS_FILE , &sid);if (ret) { -pr_warn_ratelimited ("SELinux: no sid found, defaulting to security isid for %s\n" , - page); +pr_warn_ratelimited ("no sid found, defaulting to security isid for %s\n" , + page); sid =SECINITSID_SECURITY ; }@@ -1996,8 +1996,7 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent) goto err;return 0 ; err: -printk (KERN_ERR "SELinux: %s: failed while creating inodes\n" , - __func__); +pr_err ("%s: failed while creating inodes\n" , __func__);selinux_fs_info_free (sb);@@ -2046,7 +2045,7 @@ static int __init init_sel_fs(void) selinux_null.mnt = selinuxfs_mount =kern_mount (&sel_fs_type);if (IS_ERR (selinuxfs_mount)) { -printk (KERN_ERR "selinuxfs: could not mount!\n" ); +pr_err ("selinuxfs: could not mount!\n" ); err =PTR_ERR (selinuxfs_mount); selinuxfs_mount =NULL ; } --2.15.0
Signature · 6 lines
paul moore www.paul-moore.com -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Joe PerchesQuoted 13 lines · On Thu, 10 May 2018 08:45:29 -0700 Joe Perches <[email protected]> wrote:
There are more than 1000 uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt Make that the default define so these uses can be removed later via script.Signed-off-by Joe Perches <[email protected]>--- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/printk.h +0
-0
include/linux/printk.h static inline void printk_safe_flush_on_panic(void) · line 289
Quoted 6 lines
include/linux/printk.h +1
-1@@ -285,7 +285,7 @@ static inline void printk_safe_flush_on_panic(void)extern int kptr_restrict;#ifndef pr_fmt -#define pr_fmt (fmt) fmt +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#endif
Interesting change. The ring buffer test went from:
[ 12.778404] CPU 0: [ 12.780488] events: 1596368 [ 12.784841] dropped bytes: 0 [ 12.788682] alloced bytes: 124382988 [ 12.793206] written bytes: 121852123 [ 12.797711] biggest event: 263 [ 12.801706] smallest event: 4 [ 12.809384] read events: 12106 [ 12.813464] lost events: 1584262 [ 12.817709] total events: 1596368 [ 12.821951] recorded len bytes: 975776 [ 12.826107] recorded size bytes: 955733 [ 12.830263] With dropped events, record len and size may not match [ 12.830263] alloced and written from above
to
[ 12.779526] ring_buffer: CPU 0: [ 12.782753] ring_buffer: events: 1812797 [ 12.788223] ring_buffer: dropped bytes: 0 [ 12.793179] ring_buffer: alloced bytes: 142291920 [ 12.798815] ring_buffer: written bytes: 139410962 [ 12.804446] ring_buffer: biggest event: 211 [ 12.809558] ring_buffer: smallest event: 4 [ 12.818571] ring_buffer: read events: 13099 [ 12.824929] ring_buffer: lost events: 1799698 [ 12.830293] ring_buffer: total events: 1812797 [ 12.835657] ring_buffer: recorded len bytes: 974336 [ 12.840935] ring_buffer: recorded size bytes: 953514 [ 12.846218] ring_buffer: With dropped events, record len and size may not match [ 12.846218] alloced and written from above
I'm fine with it.
-- Steve
Re: [PATCH 17/18] security: encrypted-keys: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesQuoted 9 lines · Joe Perches
Converting
pr_fmtfrom a simple define to useKBUILD_MODNAMEadded some duplicate logging prefixes to existing uses.Remove them.
Signed-off-by Joe Perches <[email protected]>--- security/keys/encrypted-keys/encrypted.c | 63 ++++++++++++++------------------ 1 file changed, 28 insertions(+), 35 deletions(-)
Signature · 2 lines
James Morris <[email protected]>
Re: [PATCH 01/18] kernel: Use pr_fmt
In reply to Joe PerchesQuoted 11 lines · Joe Perches
Sometime in the future, it would be useful to convert
pr_fmtfrom a default simple define to use a default prefix withKBUILD_MODNAME.There are files in
kernel/that use pr_<level>, some with an embedded prefix, that also do not have a specificpr_fmtdefine.Add
pr_fmtfor those files.There are some differences in output as some messages are now prefixed with their
KBUILD_MODNAME.
Quoted 7 lines
Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formatsSigned-off-by Joe Perches <[email protected]>
-Kees
Signature · 2 lines
Kees Cook Pixel Security
Re: [PATCH 09/18] ptp: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesQuoted 6 lines · Joe Perches
Converting
pr_fmtfrom a simple define to useKBUILD_MODNAMEadded some duplicate logging prefixes to existing uses.Remove them.
Signed-off-by Joe Perches <[email protected]>
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Joe PerchesQuoted 4 lines · Joe Perches
There are more than 1000 uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt Make that the default define so these uses can be removed later via script.Signed-off-by Joe Perches <[email protected]>
In general, the idea looks OK to me, so FWIW
A quick question:
- Would "can be removed later via script" be so trivial? What about these guys?
drivers/of/address.c:#define pr_fmt(fmt) "OF: " fmt
drivers/of/base.c:#define pr_fmt(fmt) "OF: " fmt
drivers/of/dynamic.c:#define pr_fmt(fmt) "OF: " fmt
drivers/of/fdt.c:#define pr_fmt(fmt) "OF: fdt: " fmt
drivers/of/fdt_address.c:#define pr_fmt(fmt) "OF: fdt: " fmt
drivers/of/irq.c:#define pr_fmt(fmt) "OF: " fmt
drivers/of/of_numa.c:#define pr_fmt(fmt) "OF: NUMA: " fmt
drivers/of/of_reserved_mem.c:#define pr_fmt(fmt) "OF: reserved mem: " fmt
drivers/of/overlay.c:#define pr_fmt(fmt) "OF: overlay: " fmt drivers/of/platform.c:#define pr_fmt(fmt) "OF: " fmt drivers/of/property.c:#define pr_fmt(fmt) "OF: " fmt drivers/of/resolver.c:#define pr_fmt(fmt) "OF: resolver: " fmt
-ss
Re: [PATCH 13/18] printk: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesQuoted 6 lines · Joe Perches
Converting
pr_fmtfrom a simple define to useKBUILD_MODNAMEadded some duplicate logging prefixes to existing uses.Remove them.
Signed-off-by Joe Perches <[email protected]>
-ss
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Sergey SenozhatskyQuoted 22 lines · Sergey Senozhatsky
Quoted 4 lines · Joe Perches
There are more than 1000 uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt Make that the default define so these uses can be removed later via script.Signed-off-by Joe Perches <[email protected]>In general, the idea looks OK to me, so FWIW
A quick question:
- Would "can be removed later via script" be so trivial? What about these guys?
drivers/of/address.c:#define
pr_fmt(fmt)"OF: " fmt
drivers/of/base.c:#definepr_fmt(fmt)"OF: " fmt
drivers/of/dynamic.c:#definepr_fmt(fmt)"OF: " fmt
drivers/of/fdt.c:#definepr_fmt(fmt)"OF: fdt: " fmt
drivers/of/fdt_address.c:#definepr_fmt(fmt)"OF: fdt: " fmt
drivers/of/irq.c:#definepr_fmt(fmt)"OF: " fmt
drivers/of/of_numa.c:#definepr_fmt(fmt)"OF: NUMA: " fmt
drivers/of/of_reserved_mem.c:#definepr_fmt(fmt)"OF: reserved mem: " fmt
Quoted 4 lines
drivers/of/overlay.c:#define pr_fmt(fmt) "OF: overlay: " fmt drivers/of/platform.c:#define pr_fmt(fmt) "OF: " fmt drivers/of/property.c:#define pr_fmt(fmt) "OF: " fmt drivers/of/resolver.c:#define pr_fmt(fmt) "OF: resolver: " fmt
What about them?
All those defines above are non-generic as they are specified to start with "OF: " and then some optional extra bit.
Why should these defines be updated or modified?
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 28 lines · Joe Perches
Quoted 22 lines · Sergey Senozhatsky
Quoted 4 lines · Joe Perches
There are more than 1000 uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt Make that the default define so these uses can be removed later via script.Signed-off-by Joe Perches <[email protected]>In general, the idea looks OK to me, so FWIW
A quick question:
- Would "can be removed later via script" be so trivial? What about these guys?
drivers/of/address.c:#define
pr_fmt(fmt)"OF: " fmt
drivers/of/base.c:#definepr_fmt(fmt)"OF: " fmt
drivers/of/dynamic.c:#definepr_fmt(fmt)"OF: " fmt
drivers/of/fdt.c:#definepr_fmt(fmt)"OF: fdt: " fmt
drivers/of/fdt_address.c:#definepr_fmt(fmt)"OF: fdt: " fmt
drivers/of/irq.c:#definepr_fmt(fmt)"OF: " fmt
drivers/of/of_numa.c:#definepr_fmt(fmt)"OF: NUMA: " fmt
drivers/of/of_reserved_mem.c:#definepr_fmt(fmt)"OF: reserved mem: " fmtQuoted 4 lines
drivers/of/overlay.c:#define pr_fmt(fmt) "OF: overlay: " fmt drivers/of/platform.c:#define pr_fmt(fmt) "OF: " fmt drivers/of/property.c:#define pr_fmt(fmt) "OF: " fmt drivers/of/resolver.c:#define pr_fmt(fmt) "OF: resolver: " fmt
Quoted 7 lines
What about them?
All those defines above are non-generic as they are specified to start with "OF: " and then some optional extra bit.
Why should these defines be updated or modified?
What would be good, and is something that I will eventually work on, is to make the KBUILD_MODNAME ": " use a singleton looked up and inserted by the printk subsystem instead of stored with each format.
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Sergey SenozhatskyQuoted 2 lines · Sergey Senozhatsky
In general, the idea looks OK to me, so FWIW
Looking at dmesg,
Base:
[ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [...] [ 0.000000] 00000-9FFFF write-back [ 0.000000] A0000-BFFFF uncachable [ 0.000000] C0000-FFFFF write-protect [ 0.000000] MTRR variable ranges enabled: [ 0.000000] 0 base 00E0000000 mask 7FE0000000 uncachable [ 0.000000] 1 disabled [ 0.000000] 2 disabled [ 0.000000] 3 disabled [ 0.000000] 4 disabled
[..]
Patched:
[ 0.000000] common: KERNEL supported cpus: [ 0.000000] common: Intel GenuineIntel [...] [ 0.000000] generic: MTRR default type: write-back [ 0.000000] generic: MTRR fixed ranges enabled: [ 0.000000] generic: 00000-9FFFF write-back [ 0.000000] generic: A0000-BFFFF uncachable [ 0.000000] generic: C0000-FFFFF write-protect [ 0.000000] generic: MTRR variable ranges enabled: [ 0.000000] generic: 0 base 00E0000000 mask 7FE0000000 uncachable [ 0.000000] generic: 1 disabled [ 0.000000] generic: 2 disabled [ 0.000000] generic: 3 disabled [ 0.000000] generic: 4 disabled
[..]
Is it correct that WARN_ON() from "generic: " will now also be prefixed? In other words, we will have something like this
[ 28.420519] generic: RSP: 0018:ffffa01dc062bda8 EFLAGS: 00010282 [ 28.420522] generic: RAX: ffffffff8317612f RBX: ffffffffffffffea RCX: ffffa01dc062bdc8 [ 28.420523] generic: RDX: 000055a6a3f03110 RSI: 0000000000000001 RDI: ffffffff83e31540 [ 28.420525] generic: RBP: 0000000000000001 R08: ffffa01dc062bec0 R09: 0000000000000004 [ 28.420526] generic: R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001 [ 28.420528] generic: R13: ffffffff83e31540 R14: ffffa01dc062bec0 R15: 0000000000000002 [ 28.420547] generic: ? rcu_read_lock_sched_held+0x5d/0x63 [ 28.420549] generic: ? rcu_sync_lockdep_assert+0x2e/0x54 [ 28.420551] generic: ? __sb_start_write+0xeb/0x1a3
Correct?
-ss
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Joe PerchesQuoted 8 lines · Joe Perches
What about them?
All those defines above are non-generic as they are specified to start with "OF: " and then some optional extra bit.
Why should these defines be updated or modified?
Nevermind, my bad. I, for some reason, assumed that you were going to drop all of those pr_fmt, but you obviously was speaking only about those that have "KBUILD_MODNAME".
-ss
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Sergey SenozhatskyQuoted 51 lines · Sergey Senozhatsky
Quoted 2 lines · Sergey Senozhatsky
In general, the idea looks OK to me, so FWIW
Looking at dmesg,
Base:
[ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [...] [ 0.000000] 00000-9FFFF write-back [ 0.000000] A0000-BFFFF uncachable [ 0.000000] C0000-FFFFF write-protect [ 0.000000] MTRR variable ranges enabled: [ 0.000000] 0 base 00E0000000 mask 7FE0000000 uncachable [ 0.000000] 1 disabled [ 0.000000] 2 disabled [ 0.000000] 3 disabled [ 0.000000] 4 disabled[..]
Patched:
[ 0.000000] common: KERNEL supported cpus: [ 0.000000] common: Intel GenuineIntel [...] [ 0.000000] generic: MTRR default type: write-back [ 0.000000] generic: MTRR fixed ranges enabled: [ 0.000000] generic: 00000-9FFFF write-back [ 0.000000] generic: A0000-BFFFF uncachable [ 0.000000] generic: C0000-FFFFF write-protect [ 0.000000] generic: MTRR variable ranges enabled: [ 0.000000] generic: 0 base 00E0000000 mask 7FE0000000 uncachable [ 0.000000] generic: 1 disabled [ 0.000000] generic: 2 disabled [ 0.000000] generic: 3 disabled [ 0.000000] generic: 4 disabled[..]
Is it correct that
WARN_ON()from "generic: " will now also be prefixed? In other words, we will have something like this[ 28.420519] generic: RSP: 0018:ffffa01dc062bda8 EFLAGS: 00010282 [ 28.420522] generic: RAX: ffffffff8317612f RBX: ffffffffffffffea RCX: ffffa01dc062bdc8 [ 28.420523] generic: RDX: 000055a6a3f03110 RSI: 0000000000000001 RDI: ffffffff83e31540 [ 28.420525] generic: RBP: 0000000000000001 R08: ffffa01dc062bec0 R09: 0000000000000004 [ 28.420526] generic: R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001 [ 28.420528] generic: R13: ffffffff83e31540 R14: ffffa01dc062bec0 R15: 0000000000000002 [ 28.420547] generic: ? rcu_read_lock_sched_held+0x5d/0x63 [ 28.420549] generic: ? rcu_sync_lockdep_assert+0x2e/0x54 [ 28.420551] generic: ? __sb_start_write+0xeb/0x1a3
Quoted 1 line
Correct?
No, that stack dump comes from arch/x86/kernel/dumpstack.c and that uses printk(KERN_DEFAULT ... and generic printk( which is not prefixed at all.
And it's likely that there should be more files, if the desired output is not prefixed, that should add
#define pr_fmt(fmt) fmt
to remove prefixes like "generic: "
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 11 lines · Joe Perches
Quoted 11 lines
[ 28.420519] generic: RSP: 0018:ffffa01dc062bda8 EFLAGS: 00010282 [ 28.420522] generic: RAX: ffffffff8317612f RBX: ffffffffffffffea RCX: ffffa01dc062bdc8 [ 28.420523] generic: RDX: 000055a6a3f03110 RSI: 0000000000000001 RDI: ffffffff83e31540 [ 28.420525] generic: RBP: 0000000000000001 R08: ffffa01dc062bec0 R09: 0000000000000004 [ 28.420526] generic: R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001 [ 28.420528] generic: R13: ffffffff83e31540 R14: ffffa01dc062bec0 R15: 0000000000000002 [ 28.420547] generic: ? rcu_read_lock_sched_held+0x5d/0x63 [ 28.420549] generic: ? rcu_sync_lockdep_assert+0x2e/0x54 [ 28.420551] generic: ? __sb_start_write+0xeb/0x1a3
Quoted 5 lines
Quoted 1 line
Correct?
No, that stack dump comes from
arch/x86/kernel/dumpstack.cand that uses printk(KERN_DEFAULT ... and generic printk( which is not prefixed at all.
That's platform specific. Right? Most of platforms [probably most of them] use plain printk("... %pS"). But some use pr_emerg("[<%p>] %s%pS\n") or pr_info("PC: [<%08lx>] %pS\n"), and so on.
In case of x86, I think we will have some changes as well. Looking at generic __warn(): pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n") and pr_warn("WARNING: CPU: %d PID: %d at %pS\n") and probably some others will change now:
Instead of
[ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at blah-blah-blah
we will have
[ 0.000000] panic: ------------[ cut here ]------------ [ 0.000000] panic: WARNING: CPU: 0 PID: 0 at blah-blah-blah
-ss
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 12 lines · Sergey Senozhatsky
Quoted 11 lines · Joe Perches
Quoted 11 lines
[ 28.420519] generic: RSP: 0018:ffffa01dc062bda8 EFLAGS: 00010282 [ 28.420522] generic: RAX: ffffffff8317612f RBX: ffffffffffffffea RCX: ffffa01dc062bdc8 [ 28.420523] generic: RDX: 000055a6a3f03110 RSI: 0000000000000001 RDI: ffffffff83e31540 [ 28.420525] generic: RBP: 0000000000000001 R08: ffffa01dc062bec0 R09: 0000000000000004 [ 28.420526] generic: R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001 [ 28.420528] generic: R13: ffffffff83e31540 R14: ffffa01dc062bec0 R15: 0000000000000002 [ 28.420547] generic: ? rcu_read_lock_sched_held+0x5d/0x63 [ 28.420549] generic: ? rcu_sync_lockdep_assert+0x2e/0x54 [ 28.420551] generic: ? __sb_start_write+0xeb/0x1a3
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Correct?
No, that stack dump comes from
arch/x86/kernel/dumpstack.cand that uses printk(KERN_DEFAULT ... and generic printk( which is not prefixed at all.That's platform specific. Right?
yes, it seems so.
Quoted 9 lines
Most of platforms [probably most of them]
use plain printk("... %pS"). But some usepr_emerg("[<%p>] %s%pS\n")orpr_info("PC: [<%08lx>] %pS\n"), and so on.In case of x86, I think we will have some changes as well. Looking at generic
__warn():pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n")andpr_warn("WARNING: CPU: %d PID: %d at %pS\n")and probably some others will change now:
Quoted 8 lines
Instead of
[ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at blah-blah-blahwe will have
[ 0.000000] panic: ------------[ cut here ]------------ [ 0.000000] panic: WARNING: CPU: 0 PID: 0 at blah-blah-blah
right.
So far, I've made no attempt to update arch/...
It's almost certain that some additions of
#define pr_fmt(fmt) fmt
will need to be made for some arch/... files.
PATCH 1/1 ring_buffer: Update logging to use single line output
In reply to Steven RostedtWith a possible change to pr_fmt coming, the logging output can become unbalanced when an initial line has a prefix and subsequent lines do not when a multiple line pr_<level> is emitted.
Fix it by emitting a single line.
Miscellanea:
o Convert consecutive tests of total_lost and !total_lost to if/else
--- kernel/trace/ring_buffer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/trace/ring_buffer.c +3 -4
@@ -5132,10 +5132,9 @@ static __init int test_ringbuffer(void)pr_info (" total events: %ld\n" , total_lost + total_read);pr_info (" recorded len bytes: %ld\n" , total_len);pr_info (" recorded size bytes: %ld\n" , total_size); -if (total_lost) -pr_info (" With dropped events, record len and size may not match\n" -" alloced and written from above\n" ); -if (!total_lost) { +if (total_lost) { +pr_info (" With dropped events, record len and size may not match alloced and written from above\n" ); + }else {if (RB_WARN_ON (buffer, total_len != total_alloc || total_size != total_written))break ;
Re: [PATCH 01/18] kernel: Use pr_fmt
In reply to Joe Perches+++ Joe Perches [10/05/18 08:45 -0700]:
Quoted 11 lines
Sometime in the future, it would be useful to convert
pr_fmtfrom a default simple define to use a default prefix withKBUILD_MODNAME.There are files in
kernel/that use pr_<level>, some with an embedded prefix, that also do not have a specificpr_fmtdefine.Add
pr_fmtfor those files.There are some differences in output as some messages are now prefixed with their
KBUILD_MODNAME.
Quoted 7 lines
Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formatsSigned-off-by Joe Perches <[email protected]>
Quoted 836 lines
---
kernel/acct.c | 2 ++ kernel/async.c | 14 ++++++------ kernel/audit_tree.c | 2 +- kernel/backtracetest.c | 8 +++---- kernel/crash_core.c | 29 ++++++++++++++----------- kernel/exit.c | 2 ++ kernel/hung_task.c | 13 +++++------ kernel/kprobes.c | 20 ++++++++++------- kernel/module.c | 59 +++++++++++++++++++++++--------------------------- kernel/panic.c | 3 +++ kernel/params.c | 13 ++++++----- kernel/pid.c | 2 ++ kernel/profile.c | 2 ++ kernel/range.c | 2 +- kernel/relay.c | 5 ++++- kernel/seccomp.c | 4 +++- kernel/signal.c | 10 +++++---- kernel/smpboot.c | 5 ++++- kernel/taskstats.c | 4 +++- kernel/torture.c | 6 +++-- kernel/tracepoint.c | 3 +++ kernel/workqueue.c | 2 ++ 22 files changed, 122 insertions(+), 88 deletions(-)kernel/acct.c +2
-0@@ -44,6 +44,8 @@* a struct file opened for write. Fixed. 2/6/2000, AV. */ +#define pr_fmt (fmt) fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/acct.h> kernel/async.c +7
-7@@ -120,8 +120,8 @@ static void async_run_entry_fn(struct work_struct *work)/* 1) run (and print duration) */ if (initcall_debug && system_state <SYSTEM_RUNNING ) {pr_debug ("calling %lli_%pF @ %i\n" , - (long long )entry->cookie, - entry->func,task_pid_nr (current)); + (long long )entry->cookie, + entry->func,task_pid_nr (current)); calltime =ktime_get (); } entry->func (entry->data, entry->cookie);@@ -129,9 +129,9 @@ static void async_run_entry_fn(struct work_struct *work) rettime =ktime_get (); delta =ktime_sub (rettime, calltime);pr_debug ("initcall %lli_%pF returned 0 after %lld usecs\n" , - (long long )entry->cookie, - entry->func, - (long long )ktime_to_ns (delta) >>10 ); + (long long )entry->cookie, + entry->func, + (long long )ktime_to_ns (delta) >>10 ); }/* 2) remove self from the pending queues */ @@ -300,8 +300,8 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, struct async_domain delta =ktime_sub (endtime, starttime);pr_debug ("async_continuing @ %i after %lli usec\n" , -task_pid_nr (current), - (long long )ktime_to_ns (delta) >>10 ); +task_pid_nr (current), + (long long )ktime_to_ns (delta) >>10 ); } }EXPORT_SYMBOL_GPL (async_synchronize_cookie_domain);kernel/audit_tree.c +1
-1@@ -739,7 +739,7 @@ static int audit_launch_prune(void) prune_thread =kthread_run (prune_tree_thread,NULL ,"audit_prune_tree" );if (IS_ERR (prune_thread)) { -pr_err ("cannot start thread audit_prune_tree" ); +pr_err ("cannot start thread audit_prune_tree\n" ); prune_thread =NULL ;return -ENOMEM ; }kernel/backtracetest.c +4
-4@@ -19,7 +19,7 @@static void backtrace_test_normal (void ) { -pr_info ("Testing a backtrace from process context.\n" ); +pr_info ("Testing a backtrace from process context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );dump_stack ();@@ -37,7 +37,7 @@ static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);static void backtrace_test_irq (void ) { -pr_info ("Testing a backtrace from irq context.\n" ); +pr_info ("Testing a backtrace from irq context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );init_completion (&backtrace_work);@@ -51,7 +51,7 @@ static void backtrace_test_saved(void)struct stack_trace trace;unsigned long entries[8 ]; -pr_info ("Testing a saved backtrace.\n" ); +pr_info ("Testing a saved backtrace\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" ); trace.nr_entries =0 ;@@ -65,7 +65,7 @@ static void backtrace_test_saved(void)#else static void backtrace_test_saved (void ) { -pr_info ("Saved backtrace test skipped.\n" ); +pr_info ("Saved backtrace test skipped\n" ); }#endif kernel/crash_core.c +16
-13@@ -6,6 +6,8 @@* Version 2. See the file COPYING for more details. */ +#define pr_fmt (fmt) "crashkernel: " fmt +#include <linux/crash_core.h> #include <linux/utsname.h> #include <linux/vmalloc.h> @@ -49,12 +51,12 @@ static int __init parse_crashkernel_mem(char *cmdline,/* get the start of the range */ start =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (*cur !='-' ) { -pr_warn ("crashkernel: '-' expected\n" ); +pr_warn ("'-' expected\n" );return -EINVAL ; } cur++;@@ -63,18 +65,18 @@ static int __init parse_crashkernel_mem(char *cmdline,if (*cur !=':' ) { end =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (end <= start) { -pr_warn ("crashkernel: end <= start\n" ); +pr_warn ("end <= start\n" );return -EINVAL ; } }if (*cur !=':' ) { -pr_warn ("crashkernel: ':' expected\n" ); +pr_warn ("':' expected\n" );return -EINVAL ; } cur++;@@ -86,7 +88,7 @@ static int __init parse_crashkernel_mem(char *cmdline, } cur = tmp;if (size >= system_ram) { -pr_warn ("crashkernel: invalid size\n" ); +pr_warn ("invalid size\n" );return -EINVAL ; }@@ -108,8 +110,9 @@ static int __init parse_crashkernel_mem(char *cmdline,return -EINVAL ; } } - }else -pr_info ("crashkernel size resulted in zero bytes\n" ); + }else { +pr_info ("size resulted in zero bytes\n" ); + }return 0 ; }@@ -129,14 +132,14 @@ static int __init parse_crashkernel_simple(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }if (*cur =='@' ) *crash_base =memparse (cur+1 , &cur);else if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }@@ -167,18 +170,18 @@ static int __init parse_crashkernel_suffix(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }/* check with suffix */ if (strncmp (cur, suffix,strlen (suffix))) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; } cur +=strlen (suffix);if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }kernel/exit.c +2
-0@@ -4,6 +4,8 @@* Copyright (C) 1991, 1992 Linus Torvalds */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/sched/autogroup.h> kernel/hung_task.c +6
-7@@ -113,14 +113,13 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)if (sysctl_hung_task_warnings) {if (sysctl_hung_task_warnings >0 ) sysctl_hung_task_warnings--; -pr_err ("INFO: task %s:%d blocked for more than %ld seconds.\n" , - t->comm, t->pid, timeout); +pr_err ("INFO: task %s:%d blocked for more than %ld seconds\n" , + t->comm, t->pid, timeout);pr_err (" %s %s %.*s\n" , -print_tainted (),init_utsname ()->release, - (int )strcspn (init_utsname ()->version," " ), -init_utsname ()->version); -pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" -" disables this message.\n" ); +print_tainted (),init_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->version); +pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\" disables this message\n" );sched_show_task (t); hung_task_show_lock = true; }kernel/kprobes.c +10
-6@@ -31,6 +31,9 @@* <[email protected]> and Prasanna S Panchamukhi * <[email protected]> added function-return probes. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kprobes.h> #include <linux/hash.h> #include <linux/init.h> @@ -985,7 +988,8 @@ static int arm_kprobe_ftrace(struct kprobe *p) ret =ftrace_set_filter_ip (&kprobe_ftrace_ops, (unsigned long )p->addr,0 ,0 );if (ret) { -pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , p->addr, ret); +pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , + p->addr, ret);return ret; }@@ -2198,7 +2202,7 @@ static int __init populate_kprobe_blacklist(unsigned long *start,if (!kernel_text_address (entry) || !kallsyms_lookup_size_offset (entry, &size, &offset)) {pr_err ("Failed to find blacklist at %p\n" , - (void *)entry); + (void *)entry);continue ; }@@ -2281,8 +2285,8 @@ static int __init init_kprobes(void) err =populate_kprobe_blacklist (__start_kprobe_blacklist, __stop_kprobe_blacklist);if (err) { -pr_err ("kprobes: failed to populate blacklist: %d\n" , err); -pr_err ("Please take care of using kprobes.\n" ); +pr_err ("failed to populate blacklist: %d\n" , err); +pr_err ("Please take care of using kprobes\n" ); }if (kretprobe_blacklist_size) {@@ -2488,10 +2492,10 @@ static int arm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally enabled, but failed to arm %d out of %d probes\n" , +pr_warn ("globally enabled, but failed to arm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally enabled\n" ); +pr_info ("globally enabled\n" );
already_enabled:mutex_unlock(&kprobe_mutex);kernel/kprobes.c +2
-2@@ -2531,10 +2535,10 @@ static int disarm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally disabled, but failed to disarm %d out of %d probes\n" , +pr_warn ("globally disabled, but failed to disarm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally disabled\n" ); +pr_info ("globally disabled\n" );mutex_unlock (&kprobe_mutex);kernel/module.c +27
-32@@ -16,6 +16,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/extable.h> #include <linux/moduleloader.h> @@ -523,21 +526,17 @@ static bool check_symbol(const struct symsearch *syms,if (syms->licence ==GPL_ONLY )return false;if (syms->licence ==WILL_BE_GPL_ONLY && fsa->warn) { -pr_warn ("Symbol %s is being used by a non-GPL module, " -"which will not be allowed in the future\n" , +pr_warn ("Symbol %s is being used by a non-GPL module, which will not be allowed in the future.\n" , fsa->name); } }#ifdef CONFIG_UNUSED_SYMBOLS if (syms->unused && fsa->warn) { -pr_warn ("Symbol %s is marked as UNUSED, however this module is " -"using it.\n" , fsa->name); +pr_warn ("Symbol %s is marked as UNUSED, however this module is using it.\n" , + fsa->name);pr_warn ("This symbol will go away in the future.\n" ); -pr_warn ("Please evaluate if this is the right api to use and " -"if it really is, submit a report to the linux kernel " -"mailing list together with submitting your code for " -"inclusion.\n" ); +pr_warn ("Please evaluate if this is the right api to use and if it really is, submit a report to the linux kernel mailing list together with submitting your code for inclusion.\n" ); }#endif @@ -843,7 +842,7 @@ static int add_module_usage(struct module *a, struct module *b) {struct module_use *use; -pr_debug ("Allocating new usage for %s.\n" , a->name); +pr_debug ("Allocating new usage for %s\n" , a->name); use =kmalloc (sizeof (*use),GFP_ATOMIC );if (!use)return -ENOMEM ;@@ -1265,7 +1264,7 @@ static int try_to_force_load(struct module *mod, const char *reason) {#ifdef CONFIG_MODULE_FORCE_LOAD if (!test_taint (TAINT_FORCED_MODULE )) -pr_warn ("%s: %s: kernel tainted.\n" , mod->name, reason); +pr_warn ("%s: %s: kernel tainted\n" , mod->name, reason);add_taint_module (mod,TAINT_FORCED_MODULE ,LOCKDEP_NOW_UNRELIABLE );return 0 ;#else @@ -1435,7 +1434,7 @@ resolve_symbol_wait(struct module *mod, !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) || PTR_ERR(ksym) != -EBUSY, 30 * HZ) <= 0) { -pr_warn ("%s: gave up waiting for init of module %s.\n" , +pr_warn ("%s: gave up waiting for init of module %s\n" , mod->name, owner); }return ksym;@@ -2224,8 +2223,7 @@ static int verify_export_symbols(struct module *mod)for (i =0 ; i <ARRAY_SIZE (arr); i++) {for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {if (find_symbol (s->name, &owner,NULL , true, false)) { -pr_err ("%s: exports duplicate symbol %s" -" (owned by %s)\n" , +pr_err ("%s: exports duplicate symbol %s (owned by %s)\n" , mod->name, s->name,module_name (owner));return -ENOEXEC ; }@@ -2257,14 +2255,14 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)supposed to happen. */ pr_debug ("Common symbol: %s\n" , name);pr_warn ("%s: please compile with -fno-common\n" , - mod->name); + mod->name); ret = -ENOEXEC ;break ;case SHN_ABS :/* Don't need to do anything */ pr_debug ("Absolute symbol: 0x%08lx\n" , - (long )sym[i].st_value); + (long )sym[i].st_value);break ;case SHN_LIVEPATCH :@@ -2454,7 +2452,7 @@ static void set_license(struct module *mod, const char *license)if (!license_is_gpl_compatible (license)) {if (!test_taint (TAINT_PROPRIETARY_MODULE )) -pr_warn ("%s: module license '%s' taints kernel.\n" , +pr_warn ("%s: module license '%s' taints kernel\n" , mod->name, license);add_taint_module (mod,TAINT_PROPRIETARY_MODULE ,LOCKDEP_NOW_UNRELIABLE );@@ -2717,7 +2715,7 @@ static void dynamic_debug_setup(struct module *mod, struct _ddebug *debug, unsig#ifdef CONFIG_DYNAMIC_DEBUG if (ddebug_add_module (debug, num, mod->name))pr_err ("dynamic debug error adding module: %s\n" , - debug->modname); + debug->modname);#endif }@@ -2849,7 +2847,7 @@ static int check_modinfo_livepatch(struct module *mod, struct load_info *info)static int check_modinfo_livepatch (struct module *mod,struct load_info *info) {if (get_modinfo (info,"livepatch" )) { -pr_err ("%s: module is marked as livepatch module, but livepatch support is disabled" , +pr_err ("%s: module is marked as livepatch module, but livepatch support is disabled\n" , mod->name);return -ENOEXEC ; }@@ -2863,7 +2861,7 @@ static void check_modinfo_retpoline(struct module *mod, struct load_info *info)if (retpoline_module_ok (get_modinfo (info,"retpoline" )))return ; -pr_warn ("%s: loading module not compiled with retpoline compiler.\n" , +pr_warn ("%s: loading module not compiled with retpoline compiler\n" , mod->name); }@@ -3037,8 +3035,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)if (get_modinfo (info,"staging" )) {add_taint_module (mod,TAINT_CRAP ,LOCKDEP_STILL_OK ); -pr_warn ("%s: module is from the staging directory, the quality " -"is unknown, you have been warned.\n" , mod->name); +pr_warn ("%s: module is from the staging directory, the quality is unknown, you have been warned\n" , + mod->name); } err =check_modinfo_livepatch (mod, info);@@ -3089,8 +3087,8 @@ static int find_module_sections(struct module *mod, struct load_info *info)* This shouldn't happen with same compiler and binutils * building all parts of the module. */ -pr_warn ("%s: has both .ctors and .init_array.\n" , - mod->name); +pr_warn ("%s: has both .ctors and .init_array\n" , + mod->name); return -EINVAL; }#endif @@ -3227,7 +3225,7 @@ static int check_module_license_and_versions(struct module *mod) LOCKDEP_NOW_UNRELIABLE);if (!prev_taint &&test_taint (TAINT_PROPRIETARY_MODULE )) -pr_warn ("%s: module license taints kernel.\n" , mod->name); +pr_warn ("%s: module license taints kernel\n" , mod->name);#ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !mod->crcs)@@ -3459,8 +3457,7 @@ static noinline int do_init_module(struct module *mod) goto fail_free_freeinit; }if (ret >0 ) { -pr_warn ("%s: '%s'->init suspiciously returned %d, it should " -"follow 0/-E convention\n" +pr_warn ("%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n" "%s: loading module anyway...\n" , __func__, mod->name, ret, __func__);dump_stack ();@@ -3686,9 +3683,8 @@ static int load_module(struct load_info *info, const char __user *uargs,#ifdef CONFIG_MODULE_SIG mod->sig_ok = info->sig_ok;if (!mod->sig_ok) { -pr_notice_once ("%s: module verification failed: signature " -"and/or required key missing - tainting " -"kernel\n" , mod->name); +pr_notice_once ("%s: module verification failed: signature and/or required key missing - tainting kernel\n" , + mod->name);add_taint_module (mod,TAINT_UNSIGNED_MODULE ,LOCKDEP_STILL_OK ); }#endif @@ -3763,7 +3759,7 @@ static int load_module(struct load_info *info, const char __user *uargs, goto coming_cleanup; }else if (after_dashes) {pr_warn ("%s: parameters '%s' after `--' ignored\n" , - mod->name, after_dashes); + mod->name, after_dashes); }/* Link in to sysfs. */ @@ -3843,8 +3839,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,if (err)return err; -pr_debug ("init_module: umod=%p, len=%lu, uargs=%p\n" , - umod, len, uargs); +pr_debug ("init_module: umod=%p, len=%lu, uargs=%p\n" , umod, len, uargs); err =copy_module_from_user (umod, len, &info);if (err)kernel/panic.c +3
-0@@ -8,6 +8,9 @@* This function is used through-out the kernel (including mm and fs) * to indicate a major problem. */ + +#define pr_fmt (fmt) fmt +#include <linux/debug_locks.h> #include <linux/sched/debug.h> #include <linux/interrupt.h> kernel/params.c +8
-5@@ -15,6 +15,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> @@ -141,8 +144,8 @@ static int parse_one(char *param,if (!val && !(params[i].ops->flags &KERNEL_PARAM_OPS_FL_NOARG ))return -EINVAL ; -pr_debug ("handling %s with %p\n" , param, - params[i].ops->set); +pr_debug ("handling %s with %p\n" , + param, params[i].ops->set);kernel_param_lock (params[i].mod);param_check_unsafe (¶ms[i]); err = params[i].ops->set (val, ¶ms[i]);@@ -496,8 +499,8 @@ int param_set_copystring(const char *val, const struct kernel_param *kp)const struct kparam_string *kps = kp->str;if (strlen (val)+1 > kps->maxlen) { -pr_err ("%s: string doesn't fit in %u chars.\n" , - kp->name, kps->maxlen-1 ); +pr_err ("%s: string doesn't fit in %u chars\n" , + kp->name, kps->maxlen -1 );return -ENOSPC ; }strcpy (kps->string, val);@@ -763,7 +766,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)#endif if (err) {kobject_put (&mk->kobj); -pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable.\n" , +pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable\n" , name, err);return NULL ; }kernel/pid.c +2
-0@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/export.h> #include <linux/slab.h> kernel/profile.c +2
-0@@ -14,6 +14,8 @@* Oracle, 2004 */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/profile.h> #include <linux/bootmem.h> kernel/range.c +1
-1@@ -102,7 +102,7 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].start = end; }else {pr_err ("%s: run out of slot in ranges\n" , - __func__); + __func__); } range[j].end = start;continue ;kernel/relay.c +4
-1@@ -12,6 +12,9 @@* * This file is released under the GPL. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/errno.h> #include <linux/stddef.h> #include <linux/slab.h> @@ -527,7 +530,7 @@ int relay_prepare_cpu(unsigned int cpu)continue ; buf =relay_open_buf (chan, cpu);if (!buf) { -pr_err ("relay: cpu %d buffer creation failed\n" , cpu); +pr_err ("cpu %d buffer creation failed\n" , cpu);mutex_unlock (&relay_channels_mutex);return -ENOMEM ; }kernel/seccomp.c +3
-1@@ -14,6 +14,8 @@* of Berkeley Packet Filters/Linux Socket Filters. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/refcount.h> #include <linux/audit.h> #include <linux/compat.h> @@ -1323,7 +1325,7 @@ static int __init seccomp_sysctl_init(void) hdr =register_sysctl_paths (seccomp_sysctl_path, seccomp_sysctl_table);if (!hdr) -pr_warn ("seccomp: sysctl registration failed\n" ); +pr_warn ("sysctl registration failed\n" );else kmemleak_not_leak (hdr);kernel/signal.c +6
-4@@ -10,6 +10,8 @@* to allow signals to be sent reliably. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/slab.h> #include <linux/export.h> #include <linux/init.h> @@ -235,7 +237,7 @@ static inline void print_dropped_signal(int sig)return ;pr_info ("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n" , - current->comm, current->pid, sig); + current->comm, current->pid, sig); }/** @@ -1118,10 +1120,10 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,static void print_fatal_signal (int signr) {struct pt_regs *regs =signal_pt_regs (); -pr_info ("potentially unexpected fatal signal %d.\n" , signr); +pr_info ("potentially unexpected fatal signal %d\n" , signr);#if defined(__i386__) && !defined(__arch_um__) -pr_info ("code at %08lx: " , regs->ip); +pr_info ("code at %08lx:" , regs->ip); {int i;for (i =0 ; i <16 ; i++) {@@ -1129,7 +1131,7 @@ static void print_fatal_signal(int signr)if (get_user (insn, (unsigned char *)(regs->ip + i)))break ; -pr_cont ("%02x " , insn); +pr_cont (" %02x" , insn); } }pr_cont ("\n" );kernel/smpboot.c +4
-1@@ -1,6 +1,9 @@/* * Common SMP CPU bringup/teardown functions */ + +#define pr_fmt (fmt) "SMP: " fmt +#include <linux/cpu.h> #include <linux/err.h> #include <linux/smp.h> @@ -54,7 +57,7 @@ static inline void idle_init(unsigned int cpu)if (!tsk) { tsk =fork_idle (cpu);if (IS_ERR (tsk)) -pr_err ("SMP: fork_idle() failed for CPU %u\n" , cpu); +pr_err ("fork_idle() failed for CPU %u\n" , cpu);else per_cpu (idle_threads, cpu) = tsk; }kernel/taskstats.c +3
-1@@ -16,6 +16,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/taskstats_kern.h> #include <linux/tsacct_kern.h> @@ -690,7 +692,7 @@ static int __init taskstats_init(void)return rc; family_registered =1 ; -pr_info ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION ); +pr_info ("registered version %d\n" ,TASKSTATS_GENL_VERSION );return 0 ; }kernel/torture.c +4
-2@@ -20,6 +20,9 @@* Author: Paul E. McKenney <[email protected]> * Based on kernel/rcu/torture.c. */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -99,8 +102,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,return false;if (verbose) -pr_alert ("%s" TORTURE_FLAG -"torture_onoff task: offlining %d\n" , +pr_alert ("%s" TORTURE_FLAG "torture_onoff task: offlining %d\n" , torture_type, cpu); starttime = jiffies; (*n_offl_attempts)++;kernel/tracepoint.c +3
-0@@ -15,6 +15,9 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/mutex.h> #include <linux/types.h> kernel/workqueue.c +2
-0@@ -24,6 +24,8 @@* Please read Documentation/core-api/workqueue.rst for details. */ +#define pr_fmt (fmt) fmt +#include <linux/export.h> #include <linux/kernel.h> #include <linux/sched.h> Signature · 1 line
2.15.0
tip-bot for Joe Perches
merge bot[tip:x86/cleanups] x86: Remove pr_fmt duplicate logging prefixes
In reply to Joe Perchesx86: Remove pr_fmt duplicate logging prefixes
Commit-ID: 1de392f5d5e803663abbd8ed084233f154152bcd Gitweb: https://git.kernel.org/tip/1de392f5d5e803663abbd8ed084233f154152bcd Author: Joe Perches <[email protected]> AuthorDate: Thu, 10 May 2018 08:45:30 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 13 May 2018 21:25:18 +0200
x86: Remove pr_fmt duplicate logging prefixes
Converting pr_fmt from a default simple #define to use KBUILD_MODNAME added some duplicate prefixes.
Remove the duplicate prefixes.
--- arch/x86/events/amd/ibs.c | 2 +- arch/x86/kernel/e820.c | 32 +++++++++++++++++--------------- arch/x86/kernel/hpet.c | 5 ++--- arch/x86/kernel/uprobes.c | 4 ++-- arch/x86/mm/numa.c | 22 +++++++++++----------- 5 files changed, 33 insertions(+), 32 deletions(-)
arch/x86/events/amd/ibs.c +1 -1
@@ -889,7 +889,7 @@ static void force_ibs_eilvt_setup(void)if (!ibs_eilvt_valid ()) goto out; -pr_info ("IBS: LVT offset %d assigned\n" , offset); +pr_info ("LVT offset %d assigned\n" , offset);return ; out:
arch/x86/kernel/e820.c +17 -15
@@ -155,7 +155,8 @@ static void __init __e820__range_add(struct e820_table *table, u64 start, u64 siint x = table->nr_entries;if (x >=ARRAY_SIZE (table->entries)) { -pr_err ("e820: too many entries; ignoring [mem %#010llx-%#010llx]\n" , start, start + size -1 ); +pr_err ("too many entries; ignoring [mem %#010llx-%#010llx]\n" , + start, start + size -1 );return ; }
@@ -190,9 +191,10 @@ void __init e820__print_table(char *who)int i;for (i =0 ; i < e820_table->nr_entries; i++) { -pr_info ("%s: [mem %#018Lx-%#018Lx] " , who, - e820_table->entries[i].addr, - e820_table->entries[i].addr + e820_table->entries[i].size -1 ); +pr_info ("%s: [mem %#018Lx-%#018Lx] " , + who, + e820_table->entries[i].addr, + e820_table->entries[i].addr + e820_table->entries[i].size -1 );e820_print_type (e820_table->entries[i].type);pr_cont ("\n" );
@@ -574,7 +576,7 @@ void __init e820__update_table_print(void)if (e820__update_table (e820_table))return ; -pr_info ("e820: modified physical RAM map:\n" ); +pr_info ("modified physical RAM map:\n" );e820__print_table ("modified" ); }
@@ -636,9 +638,8 @@ __init void e820__setup_pci_gap(void)if (!found) {#ifdef CONFIG_X86_64 gapstart = (max_pfn <<PAGE_SHIFT ) +1024 *1024 ; -pr_err ( -"e820: Cannot find an available gap in the 32-bit address range\n" -"e820: PCI devices with unassigned 32-bit BARs may not work!\n" ); +pr_err ("Cannot find an available gap in the 32-bit address range\n" ); +pr_err ("PCI devices with unassigned 32-bit BARs may not work!\n" );#else gapstart =0x10000000 ;#endif
@@ -649,7 +650,8 @@ __init void e820__setup_pci_gap(void)*/ pci_mem_start = gapstart; -pr_info ("e820: [mem %#010lx-%#010lx] available for PCI devices\n" , gapstart, gapstart + gapsize -1 ); +pr_info ("[mem %#010lx-%#010lx] available for PCI devices\n" , + gapstart, gapstart + gapsize -1 ); }/*
@@ -711,7 +713,7 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len)memcpy (e820_table_firmware, e820_table,sizeof (*e820_table_firmware));early_memunmap (sdata, data_len); -pr_info ("e820: extended physical RAM map:\n" ); +pr_info ("extended physical RAM map:\n" );e820__print_table ("extended" ); }
@@ -780,7 +782,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align) addr =__memblock_alloc_base (size, align,MEMBLOCK_ALLOC_ACCESSIBLE );if (addr) {e820__range_update_kexec (addr, size,E820_TYPE_RAM ,E820_TYPE_RESERVED ); -pr_info ("e820: update e820_table_kexec for e820__memblock_alloc_reserved()\n" ); +pr_info ("update e820_table_kexec for e820__memblock_alloc_reserved()\n" );e820__update_table_kexec (); }
@@ -830,8 +832,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_typeif (last_pfn > max_arch_pfn) last_pfn = max_arch_pfn; -pr_info ("e820: last_pfn = %#lx max_arch_pfn = %#lx\n" , - last_pfn, max_arch_pfn); +pr_info ("last_pfn = %#lx max_arch_pfn = %#lx\n" , + last_pfn, max_arch_pfn);return last_pfn; }
@@ -1005,7 +1007,7 @@ void __init e820__finish_early_params(void)if (e820__update_table (e820_table) <0 )early_panic ("Invalid user supplied memory map" ); -pr_info ("e820: user-defined physical RAM map:\n" ); +pr_info ("user-defined physical RAM map:\n" );e820__print_table ("user" ); } }
@@ -1238,7 +1240,7 @@ void __init e820__memory_setup(void)memcpy (e820_table_kexec, e820_table,sizeof (*e820_table_kexec));memcpy (e820_table_firmware, e820_table,sizeof (*e820_table_firmware)); -pr_info ("e820: BIOS-provided physical RAM map:\n" ); +pr_info ("BIOS-provided physical RAM map:\n" );e820__print_table (who); }
arch/x86/kernel/hpet.c +2 -3
@@ -975,8 +975,7 @@ int __init hpet_enable(void) cfg &= ~(HPET_CFG_ENABLE |HPET_CFG_LEGACY );hpet_writel (cfg,HPET_CFG );if (cfg) -pr_warn ("HPET: Unrecognized bits %#x set in global cfg\n" , - cfg); +pr_warn ("Unrecognized bits %#x set in global cfg\n" , cfg);for (i =0 ; i <= last; ++i) { cfg =hpet_readl (HPET_Tn_CFG (i));
@@ -988,7 +987,7 @@ int __init hpet_enable(void) | HPET_TN_64BIT_CAP | HPET_TN_32BIT | HPET_TN_ROUTE | HPET_TN_FSB | HPET_TN_FSB_CAP);if (cfg) -pr_warn ("HPET: Unrecognized bits %#x set in cfg#%u\n" , +pr_warn ("Unrecognized bits %#x set in cfg#%u\n" , cfg, i); }hpet_print_config ();
arch/x86/kernel/uprobes.c +2 -2
@@ -1079,8 +1079,8 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regsreturn orig_ret_vaddr;if (nleft != rasize) { -pr_err ("uprobe: return address clobbered: pid=%d, %%sp=%#lx, " -"%%ip=%#lx\n" , current->pid, regs->sp, regs->ip); +pr_err ("return address clobbered: pid=%d, %%sp=%#lx, %%ip=%#lx\n" , + current->pid, regs->sp, regs->ip);force_sig_info (SIGSEGV ,SEND_SIG_FORCED , current); }
arch/x86/mm/numa.c +11 -11
@@ -136,13 +136,13 @@ static int __init numa_add_memblk_to(int nid, u64 start, u64 end,/* whine about and ignore invalid blks */ if (start > end || nid <0 || nid >=MAX_NUMNODES ) { -pr_warning ("NUMA: Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n" , - nid, start, end -1 ); +pr_warn ("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n" , + nid, start, end -1 );return 0 ; }if (mi->nr_blks >=NR_NODE_MEMBLKS ) { -pr_err ("NUMA: too many memblk ranges\n" ); +pr_err ("too many memblk ranges\n" );return -EINVAL ; }
@@ -267,14 +267,14 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi)*/ if (bi->end > bj->start && bi->start < bj->end) {if (bi->nid != bj->nid) { -pr_err ("NUMA: node %d [mem %#010Lx-%#010Lx] overlaps with node %d [mem %#010Lx-%#010Lx]\n" , +pr_err ("node %d [mem %#010Lx-%#010Lx] overlaps with node %d [mem %#010Lx-%#010Lx]\n" , bi->nid, bi->start, bi->end -1 , bj->nid, bj->start, bj->end -1 );return -EINVAL ; } -pr_warning ("NUMA: Warning: node %d [mem %#010Lx-%#010Lx] overlaps with itself [mem %#010Lx-%#010Lx]\n" , - bi->nid, bi->start, bi->end -1 , - bj->start, bj->end -1 ); +pr_warn ("Warning: node %d [mem %#010Lx-%#010Lx] overlaps with itself [mem %#010Lx-%#010Lx]\n" , + bi->nid, bi->start, bi->end -1 , + bj->start, bj->end -1 ); }/*
@@ -364,7 +364,7 @@ static int __init numa_alloc_distance(void) phys =memblock_find_in_range (0 ,PFN_PHYS (max_pfn_mapped), size,PAGE_SIZE );if (!phys) { -pr_warning ("NUMA: Warning: can't allocate distance table!\n" ); +pr_warn ("Warning: can't allocate distance table!\n" );/* don't retry until explicitly reset */ numa_distance = (void *)1LU ;return -ENOMEM ;
@@ -410,14 +410,14 @@ void __init numa_set_distance(int from, int to, int distance)if (from >= numa_distance_cnt || to >= numa_distance_cnt || from <0 || to <0 ) { -pr_warn_once ("NUMA: Warning: node ids are out of bound, from=%d to=%d distance=%d\n" , - from, to, distance); +pr_warn_once ("Warning: node ids are out of bound, from=%d to=%d distance=%d\n" , + from, to, distance);return ; }if ((u8 )distance != distance || (from == to && distance !=LOCAL_DISTANCE )) { -pr_warn_once ("NUMA: Warning: invalid distance parameter, from=%d to=%d distance=%d\n" , +pr_warn_once ("Warning: invalid distance parameter, from=%d to=%d distance=%d\n" , from, to, distance);return ; }
tip-bot for Joe Perches
merge bot[tip:x86/cleanups] x86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes
In reply to Joe Perchesx86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes
Commit-ID: e6d8c84a58380030457759ad6085f3792a76b2ce Gitweb: https://git.kernel.org/tip/e6d8c84a58380030457759ad6085f3792a76b2ce Author: Joe Perches <[email protected]> AuthorDate: Thu, 10 May 2018 08:45:31 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 13 May 2018 21:25:18 +0200
x86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes
Kbuild uses the first file as the name for KBUILD_MODNAME. mtrr uses main.c as its first file, so rename that file to mtrr.c and fixup the Makefile.
Remove the now duplicate "mtrr: " prefixes from the logging calls.
---
arch/x86/kernel/cpu/mtrr/Makefile | 2 +-
arch/x86/kernel/cpu/mtrr/{main.c => mtrr.c} | 33 ++++++++++++++---------------
2 files changed, 17 insertions(+), 18 deletions(-)arch/x86/kernel/cpu/mtrr/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-y := main.o if.o generic.o cleanup.o +obj-y := mtrr.o if.o generic.o cleanup.o obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
arch/x86/kernel/cpu/mtrr/mtrr.c renamed from arch/x86/kernel/cpu/mtrr/main.c +16 -17
@@ -100,7 +100,7 @@ static int have_wrcomb(void)if (dev->vendor ==PCI_VENDOR_ID_SERVERWORKS && dev->device ==PCI_DEVICE_ID_SERVERWORKS_LE && dev->revision <=5 ) { -pr_info ("mtrr: Serverworks LE rev < 6 detected. Write-combining disabled.\n" ); +pr_info ("Serverworks LE rev < 6 detected. Write-combining disabled.\n" );pci_dev_put (dev);return 0 ; }
@@ -110,7 +110,7 @@ static int have_wrcomb(void)*/ if (dev->vendor ==PCI_VENDOR_ID_INTEL && dev->device ==PCI_DEVICE_ID_INTEL_82451NX ) { -pr_info ("mtrr: Intel 450NX MMC detected. Write-combining disabled.\n" ); +pr_info ("Intel 450NX MMC detected. Write-combining disabled.\n" );pci_dev_put (dev);return 0 ; }
@@ -312,24 +312,24 @@ int mtrr_add_page(unsigned long base, unsigned long size,return error;if (type >=MTRR_NUM_TYPES ) { -pr_warn ("mtrr: type: %u invalid\n" , type); +pr_warn ("type: %u invalid\n" , type);return -EINVAL ; }/* If the type is WC, check that this processor supports it */ if ((type ==MTRR_TYPE_WRCOMB ) && !have_wrcomb ()) { -pr_warn ("mtrr: your processor doesn't support write-combining\n" ); +pr_warn ("your processor doesn't support write-combining\n" );return -ENOSYS ; }if (!size) { -pr_warn ("mtrr: zero sized request\n" ); +pr_warn ("zero sized request\n" );return -EINVAL ; }if ((base | (base + size -1 )) >> (boot_cpu_data.x86_phys_bits -PAGE_SHIFT )) { -pr_warn ("mtrr: base or size exceeds the MTRR width\n" ); +pr_warn ("base or size exceeds the MTRR width\n" );return -EINVAL ; }
@@ -360,8 +360,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, }else if (types_compatible (type, ltype))continue ; } -pr_warn ("mtrr: 0x%lx000,0x%lx000 overlaps existing" -" 0x%lx000,0x%lx000\n" , base, size, lbase, +pr_warn ("0x%lx000,0x%lx000 overlaps existing 0x%lx000,0x%lx000\n" , base, size, lbase, lsize); goto out; }
@@ -369,7 +368,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,if (ltype != type) {if (types_compatible (type, ltype))continue ; -pr_warn ("mtrr: type mismatch for %lx000,%lx000 old: %s new: %s\n" , +pr_warn ("type mismatch for %lx000,%lx000 old: %s new: %s\n" , base, size,mtrr_attrib_to_str (ltype),mtrr_attrib_to_str (type)); goto out;
@@ -395,7 +394,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, } } }else { -pr_info ("mtrr: no more MTRRs available\n" ); +pr_info ("no more MTRRs available\n" ); } error = i; out:
@@ -407,8 +406,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,static int mtrr_check (unsigned long base,unsigned long size) {if ((base & (PAGE_SIZE -1 )) || (size & (PAGE_SIZE -1 ))) { -pr_warn ("mtrr: size and base must be multiples of 4 kiB\n" ); -pr_debug ("mtrr: size: 0x%lx base: 0x%lx\n" , size, base); +pr_warn ("size and base must be multiples of 4 kiB\n" ); +pr_debug ("size: 0x%lx base: 0x%lx\n" , size, base);dump_stack ();return -1 ; }
@@ -499,22 +498,22 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) } }if (reg <0 ) { -pr_debug ("mtrr: no MTRR for %lx000,%lx000 found\n" , +pr_debug ("no MTRR for %lx000,%lx000 found\n" , base, size); goto out; } }if (reg >= max) { -pr_warn ("mtrr: register: %d too big\n" , reg); +pr_warn ("register: %d too big\n" , reg); goto out; } mtrr_if->get (reg, &lbase, &lsize, <ype);if (lsize <1 ) { -pr_warn ("mtrr: MTRR %d not used\n" , reg); +pr_warn ("MTRR %d not used\n" , reg); goto out; }if (mtrr_usage_table[reg] <1 ) { -pr_warn ("mtrr: reg: %d has count=0\n" , reg); +pr_warn ("reg: %d has count=0\n" , reg); goto out; }if (--mtrr_usage_table[reg] <1 )
@@ -775,7 +774,7 @@ void __init mtrr_bp_init(void) }if (!mtrr_enabled ()) { -pr_info ("MTRR: Disabled\n" ); +pr_info ("Disabled\n" );/* * PAT initialization relies on MTRR's rendezvous handler.
Re: [PATCH 01/18] kernel: Use pr_fmt
In reply to Joe PerchesQuoted 11 lines · On Thu, 10 May 2018 08:45:27 -0700 Joe Perches <[email protected]> wrote:
Sometime in the future, it would be useful to convert
pr_fmtfrom a default simple define to use a default prefix withKBUILD_MODNAME.There are files in
kernel/that use pr_<level>, some with an embedded prefix, that also do not have a specificpr_fmtdefine.Add
pr_fmtfor those files.There are some differences in output as some messages are now prefixed with their
KBUILD_MODNAME.
Quoted 7 lines
Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formatsSigned-off-by Joe Perches <[email protected]>
Kprobes part looks good to me.
Thanks!
Signature · 1 line
Masami Hiramatsu <[email protected]>
Re: [PATCH 01/18] kernel: Use pr_fmt
In reply to Joe PerchesQuoted 11 lines · Joe Perches
Sometime in the future, it would be useful to convert
pr_fmtfrom a default simple define to use a default prefix withKBUILD_MODNAME.There are files in
kernel/that use pr_<level>, some with an embedded prefix, that also do not have a specificpr_fmtdefine.Add
pr_fmtfor those files.There are some differences in output as some messages are now prefixed with their
KBUILD_MODNAME.
Quoted 7 lines
Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formatsSigned-off-by Joe Perches <[email protected]>
For kernel/torture.c:
Quoted 836 lines
--- kernel/acct.c | 2 ++ kernel/async.c | 14 ++++++------ kernel/audit_tree.c | 2 +- kernel/backtracetest.c | 8 +++---- kernel/crash_core.c | 29 ++++++++++++++----------- kernel/exit.c | 2 ++ kernel/hung_task.c | 13 +++++------ kernel/kprobes.c | 20 ++++++++++------- kernel/module.c | 59 +++++++++++++++++++++++--------------------------- kernel/panic.c | 3 +++ kernel/params.c | 13 ++++++----- kernel/pid.c | 2 ++ kernel/profile.c | 2 ++ kernel/range.c | 2 +- kernel/relay.c | 5 ++++- kernel/seccomp.c | 4 +++- kernel/signal.c | 10 +++++---- kernel/smpboot.c | 5 ++++- kernel/taskstats.c | 4 +++- kernel/torture.c | 6 +++-- kernel/tracepoint.c | 3 +++ kernel/workqueue.c | 2 ++ 22 files changed, 122 insertions(+), 88 deletions(-)kernel/acct.c +2
-0@@ -44,6 +44,8 @@* a struct file opened for write. Fixed. 2/6/2000, AV. */ +#define pr_fmt (fmt) fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/acct.h> kernel/async.c +7
-7@@ -120,8 +120,8 @@ static void async_run_entry_fn(struct work_struct *work)/* 1) run (and print duration) */ if (initcall_debug && system_state <SYSTEM_RUNNING ) {pr_debug ("calling %lli_%pF @ %i\n" , - (long long )entry->cookie, - entry->func,task_pid_nr (current)); + (long long )entry->cookie, + entry->func,task_pid_nr (current)); calltime =ktime_get (); } entry->func (entry->data, entry->cookie);@@ -129,9 +129,9 @@ static void async_run_entry_fn(struct work_struct *work) rettime =ktime_get (); delta =ktime_sub (rettime, calltime);pr_debug ("initcall %lli_%pF returned 0 after %lld usecs\n" , - (long long )entry->cookie, - entry->func, - (long long )ktime_to_ns (delta) >>10 ); + (long long )entry->cookie, + entry->func, + (long long )ktime_to_ns (delta) >>10 ); }/* 2) remove self from the pending queues */ @@ -300,8 +300,8 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, struct async_domain delta =ktime_sub (endtime, starttime);pr_debug ("async_continuing @ %i after %lli usec\n" , -task_pid_nr (current), - (long long )ktime_to_ns (delta) >>10 ); +task_pid_nr (current), + (long long )ktime_to_ns (delta) >>10 ); } }EXPORT_SYMBOL_GPL (async_synchronize_cookie_domain);kernel/audit_tree.c +1
-1@@ -739,7 +739,7 @@ static int audit_launch_prune(void) prune_thread =kthread_run (prune_tree_thread,NULL ,"audit_prune_tree" );if (IS_ERR (prune_thread)) { -pr_err ("cannot start thread audit_prune_tree" ); +pr_err ("cannot start thread audit_prune_tree\n" ); prune_thread =NULL ;return -ENOMEM ; }kernel/backtracetest.c +4
-4@@ -19,7 +19,7 @@static void backtrace_test_normal (void ) { -pr_info ("Testing a backtrace from process context.\n" ); +pr_info ("Testing a backtrace from process context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );dump_stack ();@@ -37,7 +37,7 @@ static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);static void backtrace_test_irq (void ) { -pr_info ("Testing a backtrace from irq context.\n" ); +pr_info ("Testing a backtrace from irq context\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" );init_completion (&backtrace_work);@@ -51,7 +51,7 @@ static void backtrace_test_saved(void)struct stack_trace trace;unsigned long entries[8 ]; -pr_info ("Testing a saved backtrace.\n" ); +pr_info ("Testing a saved backtrace\n" );pr_info ("The following trace is a kernel self test and not a bug!\n" ); trace.nr_entries =0 ;@@ -65,7 +65,7 @@ static void backtrace_test_saved(void)#else static void backtrace_test_saved (void ) { -pr_info ("Saved backtrace test skipped.\n" ); +pr_info ("Saved backtrace test skipped\n" ); }#endif kernel/crash_core.c +16
-13@@ -6,6 +6,8 @@* Version 2. See the file COPYING for more details. */ +#define pr_fmt (fmt) "crashkernel: " fmt +#include <linux/crash_core.h> #include <linux/utsname.h> #include <linux/vmalloc.h> @@ -49,12 +51,12 @@ static int __init parse_crashkernel_mem(char *cmdline,/* get the start of the range */ start =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (*cur !='-' ) { -pr_warn ("crashkernel: '-' expected\n" ); +pr_warn ("'-' expected\n" );return -EINVAL ; } cur++;@@ -63,18 +65,18 @@ static int __init parse_crashkernel_mem(char *cmdline,if (*cur !=':' ) { end =memparse (cur, &tmp);if (cur == tmp) { -pr_warn ("crashkernel: Memory value expected\n" ); +pr_warn ("Memory value expected\n" );return -EINVAL ; } cur = tmp;if (end <= start) { -pr_warn ("crashkernel: end <= start\n" ); +pr_warn ("end <= start\n" );return -EINVAL ; } }if (*cur !=':' ) { -pr_warn ("crashkernel: ':' expected\n" ); +pr_warn ("':' expected\n" );return -EINVAL ; } cur++;@@ -86,7 +88,7 @@ static int __init parse_crashkernel_mem(char *cmdline, } cur = tmp;if (size >= system_ram) { -pr_warn ("crashkernel: invalid size\n" ); +pr_warn ("invalid size\n" );return -EINVAL ; }@@ -108,8 +110,9 @@ static int __init parse_crashkernel_mem(char *cmdline,return -EINVAL ; } } - }else -pr_info ("crashkernel size resulted in zero bytes\n" ); + }else { +pr_info ("size resulted in zero bytes\n" ); + }return 0 ; }@@ -129,14 +132,14 @@ static int __init parse_crashkernel_simple(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }if (*cur =='@' ) *crash_base =memparse (cur+1 , &cur);else if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }@@ -167,18 +170,18 @@ static int __init parse_crashkernel_suffix(char *cmdline, *crash_size =memparse (cmdline, &cur);if (cmdline == cur) { -pr_warn ("crashkernel: memory value expected\n" ); +pr_warn ("memory value expected\n" );return -EINVAL ; }/* check with suffix */ if (strncmp (cur, suffix,strlen (suffix))) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; } cur +=strlen (suffix);if (*cur !=' ' && *cur !='\0' ) { -pr_warn ("crashkernel: unrecognized char: %c\n" , *cur); +pr_warn ("unrecognized char: %c\n" , *cur);return -EINVAL ; }kernel/exit.c +2
-0@@ -4,6 +4,8 @@* Copyright (C) 1991, 1992 Linus Torvalds */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/slab.h> #include <linux/sched/autogroup.h> kernel/hung_task.c +6
-7@@ -113,14 +113,13 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)if (sysctl_hung_task_warnings) {if (sysctl_hung_task_warnings >0 ) sysctl_hung_task_warnings--; -pr_err ("INFO: task %s:%d blocked for more than %ld seconds.\n" , - t->comm, t->pid, timeout); +pr_err ("INFO: task %s:%d blocked for more than %ld seconds\n" , + t->comm, t->pid, timeout);pr_err (" %s %s %.*s\n" , -print_tainted (),init_utsname ()->release, - (int )strcspn (init_utsname ()->version," " ), -init_utsname ()->version); -pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\"" -" disables this message.\n" ); +print_tainted (),init_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->version); +pr_err ("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\" disables this message\n" );sched_show_task (t); hung_task_show_lock = true; }kernel/kprobes.c +12
-8@@ -31,6 +31,9 @@* <[email protected]> and Prasanna S Panchamukhi * <[email protected]> added function-return probes. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kprobes.h> #include <linux/hash.h> #include <linux/init.h> @@ -985,7 +988,8 @@ static int arm_kprobe_ftrace(struct kprobe *p) ret =ftrace_set_filter_ip (&kprobe_ftrace_ops, (unsigned long )p->addr,0 ,0 );if (ret) { -pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , p->addr, ret); +pr_debug ("Failed to arm kprobe-ftrace at %p (%d)\n" , + p->addr, ret);return ret; }@@ -2198,7 +2202,7 @@ static int __init populate_kprobe_blacklist(unsigned long *start,if (!kernel_text_address (entry) || !kallsyms_lookup_size_offset (entry, &size, &offset)) {pr_err ("Failed to find blacklist at %p\n" , - (void *)entry); + (void *)entry);continue ; }@@ -2281,8 +2285,8 @@ static int __init init_kprobes(void) err =populate_kprobe_blacklist (__start_kprobe_blacklist, __stop_kprobe_blacklist);if (err) { -pr_err ("kprobes: failed to populate blacklist: %d\n" , err); -pr_err ("Please take care of using kprobes.\n" ); +pr_err ("failed to populate blacklist: %d\n" , err); +pr_err ("Please take care of using kprobes\n" ); }if (kretprobe_blacklist_size) {@@ -2488,10 +2492,10 @@ static int arm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally enabled, but failed to arm %d out of %d probes\n" , +pr_warn ("globally enabled, but failed to arm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally enabled\n" ); +pr_info ("globally enabled\n" ); already_enabled:mutex_unlock (&kprobe_mutex);@@ -2531,10 +2535,10 @@ static int disarm_all_kprobes(void) }if (errors) -pr_warn ("Kprobes globally disabled, but failed to disarm %d out of %d probes\n" , +pr_warn ("globally disabled, but failed to disarm %d out of %d probes\n" , errors, total);else -pr_info ("Kprobes globally disabled\n" ); +pr_info ("globally disabled\n" );mutex_unlock (&kprobe_mutex);kernel/module.c +27
-32@@ -16,6 +16,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/extable.h> #include <linux/moduleloader.h> @@ -523,21 +526,17 @@ static bool check_symbol(const struct symsearch *syms,if (syms->licence ==GPL_ONLY )return false;if (syms->licence ==WILL_BE_GPL_ONLY && fsa->warn) { -pr_warn ("Symbol %s is being used by a non-GPL module, " -"which will not be allowed in the future\n" , +pr_warn ("Symbol %s is being used by a non-GPL module, which will not be allowed in the future.\n" , fsa->name); } }#ifdef CONFIG_UNUSED_SYMBOLS if (syms->unused && fsa->warn) { -pr_warn ("Symbol %s is marked as UNUSED, however this module is " -"using it.\n" , fsa->name); +pr_warn ("Symbol %s is marked as UNUSED, however this module is using it.\n" , + fsa->name);pr_warn ("This symbol will go away in the future.\n" ); -pr_warn ("Please evaluate if this is the right api to use and " -"if it really is, submit a report to the linux kernel " -"mailing list together with submitting your code for " -"inclusion.\n" ); +pr_warn ("Please evaluate if this is the right api to use and if it really is, submit a report to the linux kernel mailing list together with submitting your code for inclusion.\n" ); }#endif @@ -843,7 +842,7 @@ static int add_module_usage(struct module *a, struct module *b) {struct module_use *use; -pr_debug ("Allocating new usage for %s.\n" , a->name); +pr_debug ("Allocating new usage for %s\n" , a->name); use =kmalloc (sizeof (*use),GFP_ATOMIC );if (!use)return -ENOMEM ;@@ -1265,7 +1264,7 @@ static int try_to_force_load(struct module *mod, const char *reason) {#ifdef CONFIG_MODULE_FORCE_LOAD if (!test_taint (TAINT_FORCED_MODULE )) -pr_warn ("%s: %s: kernel tainted.\n" , mod->name, reason); +pr_warn ("%s: %s: kernel tainted\n" , mod->name, reason);add_taint_module (mod,TAINT_FORCED_MODULE ,LOCKDEP_NOW_UNRELIABLE );return 0 ;#else @@ -1435,7 +1434,7 @@ resolve_symbol_wait(struct module *mod, !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) || PTR_ERR(ksym) != -EBUSY, 30 * HZ) <= 0) { -pr_warn ("%s: gave up waiting for init of module %s.\n" , +pr_warn ("%s: gave up waiting for init of module %s\n" , mod->name, owner); }return ksym;@@ -2224,8 +2223,7 @@ static int verify_export_symbols(struct module *mod)for (i =0 ; i <ARRAY_SIZE (arr); i++) {for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {if (find_symbol (s->name, &owner,NULL , true, false)) { -pr_err ("%s: exports duplicate symbol %s" -" (owned by %s)\n" , +pr_err ("%s: exports duplicate symbol %s (owned by %s)\n" , mod->name, s->name,module_name (owner));return -ENOEXEC ; }@@ -2257,14 +2255,14 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)supposed to happen. */ pr_debug ("Common symbol: %s\n" , name);pr_warn ("%s: please compile with -fno-common\n" , - mod->name); + mod->name); ret = -ENOEXEC ;break ;case SHN_ABS :/* Don't need to do anything */ pr_debug ("Absolute symbol: 0x%08lx\n" , - (long )sym[i].st_value); + (long )sym[i].st_value);break ;case SHN_LIVEPATCH :@@ -2454,7 +2452,7 @@ static void set_license(struct module *mod, const char *license)if (!license_is_gpl_compatible (license)) {if (!test_taint (TAINT_PROPRIETARY_MODULE )) -pr_warn ("%s: module license '%s' taints kernel.\n" , +pr_warn ("%s: module license '%s' taints kernel\n" , mod->name, license);add_taint_module (mod,TAINT_PROPRIETARY_MODULE ,LOCKDEP_NOW_UNRELIABLE );@@ -2717,7 +2715,7 @@ static void dynamic_debug_setup(struct module *mod, struct _ddebug *debug, unsig#ifdef CONFIG_DYNAMIC_DEBUG if (ddebug_add_module (debug, num, mod->name))pr_err ("dynamic debug error adding module: %s\n" , - debug->modname); + debug->modname);#endif }@@ -2849,7 +2847,7 @@ static int check_modinfo_livepatch(struct module *mod, struct load_info *info)static int check_modinfo_livepatch (struct module *mod,struct load_info *info) {if (get_modinfo (info,"livepatch" )) { -pr_err ("%s: module is marked as livepatch module, but livepatch support is disabled" , +pr_err ("%s: module is marked as livepatch module, but livepatch support is disabled\n" , mod->name);return -ENOEXEC ; }@@ -2863,7 +2861,7 @@ static void check_modinfo_retpoline(struct module *mod, struct load_info *info)if (retpoline_module_ok (get_modinfo (info,"retpoline" )))return ; -pr_warn ("%s: loading module not compiled with retpoline compiler.\n" , +pr_warn ("%s: loading module not compiled with retpoline compiler\n" , mod->name); }@@ -3037,8 +3035,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)if (get_modinfo (info,"staging" )) {add_taint_module (mod,TAINT_CRAP ,LOCKDEP_STILL_OK ); -pr_warn ("%s: module is from the staging directory, the quality " -"is unknown, you have been warned.\n" , mod->name); +pr_warn ("%s: module is from the staging directory, the quality is unknown, you have been warned\n" , + mod->name); } err =check_modinfo_livepatch (mod, info);@@ -3089,8 +3087,8 @@ static int find_module_sections(struct module *mod, struct load_info *info)* This shouldn't happen with same compiler and binutils * building all parts of the module. */ -pr_warn ("%s: has both .ctors and .init_array.\n" , - mod->name); +pr_warn ("%s: has both .ctors and .init_array\n" , + mod->name); return -EINVAL; }#endif @@ -3227,7 +3225,7 @@ static int check_module_license_and_versions(struct module *mod) LOCKDEP_NOW_UNRELIABLE);if (!prev_taint &&test_taint (TAINT_PROPRIETARY_MODULE )) -pr_warn ("%s: module license taints kernel.\n" , mod->name); +pr_warn ("%s: module license taints kernel\n" , mod->name);#ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !mod->crcs)@@ -3459,8 +3457,7 @@ static noinline int do_init_module(struct module *mod) goto fail_free_freeinit; }if (ret >0 ) { -pr_warn ("%s: '%s'->init suspiciously returned %d, it should " -"follow 0/-E convention\n" +pr_warn ("%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n" "%s: loading module anyway...\n" , __func__, mod->name, ret, __func__);dump_stack ();@@ -3686,9 +3683,8 @@ static int load_module(struct load_info *info, const char __user *uargs,#ifdef CONFIG_MODULE_SIG mod->sig_ok = info->sig_ok;if (!mod->sig_ok) { -pr_notice_once ("%s: module verification failed: signature " -"and/or required key missing - tainting " -"kernel\n" , mod->name); +pr_notice_once ("%s: module verification failed: signature and/or required key missing - tainting kernel\n" , + mod->name);add_taint_module (mod,TAINT_UNSIGNED_MODULE ,LOCKDEP_STILL_OK ); }#endif @@ -3763,7 +3759,7 @@ static int load_module(struct load_info *info, const char __user *uargs, goto coming_cleanup; }else if (after_dashes) {pr_warn ("%s: parameters '%s' after `--' ignored\n" , - mod->name, after_dashes); + mod->name, after_dashes); }/* Link in to sysfs. */ @@ -3843,8 +3839,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,if (err)return err; -pr_debug ("init_module: umod=%p, len=%lu, uargs=%p\n" , - umod, len, uargs); +pr_debug ("init_module: umod=%p, len=%lu, uargs=%p\n" , umod, len, uargs); err =copy_module_from_user (umod, len, &info);if (err)kernel/panic.c +3
-0@@ -8,6 +8,9 @@* This function is used through-out the kernel (including mm and fs) * to indicate a major problem. */ + +#define pr_fmt (fmt) fmt +#include <linux/debug_locks.h> #include <linux/sched/debug.h> #include <linux/interrupt.h> kernel/params.c +8
-5@@ -15,6 +15,9 @@along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> @@ -141,8 +144,8 @@ static int parse_one(char *param,if (!val && !(params[i].ops->flags &KERNEL_PARAM_OPS_FL_NOARG ))return -EINVAL ; -pr_debug ("handling %s with %p\n" , param, - params[i].ops->set); +pr_debug ("handling %s with %p\n" , + param, params[i].ops->set);kernel_param_lock (params[i].mod);param_check_unsafe (¶ms[i]); err = params[i].ops->set (val, ¶ms[i]);@@ -496,8 +499,8 @@ int param_set_copystring(const char *val, const struct kernel_param *kp)const struct kparam_string *kps = kp->str;if (strlen (val)+1 > kps->maxlen) { -pr_err ("%s: string doesn't fit in %u chars.\n" , - kp->name, kps->maxlen-1 ); +pr_err ("%s: string doesn't fit in %u chars\n" , + kp->name, kps->maxlen -1 );return -ENOSPC ; }strcpy (kps->string, val);@@ -763,7 +766,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)#endif if (err) {kobject_put (&mk->kobj); -pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable.\n" , +pr_crit ("Adding module '%s' to sysfs failed (%d), the system may be unstable\n" , name, err);return NULL ; }kernel/pid.c +2
-0@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/mm.h> #include <linux/export.h> #include <linux/slab.h> kernel/profile.c +2
-0@@ -14,6 +14,8 @@* Oracle, 2004 */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/export.h> #include <linux/profile.h> #include <linux/bootmem.h> kernel/range.c +1
-1@@ -102,7 +102,7 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].start = end; }else {pr_err ("%s: run out of slot in ranges\n" , - __func__); + __func__); } range[j].end = start;continue ;kernel/relay.c +4
-1@@ -12,6 +12,9 @@* * This file is released under the GPL. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/errno.h> #include <linux/stddef.h> #include <linux/slab.h> @@ -527,7 +530,7 @@ int relay_prepare_cpu(unsigned int cpu)continue ; buf =relay_open_buf (chan, cpu);if (!buf) { -pr_err ("relay: cpu %d buffer creation failed\n" , cpu); +pr_err ("cpu %d buffer creation failed\n" , cpu);mutex_unlock (&relay_channels_mutex);return -ENOMEM ; }kernel/seccomp.c +3
-1@@ -14,6 +14,8 @@* of Berkeley Packet Filters/Linux Socket Filters. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/refcount.h> #include <linux/audit.h> #include <linux/compat.h> @@ -1323,7 +1325,7 @@ static int __init seccomp_sysctl_init(void) hdr =register_sysctl_paths (seccomp_sysctl_path, seccomp_sysctl_table);if (!hdr) -pr_warn ("seccomp: sysctl registration failed\n" ); +pr_warn ("sysctl registration failed\n" );else kmemleak_not_leak (hdr);kernel/signal.c +6
-4@@ -10,6 +10,8 @@* to allow signals to be sent reliably. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/slab.h> #include <linux/export.h> #include <linux/init.h> @@ -235,7 +237,7 @@ static inline void print_dropped_signal(int sig)return ;pr_info ("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n" , - current->comm, current->pid, sig); + current->comm, current->pid, sig); }/** @@ -1118,10 +1120,10 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,static void print_fatal_signal (int signr) {struct pt_regs *regs =signal_pt_regs (); -pr_info ("potentially unexpected fatal signal %d.\n" , signr); +pr_info ("potentially unexpected fatal signal %d\n" , signr);#if defined(__i386__) && !defined(__arch_um__) -pr_info ("code at %08lx: " , regs->ip); +pr_info ("code at %08lx:" , regs->ip); {int i;for (i =0 ; i <16 ; i++) {@@ -1129,7 +1131,7 @@ static void print_fatal_signal(int signr)if (get_user (insn, (unsigned char *)(regs->ip + i)))break ; -pr_cont ("%02x " , insn); +pr_cont (" %02x" , insn); } }pr_cont ("\n" );kernel/smpboot.c +4
-1@@ -1,6 +1,9 @@/* * Common SMP CPU bringup/teardown functions */ + +#define pr_fmt (fmt) "SMP: " fmt +#include <linux/cpu.h> #include <linux/err.h> #include <linux/smp.h> @@ -54,7 +57,7 @@ static inline void idle_init(unsigned int cpu)if (!tsk) { tsk =fork_idle (cpu);if (IS_ERR (tsk)) -pr_err ("SMP: fork_idle() failed for CPU %u\n" , cpu); +pr_err ("fork_idle() failed for CPU %u\n" , cpu);else per_cpu (idle_threads, cpu) = tsk; }kernel/taskstats.c +3
-1@@ -16,6 +16,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/taskstats_kern.h> #include <linux/tsacct_kern.h> @@ -690,7 +692,7 @@ static int __init taskstats_init(void)return rc; family_registered =1 ; -pr_info ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION ); +pr_info ("registered version %d\n" ,TASKSTATS_GENL_VERSION );return 0 ; }kernel/torture.c +4
-2@@ -20,6 +20,9 @@* Author: Paul E. McKenney <[email protected]> * Based on kernel/rcu/torture.c. */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -99,8 +102,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,return false;if (verbose) -pr_alert ("%s" TORTURE_FLAG -"torture_onoff task: offlining %d\n" , +pr_alert ("%s" TORTURE_FLAG "torture_onoff task: offlining %d\n" , torture_type, cpu); starttime = jiffies; (*n_offl_attempts)++;kernel/tracepoint.c +3
-0@@ -15,6 +15,9 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/mutex.h> #include <linux/types.h> kernel/workqueue.c +2
-0@@ -24,6 +24,8 @@* Please read Documentation/core-api/workqueue.rst for details. */ +#define pr_fmt (fmt) fmt +#include <linux/export.h> #include <linux/kernel.h> #include <linux/sched.h> Signature · 1 line
2.15.0
Re: [PATCH 01/18] kernel: Use pr_fmt
In reply to Joe PerchesQuoted 34 lines · Joe Perches
Sometime in the future, it would be useful to convert
pr_fmtfrom a default simple define to use a default prefix withKBUILD_MODNAME.There are files in
kernel/that use pr_<level>, some with an embedded prefix, that also do not have a specificpr_fmtdefine.Add
pr_fmtfor those files.There are some differences in output as some messages are now prefixed with their
KBUILD_MODNAME.Miscellanea:
o Align multiline statements to open parenthesis
o Wrap and realign arguments to 80 columns where sensible
o Coalesce formatsSigned-off-by Joe Perches <[email protected]>--- kernel/acct.c | 2 ++ kernel/async.c | 14 ++++++------ kernel/audit_tree.c | 2 +- kernel/backtracetest.c | 8 +++---- kernel/crash_core.c | 29 ++++++++++++++----------- kernel/exit.c | 2 ++ kernel/hung_task.c | 13 +++++------ kernel/kprobes.c | 20 ++++++++++------- kernel/module.c | 59 +++++++++++++++++++++++--------------------------- kernel/panic.c | 3 +++ kernel/params.c | 13 ++++++----- kernel/pid.c | 2 ++ kernel/profile.c | 2 ++ kernel/range.c | 2 +- kernel/relay.c | 5 ++++-
Quoted 8 lines
kernel/seccomp.c | 4 +++- kernel/signal.c | 10 +++++---- kernel/smpboot.c | 5 ++++- kernel/taskstats.c | 4 +++- kernel/torture.c | 6 +++-- kernel/tracepoint.c | 3 +++ kernel/workqueue.c | 2 ++ 22 files changed, 122 insertions(+), 88 deletions(-)
The audit change looks fine to me, thanks Joe.
Quoted 13 lines
kernel/audit_tree.c +1
-1@@ -739,7 +739,7 @@ static int audit_launch_prune(void) prune_thread =kthread_run (prune_tree_thread,NULL ,"audit_prune_tree" );if (IS_ERR (prune_thread)) { -pr_err ("cannot start thread audit_prune_tree" ); +pr_err ("cannot start thread audit_prune_tree\n" ); prune_thread =NULL ;return -ENOMEM ; }
Signature · 2 lines
paul moore www.paul-moore.com
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
In reply to Joe PerchesQuoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>
I took parts of this (thank you!) but have concerns about other parts.
Quoted 17 lines
--- kernel/rcu/rcu_segcblist.c | 2 ++ kernel/rcu/rcuperf.c | 10 ++++--- kernel/rcu/rcutorture.c | 46 +++++++++++++++---------------- kernel/rcu/srcutiny.c | 2 ++ kernel/rcu/srcutree.c | 5 +++- kernel/rcu/tiny.c | 3 +++ kernel/rcu/tree.c | 8 +++--- kernel/rcu/tree_plugin.h | 67 +++++++++++++++++++++++++++------------------- kernel/rcu/update.c | 19 ++++++++----- 9 files changed, 96 insertions(+), 66 deletions(-)kernel/rcu/rcu_segcblist.c +0
-0
kernel/rcu/rcu_segcblist.c line 23
Quoted 4 lines
kernel/rcu/rcu_segcblist.c +1
-0@@ -20,6 +20,8 @@* Authors: Paul E. McKenney <[email protected]> */ +#define pr_fmt (fmt) "rcu: " fmt
Given that this file has no printk()s, how is this helping? Interactions with WARN_ON() or some such?
Quoted 9 lines
kernel/rcu/rcu_segcblist.c +1
-0+#include <linux/types.h> #include <linux/kernel.h> #include <linux/interrupt.h> kernel/rcu/rcuperf.c +0
-0
kernel/rcu/rcuperf.c line 23
Quoted 5 lines
kernel/rcu/rcuperf.c +2
-0@@ -19,6 +19,9 @@* * Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) "rcu: " fmt
This is going to get us messages of the form "rcu: rcu-perf:", not? (And other odd combinations, depending on the flavor of RCU under test.) If so, this does not seem to be an improvement.
Quoted 7 lines
kernel/rcu/rcuperf.c +1
-0+#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -663,12 +666,11 @@ rcu_perf_init(void)break ; }
kernel/rcu/rcuperf.c rcu_perf_init(void) · line 673
Quoted 10 lines
kernel/rcu/rcuperf.c +3
-4if (i ==ARRAY_SIZE (perf_ops)) { -pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , - perf_type); +pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , perf_type);pr_alert ("rcu-perf types:" );for (i =0 ; i <ARRAY_SIZE (perf_ops); i++) -pr_alert (" %s" , perf_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , perf_ops[i]->name); +pr_cont ("\n" );
However, I did take the above changes, good catch!
Quoted 47 lines
kernel/rcu/rcuperf.c +0
-0firsterr = -EINVAL ; goto unwind; }kernel/rcu/rcutorture.c +7
-6@@ -22,6 +22,7 @@* * See also: Documentation/RCU/torture.txt */ +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);/* Initialize synctype[] array. If none set, take default. */ @@ -916,27 +917,27 @@ rcu_torture_writer(void *arg) gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true;if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) { synctype[nsynctypes++] =RTWS_COND_GET ; -pr_info ("%s: Testing conditional GPs.\n" , __func__); +pr_info ("%s: Testing conditional GPs\n" , __func__); }else if (gp_cond && (!cur_ops->get_state || !cur_ops->cond_sync)) { -pr_alert ("%s: gp_cond without primitives.\n" , __func__); +pr_alert ("%s: gp_cond without primitives\n" , __func__); }if (gp_exp1 && cur_ops->exp_sync) { synctype[nsynctypes++] =RTWS_EXP_SYNC ; -pr_info ("%s: Testing expedited GPs.\n" , __func__); +pr_info ("%s: Testing expedited GPs\n" , __func__); }else if (gp_exp && !cur_ops->exp_sync) { -pr_alert ("%s: gp_exp without primitives.\n" , __func__); +pr_alert ("%s: gp_exp without primitives\n" , __func__); }if (gp_normal1 && cur_ops->deferred_free) { synctype[nsynctypes++] =RTWS_DEF_FREE ; -pr_info ("%s: Testing asynchronous GPs.\n" , __func__); +pr_info ("%s: Testing asynchronous GPs\n" , __func__); }else if (gp_normal && !cur_ops->deferred_free) {
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 940
Quoted 10 lines
kernel/rcu/rcutorture.c +3
-3-pr_alert ("%s: gp_normal without primitives.\n" , __func__); +pr_alert ("%s: gp_normal without primitives\n" , __func__); }if (gp_sync1 && cur_ops->sync) { synctype[nsynctypes++] =RTWS_SYNC ; -pr_info ("%s: Testing normal GPs.\n" , __func__); +pr_info ("%s: Testing normal GPs\n" , __func__); }else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);
I used a CDC Cyber 73 in the 1970s. It had tiny memory by today's standards, but even it had periods in its error messages. We can easily afford them today, especially given that rcutorture is not included in small-memory Linux configurations.
Quoted 31 lines
kernel/rcu/rcutorture.c +3
-3}if (WARN_ONCE (nsynctypes ==0 ,"rcu_torture_writer: No update-side primitives.\n" )) {@@ -1027,7 +1028,7 @@ rcu_torture_writer(void *arg)WARN_ON_ONCE (can_expedite &&rcu_gp_is_expedited ());if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" Dynamic grace-period expediting was disabled.\n" , +" Dynamic grace-period expediting was disabled\n" , torture_type); rcu_torture_writer_state =RTWS_STOPPING ;torture_kthread_stopping ("rcu_torture_writer" );@@ -1436,7 +1437,7 @@ static int rcu_torture_stall(void *args)local_irq_disable (); elsepreempt_disable (); -pr_alert ("rcu_torture_stall start on CPU %d.\n" , +pr_alert ("rcu_torture_stall start on CPU %d\n" ,smp_processor_id ());while (ULONG_CMP_LT (get_seconds (), stop_at))continue ;/* Induce RCU CPU stall warning. */ @@ -1445,7 +1446,7 @@ static int rcu_torture_stall(void *args)else preempt_enable ();rcu_read_unlock (); -pr_alert ("rcu_torture_stall end.\n" ); +pr_alert ("rcu_torture_stall end\n" ); }torture_shutdown_absorb ("rcu_torture_stall" );while (!kthread_should_stop ())
kernel/rcu/rcutorture.c static int rcu_torture_barrier_init(void) · line 1555
Quoted 10 lines
kernel/rcu/rcutorture.c +2
-2@@ -1547,10 +1548,10 @@ static int rcu_torture_barrier_init(void)return 0 ;if (cur_ops->call ==NULL || cur_ops->cb_barrier ==NULL ) {pr_alert ("%s" TORTURE_FLAG -" Call or barrier ops missing for %s,\n" , +" Call or barrier ops missing for %s\n" , torture_type, cur_ops->name);pr_alert ("%s" TORTURE_FLAG -" RCU barrier testing omitted from run.\n" , +" RCU barrier testing omitted from run\n" , torture_type);
And the same for these.
Quoted 21 lines
kernel/rcu/rcutorture.c +2
-2return 0 ; }@@ -1679,7 +1680,7 @@ static void rcu_torture_err_cb(struct rcu_head *rhp)* next grace period. Unlikely, but can happen. If it * does happen, the debug-objects subsystem won't have splatted. */ - pr_alert("%s: duplicated callback was invoked.\n", KBUILD_MODNAME); + pr_alert("duplicated callback was invoked\n"); }#endif /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */ @@ -1696,7 +1697,7 @@ static void rcu_test_debug_objects(void)init_rcu_head_on_stack (&rh1);init_rcu_head_on_stack (&rh2); -pr_alert ("%s: WARN: Duplicate call_rcu() test starting.\n" ,KBUILD_MODNAME ); +pr_alert ("WARN: Duplicate call_rcu() test starting\n" );/* Try to queue the rh2 pair of callbacks for the same grace period. */ preempt_disable ();/* Prevent preemption from interrupting test. */
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1715
Quoted 5 lines
kernel/rcu/rcutorture.c +1
-1@@ -1711,11 +1712,11 @@ static void rcu_test_debug_objects(void)/* Wait for them all to get done so we can safely return. */ rcu_barrier (); -pr_alert ("%s: WARN: Duplicate call_rcu() test complete.\n" ,KBUILD_MODNAME ); +pr_alert ("WARN: Duplicate call_rcu() test complete\n" );
I would like to keep these, as they mark the region of console output where splats are expected.
Quoted 9 lines
kernel/rcu/rcutorture.c +1
-1destroy_rcu_head_on_stack (&rh1);destroy_rcu_head_on_stack (&rh2);#else /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */ -pr_alert ("%s: !CONFIG_DEBUG_OBJECTS_RCU_HEAD, not testing duplicate call_rcu()\n" ,KBUILD_MODNAME ); +pr_alert ("!CONFIG_DEBUG_OBJECTS_RCU_HEAD, not testing duplicate call_rcu()\n" );#endif /* #else #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */ }
kernel/rcu/rcutorture.c rcu_torture_init(void) · line 1744
Quoted 6 lines
kernel/rcu/rcutorture.c +1
-2@@ -1740,17 +1741,16 @@ rcu_torture_init(void)break ; }if (i ==ARRAY_SIZE (torture_ops)) { -pr_alert ("rcu-torture: invalid torture type: \"%s\"\n" , - torture_type); +pr_alert ("invalid torture type: \"%s\"\n" , torture_type);
I am leaving this one...
kernel/rcu/rcutorture.c rcu_torture_init(void) · line 1748
Quoted 6 lines
kernel/rcu/rcutorture.c +2
-2pr_alert ("rcu-torture types:" );for (i =0 ; i <ARRAY_SIZE (torture_ops); i++) -pr_alert (" %s" , torture_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , torture_ops[i]->name); +pr_cont ("\n" );
... but taking these. Good eyes! (Or scripts, as the case may be.)
kernel/rcu/rcutorture.c rcu_torture_init(void) · line 1753
Quoted 6 lines
kernel/rcu/rcutorture.c +1
-1firsterr = -EINVAL ; goto unwind; }if (cur_ops->fqs ==NULL && fqs_duration !=0 ) { -pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); +pr_alert ("->fqs NULL and non-zero fqs_duration, fqs disabled\n" );
This I would like to keep. Easier to find.
Quoted 30 lines
kernel/rcu/rcutorture.c +0
-0fqs_duration =0 ; }if (cur_ops->init)kernel/rcu/srcutiny.c +2
-0@@ -21,6 +21,8 @@* Author: Paul McKenney <[email protected]> */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/export.h> #include <linux/mutex.h> #include <linux/preempt.h> kernel/rcu/srcutree.c +2
-0@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/export.h> #include <linux/mutex.h> #include <linux/percpu.h>
kernel/rcu/srcutree.c void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced) · line 396
Quoted 6 lines
kernel/rcu/srcutree.c +2
-1@@ -390,7 +392,8 @@ void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced) }if (WARN_ON (rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)) !=SRCU_STATE_IDLE ) ||WARN_ON (srcu_readers_active (sp))) { -pr_info ("%s: Active srcu_struct %p state: %d\n" , __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq))); +pr_info ("%s: Active srcu_struct %p state: %d\n" , + __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)));
I took these.
Quoted 42 lines
kernel/rcu/srcutree.c +0
-0return ;/* Caller forgot to stop doing call_srcu()? */ }free_percpu (sp->sda);kernel/rcu/tiny.c +3
-0@@ -22,6 +22,9 @@* For detailed explanation of Read-Copy Update mechanism see - * Documentation/RCU */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/completion.h> #include <linux/interrupt.h> #include <linux/notifier.h> kernel/rcu/tree.c +4
-2@@ -27,6 +27,9 @@* For detailed explanation of Read-Copy Update mechanism see - * Documentation/RCU */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -1360,8 +1363,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gp_seq)* See Documentation/RCU/stallwarn.txt for info on how to debug * RCU CPU stall warnings. */ -pr_err ("INFO: %s detected stalls on CPUs/tasks:" , - rsp->name); +pr_err ("INFO: %s detected stalls on CPUs/tasks:" , rsp->name);print_cpu_stall_info_begin ();rcu_for_each_leaf_node (rsp, rnp) {raw_spin_lock_irqsave_rcu_node (rnp, flags);
kernel/rcu/tree.c static void __init rcu_init_geometry(void) · line 3990
Quoted 6 lines
kernel/rcu/tree.c +1
-1@@ -3984,7 +3986,7 @@ static void __init rcu_init_geometry(void)if (rcu_fanout_leaf ==RCU_FANOUT_LEAF && nr_cpu_ids ==NR_CPUS )return ; -pr_info ("RCU: Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , +pr_info ("Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , rcu_fanout_leaf, nr_cpu_ids);
And I took these.
Quoted 7 lines
kernel/rcu/tree.c +0
-0/* kernel/rcu/tree_plugin.h +0
-0
kernel/rcu/tree_plugin.h static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */ · line 78
Quoted 10 lines
kernel/rcu/tree_plugin.h +2
-2@@ -71,51 +71,62 @@ static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */static void __init rcu_bootup_announce_oddness (void ) {if (IS_ENABLED (CONFIG_RCU_TRACE )) -pr_info ("\tRCU event tracing is enabled.\n" ); +pr_info ("\tRCU event tracing is enabled\n" );if ((IS_ENABLED (CONFIG_64BIT ) &&RCU_FANOUT !=64 ) || (!IS_ENABLED (CONFIG_64BIT ) &&RCU_FANOUT !=32 ))pr_info ("\tCONFIG_RCU_FANOUT set to non-default value of %d\n" , -RCU_FANOUT ); +RCU_FANOUT );
I took this whitespace fix and added the period.
Quoted 10 lines
kernel/rcu/tree_plugin.h +3
-3if (rcu_fanout_exact) -pr_info ("\tHierarchical RCU autobalancing is disabled.\n" ); +pr_info ("\tHierarchical RCU autobalancing is disabled\n" );if (IS_ENABLED (CONFIG_RCU_FAST_NO_HZ )) -pr_info ("\tRCU dyntick-idle grace-period acceleration is enabled.\n" ); +pr_info ("\tRCU dyntick-idle grace-period acceleration is enabled\n" );if (IS_ENABLED (CONFIG_PROVE_RCU )) -pr_info ("\tRCU lockdep checking is enabled.\n" ); +pr_info ("\tRCU lockdep checking is enabled\n" );if (RCU_NUM_LVLS >=4 )
kernel/rcu/tree_plugin.h static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */ · line 92
Quoted 10 lines
kernel/rcu/tree_plugin.h +4
-3-pr_info ("\tFour(or more)-level hierarchy is enabled.\n" ); +pr_info ("\tFour(or more)-level hierarchy is enabled\n" );if (RCU_FANOUT_LEAF !=16 ) -pr_info ("\tBuild-time adjustment of leaf fanout to %d.\n" , +pr_info ("\tBuild-time adjustment of leaf fanout to %d\n" ,RCU_FANOUT_LEAF );if (rcu_fanout_leaf !=RCU_FANOUT_LEAF ) -pr_info ("\tBoot-time adjustment of leaf fanout to %d.\n" , rcu_fanout_leaf); +pr_info ("\tBoot-time adjustment of leaf fanout to %d\n" , + rcu_fanout_leaf);
And this whitespace fix.
kernel/rcu/tree_plugin.h static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */ · line 95
Quoted 4 lines
kernel/rcu/tree_plugin.h +2
-1if (nr_cpu_ids !=NR_CPUS ) -pr_info ("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%u.\n" ,NR_CPUS , nr_cpu_ids); +pr_info ("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%u\n" , +NR_CPUS , nr_cpu_ids);
And I took this (but kept the period), plus used "%s" to make it fit in 80 characters:
pr_info("\tRCU restricting CPUs from %s=%d to %s=%u.\n",
"NR_CPUS", NR_CPUS, "nr_cpu_ids", nr_cpu_ids);kernel/rcu/tree_plugin.h static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */ · line 98
Quoted 4 lines
kernel/rcu/tree_plugin.h +2
-1#ifdef CONFIG_RCU_BOOST -pr_info ("\tRCU priority boosting: priority %d delay %d ms.\n" , kthread_prio,CONFIG_RCU_BOOST_DELAY ); +pr_info ("\tRCU priority boosting: priority %d delay %d ms\n" , + kthread_prio,CONFIG_RCU_BOOST_DELAY );
I took this but kept the period.
Quoted 11 lines
kernel/rcu/tree_plugin.h +4
-3#endif if (blimit !=DEFAULT_RCU_BLIMIT ) -pr_info ("\tBoot-time adjustment of callback invocation limit to %ld.\n" , blimit); +pr_info ("\tBoot-time adjustment of callback invocation limit to %ld\n" , + blimit);if (qhimark !=DEFAULT_RCU_QHIMARK ) -pr_info ("\tBoot-time adjustment of callback high-water mark to %ld.\n" , qhimark); +pr_info ("\tBoot-time adjustment of callback high-water mark to %ld\n" , + qhimark);if (qlowmark !=DEFAULT_RCU_QLOMARK ) -pr_info ("\tBoot-time adjustment of callback low-water mark to %ld.\n" , qlowmark);
kernel/rcu/tree_plugin.h static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */ · line 114
Quoted 10 lines
kernel/rcu/tree_plugin.h +6
-2+pr_info ("\tBoot-time adjustment of callback low-water mark to %ld\n" , + qlowmark);if (jiffies_till_first_fqs !=ULONG_MAX ) -pr_info ("\tBoot-time adjustment of first FQS scan delay to %ld jiffies.\n" , jiffies_till_first_fqs); +pr_info ("\tBoot-time adjustment of first FQS scan delay to %ld jiffies\n" , + jiffies_till_first_fqs);if (jiffies_till_next_fqs !=ULONG_MAX ) -pr_info ("\tBoot-time adjustment of subsequent FQS scan delay to %ld jiffies.\n" , jiffies_till_next_fqs); +pr_info ("\tBoot-time adjustment of subsequent FQS scan delay to %ld jiffies\n" , + jiffies_till_next_fqs);
And these don't fit even after breaking the line, and I couldn't immediately come up with a natural way of making them fit, so I left them. In for a penny, in for a pound!
Quoted 63 lines
kernel/rcu/tree_plugin.h +14
-11if (rcu_kick_kthreads) -pr_info ("\tKick kthreads if too-long grace period.\n" ); +pr_info ("\tKick kthreads if too-long grace period\n" );if (IS_ENABLED (CONFIG_DEBUG_OBJECTS_RCU_HEAD )) -pr_info ("\tRCU callback double-/use-after-free debug enabled.\n" ); +pr_info ("\tRCU callback double-/use-after-free debug enabled\n" );if (gp_preinit_delay) -pr_info ("\tRCU debug GP pre-init slowdown %d jiffies.\n" , gp_preinit_delay); +pr_info ("\tRCU debug GP pre-init slowdown %d jiffies\n" , + gp_preinit_delay);if (gp_init_delay) -pr_info ("\tRCU debug GP init slowdown %d jiffies.\n" , gp_init_delay); +pr_info ("\tRCU debug GP init slowdown %d jiffies\n" , + gp_init_delay);if (gp_cleanup_delay) -pr_info ("\tRCU debug GP init slowdown %d jiffies.\n" , gp_cleanup_delay); +pr_info ("\tRCU debug GP init slowdown %d jiffies\n" , + gp_cleanup_delay);if (IS_ENABLED (CONFIG_RCU_EQS_DEBUG )) -pr_info ("\tRCU debug extended QS entry/exit.\n" ); +pr_info ("\tRCU debug extended QS entry/exit\n" );rcupdate_announce_bootup_oddness (); }@@ -133,7 +144,7 @@ static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp,*/ static void __init rcu_bootup_announce (void ) { -pr_info ("Preemptible hierarchical RCU implementation.\n" ); +pr_info ("Preemptible hierarchical RCU implementation\n" );rcu_bootup_announce_oddness (); }@@ -885,7 +896,7 @@ static struct rcu_state *const rcu_state_p = &rcu_sched_state;*/ static void __init rcu_bootup_announce (void ) { -pr_info ("Hierarchical RCU implementation.\n" ); +pr_info ("Hierarchical RCU implementation\n" );rcu_bootup_announce_oddness (); }@@ -2374,7 +2385,7 @@ void __init rcu_init_nohz(void)if (!cpumask_available (rcu_nocb_mask) && need_rcu_nocb_mask) {if (!zalloc_cpumask_var (&rcu_nocb_mask,GFP_KERNEL )) { -pr_info ("rcu_nocb_mask allocation failed, callback offloading disabled.\n" ); +pr_info ("rcu_nocb_mask allocation failed, callback offloading disabled\n" );return ; } }@@ -2387,17 +2398,17 @@ void __init rcu_init_nohz(void)#endif /* #if defined(CONFIG_NO_HZ_FULL) */ if (!cpumask_subset (rcu_nocb_mask, cpu_possible_mask)) { -pr_info ("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n" ); +pr_info ("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs\n" );cpumask_and (rcu_nocb_mask, cpu_possible_mask, rcu_nocb_mask); }if (cpumask_empty (rcu_nocb_mask)) -pr_info ("\tOffload RCU callbacks from CPUs: (none).\n" ); +pr_info ("\tOffload RCU callbacks from CPUs: (none)\n" );
kernel/rcu/tree_plugin.h void __init rcu_init_nohz(void) · line 2414
Quoted 10 lines
kernel/rcu/tree_plugin.h +2
-2else -pr_info ("\tOffload RCU callbacks from CPUs: %*pbl.\n" , +pr_info ("\tOffload RCU callbacks from CPUs: %*pbl\n" ,cpumask_pr_args (rcu_nocb_mask));if (rcu_nocb_poll) -pr_info ("\tPoll for callbacks from no-CBs CPUs.\n" ); +pr_info ("\tPoll for callbacks from no-CBs CPUs\n" );for_each_rcu_flavor (rsp) {for_each_cpu (cpu, rcu_nocb_mask)
Other than that, I kept the periods.
Quoted 38 lines
kernel/rcu/update.c +8
-5@@ -30,6 +30,9 @@* http://lse.sourceforge.net/locking/rcupdate.html * */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -844,9 +847,10 @@ static void __init rcu_tasks_bootup_oddness(void) {#ifdef CONFIG_TASKS_RCU if (rcu_task_stall_timeout !=RCU_TASK_STALL_TIMEOUT ) -pr_info ("\tTasks-RCU CPU stall warnings timeout set to %d (rcu_task_stall_timeout).\n" , rcu_task_stall_timeout); +pr_info ("\tTasks-RCU CPU stall warnings timeout set to %d (rcu_task_stall_timeout)\n" , + rcu_task_stall_timeout);else -pr_info ("\tTasks RCU enabled.\n" ); +pr_info ("\tTasks RCU enabled\n" );#endif /* #ifdef CONFIG_TASKS_RCU */ }@@ -945,15 +949,16 @@ void rcu_early_boot_tests(void) {}void __init rcupdate_announce_bootup_oddness (void ) {if (rcu_normal) -pr_info ("\tNo expedited grace period (rcu_normal).\n" ); +pr_info ("\tNo expedited grace period (rcu_normal)\n" );else if (rcu_normal_after_boot) -pr_info ("\tNo expedited grace period (rcu_normal_after_boot).\n" ); +pr_info ("\tNo expedited grace period (rcu_normal_after_boot)\n" );else if (rcu_expedited) -pr_info ("\tAll grace periods are expedited (rcu_expedited).\n" );
kernel/rcu/update.c void rcu_early_boot_tests(void) {} · line 963
Quoted 10 lines
kernel/rcu/update.c +4
-2+pr_info ("\tAll grace periods are expedited (rcu_expedited)\n" );if (rcu_cpu_stall_suppress) -pr_info ("\tRCU CPU stall warnings suppressed (rcu_cpu_stall_suppress).\n" ); +pr_info ("\tRCU CPU stall warnings suppressed (rcu_cpu_stall_suppress)\n" );if (rcu_cpu_stall_timeout !=CONFIG_RCU_CPU_STALL_TIMEOUT ) -pr_info ("\tRCU CPU stall warnings timeout set to %d (rcu_cpu_stall_timeout).\n" , rcu_cpu_stall_timeout); +pr_info ("\tRCU CPU stall warnings timeout set to %d (rcu_cpu_stall_timeout)\n" , + rcu_cpu_stall_timeout);rcu_tasks_bootup_oddness (); }
And I kept these periods. Please see below for updated patch.
Thanx, Paul
------------------------------------------------------------------------
commit 7b88a0fd75ae1f4a018a315d1e9ffcdbfc6c8e6f
Author: Joe Perches <[email protected]> Date: Mon May 14 13:27:33 2018 -0700
rcu: Use pr_fmt to prefix "rcu: " to logging output
This commit also adjusts some whitespace while in the area.
kernel/rcu/rcuperf.c +3 -4
@@ -663,12 +663,11 @@ rcu_perf_init(void)break ; }if (i ==ARRAY_SIZE (perf_ops)) { -pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , - perf_type); +pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , perf_type);pr_alert ("rcu-perf types:" );for (i =0 ; i <ARRAY_SIZE (perf_ops); i++) -pr_alert (" %s" , perf_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , perf_ops[i]->name); +pr_cont ("\n" ); firsterr = -EINVAL ; goto unwind; }
kernel/rcu/rcutorture.c +2 -2
@@ -1744,8 +1744,8 @@ rcu_torture_init(void) torture_type);pr_alert ("rcu-torture types:" );for (i =0 ; i <ARRAY_SIZE (torture_ops); i++) -pr_alert (" %s" , torture_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , torture_ops[i]->name); +pr_cont ("\n" ); firsterr = -EINVAL ; goto unwind; }
kernel/rcu/srcutree.c +4 -1
@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/export.h> #include <linux/mutex.h> #include <linux/percpu.h>
@@ -390,7 +392,8 @@ void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced) }if (WARN_ON (rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)) !=SRCU_STATE_IDLE ) ||WARN_ON (srcu_readers_active (sp))) { -pr_info ("%s: Active srcu_struct %p state: %d\n" , __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq))); +pr_info ("%s: Active srcu_struct %p state: %d\n" , + __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)));return ;/* Caller forgot to stop doing call_srcu()? */ }free_percpu (sp->sda);
kernel/rcu/tree.c +5 -3
@@ -27,6 +27,9 @@* For detailed explanation of Read-Copy Update mechanism see - * Documentation/RCU */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -1352,8 +1355,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gp_seq)* See Documentation/RCU/stallwarn.txt for info on how to debug * RCU CPU stall warnings. */ -pr_err ("INFO: %s detected stalls on CPUs/tasks:" , - rsp->name); +pr_err ("INFO: %s detected stalls on CPUs/tasks:" , rsp->name);print_cpu_stall_info_begin ();rcu_for_each_leaf_node (rsp, rnp) {raw_spin_lock_irqsave_rcu_node (rnp, flags);
@@ -3996,7 +3998,7 @@ static void __init rcu_init_geometry(void)if (rcu_fanout_leaf ==RCU_FANOUT_LEAF && nr_cpu_ids ==NR_CPUS )return ; -pr_info ("RCU: Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , +pr_info ("Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , rcu_fanout_leaf, nr_cpu_ids);/*
kernel/rcu/tree_plugin.h +8 -5
@@ -74,8 +74,8 @@ static void __init rcu_bootup_announce_oddness(void)pr_info ("\tRCU event tracing is enabled.\n" );if ((IS_ENABLED (CONFIG_64BIT ) &&RCU_FANOUT !=64 ) || (!IS_ENABLED (CONFIG_64BIT ) &&RCU_FANOUT !=32 )) -pr_info ("\tCONFIG_RCU_FANOUT set to non-default value of %d\n" , -RCU_FANOUT ); +pr_info ("\tCONFIG_RCU_FANOUT set to non-default value of %d.\n" , +RCU_FANOUT );if (rcu_fanout_exact)pr_info ("\tHierarchical RCU autobalancing is disabled.\n" );if (IS_ENABLED (CONFIG_RCU_FAST_NO_HZ ))
@@ -88,11 +88,14 @@ static void __init rcu_bootup_announce_oddness(void)pr_info ("\tBuild-time adjustment of leaf fanout to %d.\n" ,RCU_FANOUT_LEAF );if (rcu_fanout_leaf !=RCU_FANOUT_LEAF ) -pr_info ("\tBoot-time adjustment of leaf fanout to %d.\n" , rcu_fanout_leaf); +pr_info ("\tBoot-time adjustment of leaf fanout to %d.\n" , + rcu_fanout_leaf);if (nr_cpu_ids !=NR_CPUS ) -pr_info ("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%u.\n" ,NR_CPUS , nr_cpu_ids); +pr_info ("\tRCU restricting CPUs from %s=%d to %s=%u.\n" , +"NR_CPUS" ,NR_CPUS ,"nr_cpu_ids" , nr_cpu_ids);#ifdef CONFIG_RCU_BOOST -pr_info ("\tRCU priority boosting: priority %d delay %d ms.\n" , kthread_prio,CONFIG_RCU_BOOST_DELAY ); +pr_info ("\tRCU priority boosting: priority %d delay %d ms.\n" , + kthread_prio,CONFIG_RCU_BOOST_DELAY );#endif if (blimit !=DEFAULT_RCU_BLIMIT )pr_info ("\tBoot-time adjustment of callback invocation limit to %ld.\n" , blimit);
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 7 lines · Paul E. McKenney
On Thu, May 10, 2018 at 08:45:44AM -0700, Joe Perches wrote:
And I took this (but kept the period), plus used "%s" to make it fit in 80 characters:
pr_info("\tRCU restricting CPUs from %s=%d to %s=%u.\n",
"NR_CPUS",NR_CPUS, "nr_cpu_ids",nr_cpu_ids);
Why do care about 80 characters for string literals? (Checkpatch dropped this limit long time ago after some discussions) I think it's better to find line if more context given (this my objection agains %s for string literals).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
In reply to Paul E. McKenneyQuoted 50 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>I took parts of this (thank you!) but have concerns about other parts.
Quoted 43 lines
--- kernel/rcu/rcu_segcblist.c | 2 ++ kernel/rcu/rcuperf.c | 10 ++++--- kernel/rcu/rcutorture.c | 46 +++++++++++++++---------------- kernel/rcu/srcutiny.c | 2 ++ kernel/rcu/srcutree.c | 5 +++- kernel/rcu/tiny.c | 3 +++ kernel/rcu/tree.c | 8 +++--- kernel/rcu/tree_plugin.h | 67 +++++++++++++++++++++++++++------------------- kernel/rcu/update.c | 19 ++++++++----- 9 files changed, 96 insertions(+), 66 deletions(-)kernel/rcu/rcutorture.c +4
-3@@ -22,6 +22,7 @@* * See also: Documentation/RCU/torture.txt */ +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);/* Initialize synctype[] array. If none set, take default. */ @@ -916,27 +917,27 @@ rcu_torture_writer(void *arg) gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true;if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) { synctype[nsynctypes++] =RTWS_COND_GET ; -pr_info ("%s: Testing conditional GPs.\n" , __func__); +pr_info ("%s: Testing conditional GPs\n" , __func__); }else if (gp_cond && (!cur_ops->get_state || !cur_ops->cond_sync)) { -pr_alert ("%s: gp_cond without primitives.\n" , __func__); +pr_alert ("%s: gp_cond without primitives\n" , __func__);
Quoted 8 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 928
Quoted 8 lines
kernel/rcu/rcutorture.c +2
-2}if (gp_exp1 && cur_ops->exp_sync) { synctype[nsynctypes++] =RTWS_EXP_SYNC ; -pr_info ("%s: Testing expedited GPs.\n" , __func__); +pr_info ("%s: Testing expedited GPs\n" , __func__); }else if (gp_exp && !cur_ops->exp_sync) { -pr_alert ("%s: gp_exp without primitives.\n" , __func__); +pr_alert ("%s: gp_exp without primitives\n" , __func__);
Unlike some of the others, the one above is not a sentence, so it doesn't _need_ a period ... except for consistency.
But I don't care either way. :)
Quoted 16 lines
Quoted 16 lines
kernel/rcu/rcutorture.c +4
-4}if (gp_normal1 && cur_ops->deferred_free) { synctype[nsynctypes++] =RTWS_DEF_FREE ; -pr_info ("%s: Testing asynchronous GPs.\n" , __func__); +pr_info ("%s: Testing asynchronous GPs\n" , __func__); }else if (gp_normal && !cur_ops->deferred_free) { -pr_alert ("%s: gp_normal without primitives.\n" , __func__); +pr_alert ("%s: gp_normal without primitives\n" , __func__); }if (gp_sync1 && cur_ops->sync) { synctype[nsynctypes++] =RTWS_SYNC ; -pr_info ("%s: Testing normal GPs.\n" , __func__); +pr_info ("%s: Testing normal GPs\n" , __func__); }else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);
Signature · 1 line
~Randy
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 63 lines · Randy Dunlap
Quoted 50 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>I took parts of this (thank you!) but have concerns about other parts.
Quoted 43 lines
--- kernel/rcu/rcu_segcblist.c | 2 ++ kernel/rcu/rcuperf.c | 10 ++++--- kernel/rcu/rcutorture.c | 46 +++++++++++++++---------------- kernel/rcu/srcutiny.c | 2 ++ kernel/rcu/srcutree.c | 5 +++- kernel/rcu/tiny.c | 3 +++ kernel/rcu/tree.c | 8 +++--- kernel/rcu/tree_plugin.h | 67 +++++++++++++++++++++++++++------------------- kernel/rcu/update.c | 19 ++++++++----- 9 files changed, 96 insertions(+), 66 deletions(-)kernel/rcu/rcutorture.c +4
-3@@ -22,6 +22,7 @@* * See also: Documentation/RCU/torture.txt */ +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);/* Initialize synctype[] array. If none set, take default. */ @@ -916,27 +917,27 @@ rcu_torture_writer(void *arg) gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true;if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) { synctype[nsynctypes++] =RTWS_COND_GET ; -pr_info ("%s: Testing conditional GPs.\n" , __func__); +pr_info ("%s: Testing conditional GPs\n" , __func__); }else if (gp_cond && (!cur_ops->get_state || !cur_ops->cond_sync)) { -pr_alert ("%s: gp_cond without primitives.\n" , __func__); +pr_alert ("%s: gp_cond without primitives\n" , __func__);Quoted 8 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 928
Quoted 8 lines
kernel/rcu/rcutorture.c +2
-2}if (gp_exp1 && cur_ops->exp_sync) { synctype[nsynctypes++] =RTWS_EXP_SYNC ; -pr_info ("%s: Testing expedited GPs.\n" , __func__); +pr_info ("%s: Testing expedited GPs\n" , __func__); }else if (gp_exp && !cur_ops->exp_sync) { -pr_alert ("%s: gp_exp without primitives.\n" , __func__); +pr_alert ("%s: gp_exp without primitives\n" , __func__);Unlike some of the others, the one above is not a sentence, so it doesn't _need_ a period ... except for consistency.
Quoted 1 line
But I don't care either way. :)
;-) ;-) ;-)
Thanx, Paul
Quoted 27 lines
Quoted 16 lines
Quoted 16 lines
kernel/rcu/rcutorture.c +4
-4}if (gp_normal1 && cur_ops->deferred_free) { synctype[nsynctypes++] =RTWS_DEF_FREE ; -pr_info ("%s: Testing asynchronous GPs.\n" , __func__); +pr_info ("%s: Testing asynchronous GPs\n" , __func__); }else if (gp_normal && !cur_ops->deferred_free) { -pr_alert ("%s: gp_normal without primitives.\n" , __func__); +pr_alert ("%s: gp_normal without primitives\n" , __func__); }if (gp_sync1 && cur_ops->sync) { synctype[nsynctypes++] =RTWS_SYNC ; -pr_info ("%s: Testing normal GPs.\n" , __func__); +pr_info ("%s: Testing normal GPs\n" , __func__); }else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);Signature · 1 line
~Randy
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
In reply to Andy ShevchenkoQuoted 7 lines · Andy Shevchenko
Quoted 5 lines · Paul E. McKenney
On Thu, May 10, 2018 at 08:45:44AM -0700, Joe Perches wrote:
And I took this (but kept the period), plus used "%s" to make it fit in 80 characters:
Quoted 7 lines
Quoted 2 lines
pr_info("\tRCU restricting CPUs from %s=%d to %s=%u.\n",
"NR_CPUS",NR_CPUS, "nr_cpu_ids",nr_cpu_ids);Why do care about 80 characters for string literals? (Checkpatch dropped this limit long time ago after some discussions) I think it's better to find line if more context given (this my objection agains %s for string literals).
Good point! I am reverting that portion of the commit with attribution, thank you!
Thanx, Paul
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
In reply to Paul E. McKenneyQuoted 6 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>I took parts of this (thank you!) but have concerns about other parts.
[]
Quoted 6 lines
Quoted 6 lines
kernel/rcu/rcuperf.c +0
-0@@ -19,6 +19,9 @@*
Quoted 8 lines
kernel/rcu/rcuperf.c line 23
Quoted 4 lines
kernel/rcu/rcuperf.c +2
-0* Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) "rcu: " fmtThis is going to get us messages of the form "rcu: rcu-perf:", not? (And other odd combinations, depending on the flavor of RCU under test.) If so, this does not seem to be an improvement.
That depends on the existing embedded content of the format. This will prefix just "rcu: " to pr_<level> output.
Quoted 1 line
kernel/rcu/rcutorture.c
Quoted 1 line
kernel/rcu/rcutorture.c +0
-0
[]
Quoted 7 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 913
Quoted 7 lines
kernel/rcu/rcutorture.c +1
-1@@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);
As there is _no_ pr_fmt #defined in this file, output will/could be prefixed with KBUILD_MODNAME ": " (in this case "rcutorture: ") if/when the generic pr_fmt conversion patch is applied.
Quoted 5 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 915
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1}else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);I used a CDC Cyber 73 in the 1970s.
Fancy. I used a CDC 6400 and an IBM 1620, but
those were pretty old when I started.
Quoted 4 lines
It had tiny memory by today's
standards, but even it had periods in its error messages. We can easily afford them today, especially given that rcutorture is not included in small-memory Linux configurations.
OK, but I like consistency too.
~90 percent of linux logging does not use terminating periods. For instance, on my laptop:
$ uptime -p up 1 week, 1 day, 13 hours, 37 minute $ dmesg | wc -l 4240 $ dmesg | grep -P "\w\.$"| wc -l 381
Quoted 9 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1715
Quoted 6 lines
kernel/rcu/rcutorture.c +1
-1@@ -1711,11 +1712,11 @@ static void rcu_test_debug_objects(void)/* Wait for them all to get done so we can safely return. */ rcu_barrier (); -pr_alert ("%s: WARN: Duplicate call_rcu() test complete.\n" ,KBUILD_MODNAME ); +pr_alert ("WARN: Duplicate call_rcu() test complete\n" );I would like to keep these, as they mark the region of console output where splats are expected.
The prefixes are still there...
Quoted 5 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1717
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1if (cur_ops->fqs ==NULL && fqs_duration !=0 ) { -pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); +pr_alert ("->fqs NULL and non-zero fqs_duration, fqs disabled\n" );This I would like to keep. Easier to find.
One thing that you could use to validate the
output string format is after compilation:
$ strings kernel/rcu/rcutorture.o | grep -P "^[0-6]\w+:"
With your change, you will see duplicated prefixes.
cheers, Joe
Quoted 1 line
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 23 lines · Joe Perches
Quoted 6 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>I took parts of this (thank you!) but have concerns about other parts.
[]
Quoted 6 lines
Quoted 6 lines
kernel/rcu/rcuperf.c +0
-0@@ -19,6 +19,9 @@* Quoted 8 lines
kernel/rcu/rcuperf.c line 23
Quoted 4 lines
kernel/rcu/rcuperf.c +2
-0* Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) "rcu: " fmtThis is going to get us messages of the form "rcu: rcu-perf:", not? (And other odd combinations, depending on the flavor of RCU under test.) If so, this does not seem to be an improvement.
Quoted 2 lines
That depends on the existing embedded content of the format. This will prefix just "rcu: " to pr_<level> output.
OK, so to make this work, I need to create special-purpose pr_fmt() definitions for torture, rcutorture, locktorture, and rcuperf. Most of the rest don't care.
Or am I missing something basic here?
Quoted 14 lines
Quoted 1 line
kernel/rcu/rcutorture.c
Quoted 1 line
kernel/rcu/rcutorture.c +0
-0[]
Quoted 7 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 913
Quoted 7 lines
kernel/rcu/rcutorture.c +1
-1@@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);As there is _no_
pr_fmt#defined in this file, output will/could be prefixed withKBUILD_MODNAME": " (in this case "rcutorture: ") if/when the genericpr_fmtconversion patch is applied.
Not a fan, NACK.
Quoted 8 lines
Quoted 5 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 915
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1}else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);I used a CDC Cyber 73 in the 1970s.
Fancy. I used a CDC 6400 and an IBM 1620, but
those were pretty old when I started.
;-)
Quoted 10 lines
Quoted 4 lines
It had tiny memory by today's
standards, but even it had periods in its error messages. We can easily afford them today, especially given that rcutorture is not included in small-memory Linux configurations.OK, but I like consistency too.
~90 percent of linux logging does not use terminating periods. For instance, on my laptop:
Quoted 6 lines
$ uptime -p up 1 week, 1 day, 13 hours, 37 minute $ dmesg | wc -l 4240 $ dmesg | grep -P "\w\.$"| wc -l 381
Why is this a problem worth fixing? From where I sit, it is not.
Even assuming that this is somehow worth solving, why is it buried in an unrelated patch?
Quoted 18 lines
Quoted 9 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1715
Quoted 6 lines
kernel/rcu/rcutorture.c +1
-1@@ -1711,11 +1712,11 @@ static void rcu_test_debug_objects(void)/* Wait for them all to get done so we can safely return. */ rcu_barrier (); -pr_alert ("%s: WARN: Duplicate call_rcu() test complete.\n" ,KBUILD_MODNAME ); +pr_alert ("WARN: Duplicate call_rcu() test complete\n" );I would like to keep these, as they mark the region of console output where splats are expected.
The prefixes are still there...
Quoted 5 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1717
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1if (cur_ops->fqs ==NULL && fqs_duration !=0 ) { -pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); +pr_alert ("->fqs NULL and non-zero fqs_duration, fqs disabled\n" );This I would like to keep. Easier to find.
Quoted 6 lines
One thing that you could use to validate the
output string format is after compilation:$ strings kernel/rcu/rcutorture.o | grep -P "^[0-6]\w+:"With your change, you will see duplicated prefixes.
Except that right now there are not duplicated prefixes. Those apparently only show up after some earlier patch in/before your set is applied, correct? Plus with your change, I apparently get quite a few semi-duplicated prefixes, which I would rather avoid, as it would add pointless thrash to my rcutorture scripting.
Is there some C-preprocessor macro indicating whether or not your changes have been applied?
Thanx, Paul
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 25 lines · Paul E. McKenney
Quoted 24 lines · Joe Perches
Quoted 6 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>I took parts of this (thank you!) but have concerns about other parts.
[]
Quoted 14 lines
kernel/rcu/rcuperf.c line 23
Quoted 10 lines
kernel/rcu/rcuperf.c +2
-0@@ -19,6 +19,9 @@* * Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) "rcu: " fmtThis is going to get us messages of the form "rcu: rcu-perf:", not? (And other odd combinations, depending on the flavor of RCU under test.) If so, this does not seem to be an improvement.
Quoted 6 lines
Quoted 2 lines
That depends on the existing embedded content of the format. This will prefix just "rcu: " to pr_<level> output.
OK, so to make this work, I need to create special-purpose
pr_fmt()definitions for torture, rcutorture, locktorture, and rcuperf. Most of the rest don't care.
Yes, or allow the new generic #define for pr_fmt to set those prefixes for you
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
will do the appropriate thing for rcutorture,
Quoted 41 lines
Or am I missing something basic here?
Quoted 15 lines
Quoted 1 line
kernel/rcu/rcutorture.c
Quoted 1 line
kernel/rcu/rcutorture.c +0
-0[]
Quoted 7 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 913
Quoted 7 lines
kernel/rcu/rcutorture.c +1
-1@@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);As there is _no_
pr_fmt#defined in this file, output will/could be prefixed withKBUILD_MODNAME": " (in this case "rcutorture: ") if/when the genericpr_fmtconversion patch is applied.Not a fan, NACK.
Quoted 8 lines
Quoted 5 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 915
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1}else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);I used a CDC Cyber 73 in the 1970s.
Fancy. I used a CDC 6400 and an IBM 1620, but
those were pretty old when I started.;-)
Quoted 10 lines
Quoted 4 lines
It had tiny memory by today's
standards, but even it had periods in its error messages. We can easily afford them today, especially given that rcutorture is not included in small-memory Linux configurations.OK, but I like consistency too.
~90 percent of linux logging does not use terminating periods. For instance, on my laptop:
Quoted 8 lines
Quoted 6 lines
$ uptime -p up 1 week, 1 day, 13 hours, 37 minute $ dmesg | wc -l 4240 $ dmesg | grep -P "\w\.$"| wc -l 381Why is this a problem worth fixing? From where I sit, it is not.
It's not a _problem_. It's just an inconsistency. I modify them passively when I see them. If you don't like it, don't take it.
Quoted 2 lines
Even assuming that this is somehow worth solving, why is it buried in an unrelated patch?
Touches each line fewer times.
Quoted 21 lines
Quoted 21 lines
Quoted 9 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1715
Quoted 6 lines
kernel/rcu/rcutorture.c +1
-1@@ -1711,11 +1712,11 @@ static void rcu_test_debug_objects(void)/* Wait for them all to get done so we can safely return. */ rcu_barrier (); -pr_alert ("%s: WARN: Duplicate call_rcu() test complete.\n" ,KBUILD_MODNAME ); +pr_alert ("WARN: Duplicate call_rcu() test complete\n" );I would like to keep these, as they mark the region of console output where splats are expected.
The prefixes are still there...
Quoted 5 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1717
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1if (cur_ops->fqs ==NULL && fqs_duration !=0 ) { -pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); +pr_alert ("->fqs NULL and non-zero fqs_duration, fqs disabled\n" );This I would like to keep. Easier to find.
One thing that you could use to validate the
output string format is after compilation:
Quoted 7 lines
Quoted 3 lines
$ strings kernel/rcu/rcutorture.o | grep -P "^[0-6]\w+:"With your change, you will see duplicated prefixes.
Except that right now there are not duplicated prefixes. Those apparently only show up after some earlier patch in/before your set is applied, correct?
yes.
[PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 2 lines
Is there some C-preprocessor macro indicating whether or not your changes have been applied?
? pr_fmt would either be blank or something else.
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 33 lines · Joe Perches
Quoted 25 lines · Paul E. McKenney
Quoted 24 lines · Joe Perches
Quoted 6 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Use a consistent logging prefix for all rcu related output.
Signed-off-by Joe Perches <[email protected]>I took parts of this (thank you!) but have concerns about other parts.
[]
Quoted 14 lines
kernel/rcu/rcuperf.c line 23
Quoted 10 lines
kernel/rcu/rcuperf.c +2
-0@@ -19,6 +19,9 @@* * Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) "rcu: " fmtThis is going to get us messages of the form "rcu: rcu-perf:", not? (And other odd combinations, depending on the flavor of RCU under test.) If so, this does not seem to be an improvement.
Quoted 6 lines
Quoted 2 lines
That depends on the existing embedded content of the format. This will prefix just "rcu: " to pr_<level> output.
OK, so to make this work, I need to create special-purpose
pr_fmt()definitions for torture, rcutorture, locktorture, and rcuperf. Most of the rest don't care.
Quoted 6 lines
Yes, or allow the new generic #define for
pr_fmtto set those prefixes for you#define
pr_fmt(fmt)KBUILD_MODNAME": " fmtwill do the appropriate thing for rcutorture,
OK. For rcutorture, there are special prefixes. More on this at the end.
Quoted 48 lines
Quoted 48 lines
Or am I missing something basic here?
Quoted 15 lines
Quoted 1 line
kernel/rcu/rcutorture.c
Quoted 1 line
kernel/rcu/rcutorture.c +0
-0[]
Quoted 7 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 913
Quoted 7 lines
kernel/rcu/rcutorture.c +1
-1@@ -908,7 +909,7 @@ rcu_torture_writer(void *arg)VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" );if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s.\n" , +" GP expediting controlled from boot/sysfs for %s\n" , torture_type, cur_ops->name);As there is _no_
pr_fmt#defined in this file, output will/could be prefixed withKBUILD_MODNAME": " (in this case "rcutorture: ") if/when the genericpr_fmtconversion patch is applied.Not a fan, NACK.
Quoted 8 lines
Quoted 5 lines
kernel/rcu/rcutorture.c rcu_torture_writer(void *arg) · line 915
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1}else if (gp_sync && !cur_ops->sync) { -pr_alert ("%s: gp_sync without primitives.\n" , __func__); +pr_alert ("%s: gp_sync without primitives\n" , __func__);I used a CDC Cyber 73 in the 1970s.
Fancy. I used a CDC 6400 and an IBM 1620, but
those were pretty old when I started.;-)
Quoted 16 lines
Quoted 4 lines
It had tiny memory by today's
standards, but even it had periods in its error messages. We can easily afford them today, especially given that rcutorture is not included in small-memory Linux configurations.OK, but I like consistency too.
~90 percent of linux logging does not use terminating periods. For instance, on my laptop:
$ uptime -p up 1 week, 1 day, 13 hours, 37 minute $ dmesg | wc -l 4240 $ dmesg | grep -P "\w\.$"| wc -l 381
Quoted 5 lines
Quoted 1 line
Why is this a problem worth fixing? From where I sit, it is not.
It's not a _problem_. It's just an inconsistency. I modify them passively when I see them. If you don't like it, don't take it.
OK, fair enough. I will pass.
Quoted 34 lines
Quoted 2 lines
Even assuming that this is somehow worth solving, why is it buried in an unrelated patch?
Touches each line fewer times.
Quoted 21 lines
Quoted 21 lines
Quoted 9 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1715
Quoted 6 lines
kernel/rcu/rcutorture.c +1
-1@@ -1711,11 +1712,11 @@ static void rcu_test_debug_objects(void)/* Wait for them all to get done so we can safely return. */ rcu_barrier (); -pr_alert ("%s: WARN: Duplicate call_rcu() test complete.\n" ,KBUILD_MODNAME ); +pr_alert ("WARN: Duplicate call_rcu() test complete\n" );I would like to keep these, as they mark the region of console output where splats are expected.
The prefixes are still there...
Quoted 5 lines
kernel/rcu/rcutorture.c static void rcu_test_debug_objects(void) · line 1717
Quoted 3 lines
kernel/rcu/rcutorture.c +1
-1if (cur_ops->fqs ==NULL && fqs_duration !=0 ) { -pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); +pr_alert ("->fqs NULL and non-zero fqs_duration, fqs disabled\n" );This I would like to keep. Easier to find.
One thing that you could use to validate the
output string format is after compilation:Quoted 7 lines
Quoted 3 lines
$ strings kernel/rcu/rcutorture.o | grep -P "^[0-6]\w+:"With your change, you will see duplicated prefixes.
Except that right now there are not duplicated prefixes. Those apparently only show up after some earlier patch in/before your set is applied, correct?
Quoted 7 lines
yes.
[PATCH 03/18] printk: Convertpr_fmtfrom blank define toKBUILD_MODNAMEQuoted 2 lines
Is there some C-preprocessor macro indicating whether or not your changes have been applied?
?
pr_fmtwould either be blank or something else.
OK, so if I define pr_fmt as follows, I get the old behavior?
#define pr_fmt(fmt) fmt
If so, I can add this to the torture files, and then define pr_fmt more sensibly for the torture files once your changes hit mainline.
Or if we can agree on the defintion, perhaps we get the sensible definition into your patch series. But I would much prefer the former given the high rate of change in RCU at the moment.
Note that my concerns apply only to kernel/torture.c, kernel/rcu/rcuperf.c, kernel/rcu/rcutorture.c, and kernel/locking/locktorture.c (despite my earlier ack). The other RCU files, including kernel/rcu/rcu_segcblist.c, should be just fine with "#define pr_fmt()" added. And I just queued a commit to be squashed into my version of your patch 18/18 that adds this to kernel/rcu/rcu_segcblist.c. This joins the ones that your patch added to kernel/rcu/srcutree.c and kernel/rcu/tree.c.
Should I also add "#define pr_fmt(fmt) "rcu: " fmt" to these files?
kernel/rcu/srcutiny.ckernel/rcu/sync.ckernel/rcu/tiny.c
Thanx, Paul
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 3 lines · Paul E. McKenney
OK, so if I define
pr_fmtas follows, I get the old behavior?#define pr_fmt(fmt) fmt
yes.
Quoted 10 lines
I just queued
a commit to be squashed into my version of your patch 18/18 that adds this tokernel/rcu/rcu_segcblist.c. This joins the ones that your patch added tokernel/rcu/srcutree.candkernel/rcu/tree.c.Should I also add "#define
pr_fmt(fmt)"rcu: " fmt" to these files?
kernel/rcu/srcutiny.ckernel/rcu/sync.ckernel/rcu/tiny.c
Well, I don't actually remember why the define was added to rcu_segcblist.c.
Most of this was done via a script which looked for pr_<level> uses without a pr_fmt in the same file.
Dunno why rcu_segcblist was modified. Maybe it was a braino.
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 6 lines · Joe Perches
Quoted 3 lines · Paul E. McKenney
OK, so if I define
pr_fmtas follows, I get the old behavior?#define pr_fmt(fmt) fmtyes.
OK, then I will queue patches with this for the near term for the various torture files.
Quoted 14 lines
Quoted 10 lines
I just queued
a commit to be squashed into my version of your patch 18/18 that adds this tokernel/rcu/rcu_segcblist.c. This joins the ones that your patch added tokernel/rcu/srcutree.candkernel/rcu/tree.c.Should I also add "#define
pr_fmt(fmt)"rcu: " fmt" to these files?
kernel/rcu/srcutiny.ckernel/rcu/sync.ckernel/rcu/tiny.cWell, I don't actually remember why the define was added to
rcu_segcblist.c.
Quoted 6 lines
Most of this was done via a script which looked for pr_<level> uses without a
pr_fmtin the same file.Dunno why
rcu_segcblistwas modified. Maybe it was a braino.
So this change does not affect WARN_ON_ONCE() and friends? (That was my guess.) If not, I will revert my squash patch.
And it could also be that the files changed between your running the script and sending the patch.
Thanx, Paul
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 1 line · Paul E. McKenney
So this change does not affect
WARN_ON_ONCE()and friends?
Changing define pr_fmt does not modify WARN_ON output.
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 4 lines · Joe Perches
Quoted 1 line · Paul E. McKenney
So this change does not affect
WARN_ON_ONCE()and friends?Changing define
pr_fmtdoes not modifyWARN_ONoutput.
Very good, I removed my --squash patch adding pr_fmt() to the file kernel/rcu/rcu_segcblist.c.
Thanx, Paul
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
In reply to Paul E. McKenneyQuoted 10 lines · Paul E. McKenney
Quoted 6 lines · Joe Perches
Quoted 3 lines · Paul E. McKenney
OK, so if I define
pr_fmtas follows, I get the old behavior?#define pr_fmt(fmt) fmtyes.
OK, then I will queue patches with this for the near term for the various torture files.
And here is the patch. Thoughts?
Thanx, Paul
------------------------------------------------------------------------
commit de94f0b65dd4dcb7e651e2d85df9d9bc86b5bf23
Author: Paul E. McKenney <[email protected]> Date: Tue May 15 12:25:05 2018 -0700
torture: Keep old-school dmesg format
This commit adds "#define pr_fmt(fmt) fmt" to the torture-test files in order to keep the current dmesg format. Once Joe's commits have hit mainline, these definitions will be changed in order to automatically generate the dmesg line prefix that the scripts expect. This will have the beneficial side-effect of allowing printk() formats to be used more widely and of shortening some pr_*() lines.
kernel/locking/locktorture.c +3 -0
@@ -21,6 +21,9 @@* Davidlohr Bueso <[email protected]> * Based on kernel/rcu/torture.c. */ + +#define pr_fmt (fmt) fmt +#include <linux/kernel.h> #include <linux/module.h> #include <linux/kthread.h>
kernel/rcu/rcuperf.c +3 -0
@@ -19,6 +19,9 @@* * Authors: Paul E. McKenney <[email protected]> */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
kernel/rcu/rcutorture.c +3 -0
@@ -22,6 +22,9 @@* * See also: Documentation/RCU/torture.txt */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
kernel/torture.c +3 -0
@@ -20,6 +20,9 @@* Author: Paul E. McKenney <[email protected]> * Based on kernel/rcu/torture.c. */ + +#define pr_fmt (fmt) fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 5 lines · Paul E. McKenney
Quoted 4 lines · Paul E. McKenney
Quoted 3 lines · Joe Perches
Quoted 2 lines · Paul E. McKenney
OK, so if I define
pr_fmtas follows, I get the old behavior?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
#define pr_fmt(fmt) fmtyes.
OK, then I will queue patches with this for the near term for the various torture files.
And here is the patch. Thoughts?
Seems sensible.
Perhaps still do the pr_alert->pr_cont conversions.
cheers, Joe
Re: [PATCH 18/18] rcu: Use pr_fmt to prefix "rcu: " to logging output
Quoted 10 lines · Joe Perches
Quoted 9 lines · Paul E. McKenney
Quoted 8 lines · Paul E. McKenney
Quoted 6 lines · Joe Perches
Quoted 3 lines · Paul E. McKenney
OK, so if I define
pr_fmtas follows, I get the old behavior?#define pr_fmt(fmt) fmtyes.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
OK, then I will queue patches with this for the near term for the various torture files.
And here is the patch. Thoughts?
Seems sensible.
Perhaps still do thepr_alert->pr_contconversions.
Agreed, and I have those queued as shown below. Please let me know if I missed something.
Thanx, Paul
------------------------------------------------------------------------
commit adf02580b79ba77156bf60ccd338d9f49eaf8eb3
Author: Joe Perches <[email protected]> Date: Mon May 14 13:27:33 2018 -0700
rcu: Use pr_fmt to prefix "rcu: " to logging output
This commit also adjusts some whitespace while in the area.
kernel/rcu/rcuperf.c +3 -4
@@ -663,12 +663,11 @@ rcu_perf_init(void)break ; }if (i ==ARRAY_SIZE (perf_ops)) { -pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , - perf_type); +pr_alert ("rcu-perf: invalid perf type: \"%s\"\n" , perf_type);pr_alert ("rcu-perf types:" );for (i =0 ; i <ARRAY_SIZE (perf_ops); i++) -pr_alert (" %s" , perf_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , perf_ops[i]->name); +pr_cont ("\n" ); firsterr = -EINVAL ; goto unwind; }
kernel/rcu/rcutorture.c +2 -2
@@ -1744,8 +1744,8 @@ rcu_torture_init(void) torture_type);pr_alert ("rcu-torture types:" );for (i =0 ; i <ARRAY_SIZE (torture_ops); i++) -pr_alert (" %s" , torture_ops[i]->name); -pr_alert ("\n" ); +pr_cont (" %s" , torture_ops[i]->name); +pr_cont ("\n" ); firsterr = -EINVAL ; goto unwind; }
kernel/rcu/srcutree.c +4 -1
@@ -26,6 +26,8 @@* */ +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/export.h> #include <linux/mutex.h> #include <linux/percpu.h>
@@ -390,7 +392,8 @@ void _cleanup_srcu_struct(struct srcu_struct *sp, bool quiesced) }if (WARN_ON (rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)) !=SRCU_STATE_IDLE ) ||WARN_ON (srcu_readers_active (sp))) { -pr_info ("%s: Active srcu_struct %p state: %d\n" , __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq))); +pr_info ("%s: Active srcu_struct %p state: %d\n" , + __func__, sp,rcu_seq_state (READ_ONCE (sp->srcu_gp_seq)));return ;/* Caller forgot to stop doing call_srcu()? */ }free_percpu (sp->sda);
kernel/rcu/tree.c +5 -3
@@ -27,6 +27,9 @@* For detailed explanation of Read-Copy Update mechanism see - * Documentation/RCU */ + +#define pr_fmt (fmt) "rcu: " fmt +#include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h>
@@ -1352,8 +1355,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp, unsigned long gp_seq)* See Documentation/RCU/stallwarn.txt for info on how to debug * RCU CPU stall warnings. */ -pr_err ("INFO: %s detected stalls on CPUs/tasks:" , - rsp->name); +pr_err ("INFO: %s detected stalls on CPUs/tasks:" , rsp->name);print_cpu_stall_info_begin ();rcu_for_each_leaf_node (rsp, rnp) {raw_spin_lock_irqsave_rcu_node (rnp, flags);
@@ -3996,7 +3998,7 @@ static void __init rcu_init_geometry(void)if (rcu_fanout_leaf ==RCU_FANOUT_LEAF && nr_cpu_ids ==NR_CPUS )return ; -pr_info ("RCU: Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , +pr_info ("Adjusting geometry for rcu_fanout_leaf=%d, nr_cpu_ids=%u\n" , rcu_fanout_leaf, nr_cpu_ids);/*
kernel/rcu/tree_plugin.h +6 -4
@@ -74,8 +74,8 @@ static void __init rcu_bootup_announce_oddness(void)pr_info ("\tRCU event tracing is enabled.\n" );if ((IS_ENABLED (CONFIG_64BIT ) &&RCU_FANOUT !=64 ) || (!IS_ENABLED (CONFIG_64BIT ) &&RCU_FANOUT !=32 )) -pr_info ("\tCONFIG_RCU_FANOUT set to non-default value of %d\n" , -RCU_FANOUT ); +pr_info ("\tCONFIG_RCU_FANOUT set to non-default value of %d.\n" , +RCU_FANOUT );if (rcu_fanout_exact)pr_info ("\tHierarchical RCU autobalancing is disabled.\n" );if (IS_ENABLED (CONFIG_RCU_FAST_NO_HZ ))
@@ -88,11 +88,13 @@ static void __init rcu_bootup_announce_oddness(void)pr_info ("\tBuild-time adjustment of leaf fanout to %d.\n" ,RCU_FANOUT_LEAF );if (rcu_fanout_leaf !=RCU_FANOUT_LEAF ) -pr_info ("\tBoot-time adjustment of leaf fanout to %d.\n" , rcu_fanout_leaf); +pr_info ("\tBoot-time adjustment of leaf fanout to %d.\n" , + rcu_fanout_leaf);if (nr_cpu_ids !=NR_CPUS )pr_info ("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%u.\n" ,NR_CPUS , nr_cpu_ids);#ifdef CONFIG_RCU_BOOST -pr_info ("\tRCU priority boosting: priority %d delay %d ms.\n" , kthread_prio,CONFIG_RCU_BOOST_DELAY ); +pr_info ("\tRCU priority boosting: priority %d delay %d ms.\n" , + kthread_prio,CONFIG_RCU_BOOST_DELAY );#endif if (blimit !=DEFAULT_RCU_BLIMIT )pr_info ("\tBoot-time adjustment of callback invocation limit to %ld.\n" , blimit);
Borislav Petkov
maintainerRe: [tip:x86/cleanups] x86: Remove pr_fmt duplicate logging prefixes
In reply to tip-bot for Joe PerchesQuoted 26 lines · tip-bot for Joe Perches
Commit-ID: 1de392f5d5e803663abbd8ed084233f154152bcd Gitweb: https://git.kernel.org/tip/1de392f5d5e803663abbd8ed084233f154152bcd Author: Joe Perches <[email protected]> AuthorDate: Thu, 10 May 2018 08:45:30 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 13 May 2018 21:25:18 +0200x86: Remove
pr_fmtduplicate logging prefixesConverting
pr_fmtfrom a default simple #define to useKBUILD_MODNAMEadded some duplicate prefixes.Remove the duplicate prefixes.
Signed-off-by Joe Perches <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Cc "H. Peter Anvin" <[email protected]>--- arch/x86/events/amd/ibs.c | 2 +- arch/x86/kernel/e820.c | 32 +++++++++++++++++--------------- arch/x86/kernel/hpet.c | 5 ++--- arch/x86/kernel/uprobes.c | 4 ++-- arch/x86/mm/numa.c | 22 +++++++++++----------- 5 files changed, 33 insertions(+), 32 deletions(-)
...
Quoted 21 lines
arch/x86/kernel/e820.c +3
-3@@ -830,8 +832,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_typeif (last_pfn > max_arch_pfn) last_pfn = max_arch_pfn; -pr_info ("e820: last_pfn = %#lx max_arch_pfn = %#lx\n" , - last_pfn, max_arch_pfn); +pr_info ("last_pfn = %#lx max_arch_pfn = %#lx\n" , + last_pfn, max_arch_pfn);return last_pfn; }@@ -1005,7 +1007,7 @@ void __init e820__finish_early_params(void)if (e820__update_table (e820_table) <0 )early_panic ("Invalid user supplied memory map" ); -pr_info ("e820: user-defined physical RAM map:\n" ); +pr_info ("user-defined physical RAM map:\n" );e820__print_table ("user" ); } }
arch/x86/kernel/e820.c void __init e820__memory_setup(void) · line 1245
Quoted 7 lines
arch/x86/kernel/e820.c +1
-1@@ -1238,7 +1240,7 @@ void __init e820__memory_setup(void)memcpy (e820_table_kexec, e820_table,sizeof (*e820_table_kexec));memcpy (e820_table_firmware, e820_table,sizeof (*e820_table_firmware)); -pr_info ("e820: BIOS-provided physical RAM map:\n" ); +pr_info ("BIOS-provided physical RAM map:\n" );e820__print_table (who); }
Maybe I'm missing something but this dropped the prefixes now completely:
-e820: BIOS-provided physical RAM map:
+BIOS-provided physical RAM map:
-e820: last_pfn = 0x43f000 max_arch_pfn = 0x400000000 +last_pfn = 0x43f000 max_arch_pfn = 0x400000000
-e820: last_pfn = 0x9d000 max_arch_pfn = 0x400000000 +last_pfn = 0x9d000 max_arch_pfn = 0x400000000
...
I don't think that was the intention.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.Re: [tip:x86/cleanups] x86: Remove pr_fmt duplicate logging prefixes
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · tip-bot for Joe Perches
Commit-ID: 1de392f5d5e803663abbd8ed084233f154152bcd Gitweb: https://git.kernel.org/tip/1de392f5d5e803663abbd8ed084233f154152bcd Author: Joe Perches <[email protected]> AuthorDate: Thu, 10 May 2018 08:45:30 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 13 May 2018 21:25:18 +0200
Quoted 6 lines
Quoted 6 lines
x86: Remove
pr_fmtduplicate logging prefixesConverting
pr_fmtfrom a default simple #define to useKBUILD_MODNAMEadded some duplicate prefixes.Remove the duplicate prefixes.
[]
Quoted 14 lines
Maybe I'm missing something but this dropped the prefixes now completely:
(quoted diff) +3
-3-e820: BIOS-provided physical RAM map: +BIOS-provided physical RAM map: -e820: last_pfn = 0x43f000 max_arch_pfn = 0x400000000 +last_pfn = 0x43f000 max_arch_pfn = 0x400000000 -e820: last_pfn = 0x9d000 max_arch_pfn = 0x400000000 +last_pfn = 0x9d000 max_arch_pfn = 0x400000000
Quoted 1 line
I don't think that was the intention.
Hi Borislav
It wasn't and isn't the intention.
This is a patch _series_, and all of the patches from 4-18 depend on patch 3 which converts the generic define in include/linux/printk.h
from
#define pr_fmt(fmt) fmt to #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Perhaps a better option, which could be done in a v2 of the series, is to add a temporary #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt to each file modified in patches 4-18 and then allow the follow-on script described in the 0/18 cover letter to remove those #defines
cheers, Joe
Re: [tip:x86/cleanups] x86: Remove pr_fmt duplicate logging prefixes
Quoted 45 lines · Joe Perches
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · tip-bot for Joe Perches
Commit-ID: 1de392f5d5e803663abbd8ed084233f154152bcd Gitweb: https://git.kernel.org/tip/1de392f5d5e803663abbd8ed084233f154152bcd Author: Joe Perches <[email protected]> AuthorDate: Thu, 10 May 2018 08:45:30 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 13 May 2018 21:25:18 +0200Quoted 6 lines
Quoted 6 lines
x86: Remove
pr_fmtduplicate logging prefixesConverting
pr_fmtfrom a default simple #define to useKBUILD_MODNAMEadded some duplicate prefixes.Remove the duplicate prefixes.
[]
Quoted 14 lines
Maybe I'm missing something but this dropped the prefixes now completely:
(quoted diff) +3
-3-e820: BIOS-provided physical RAM map: +BIOS-provided physical RAM map: -e820: last_pfn = 0x43f000 max_arch_pfn = 0x400000000 +last_pfn = 0x43f000 max_arch_pfn = 0x400000000 -e820: last_pfn = 0x9d000 max_arch_pfn = 0x400000000 +last_pfn = 0x9d000 max_arch_pfn = 0x400000000Quoted 1 line
I don't think that was the intention.
Hi Borislav
It wasn't and isn't the intention.
This is a patch _series_, and all of the patches from 4-18 depend on patch 3 which converts the generic define in
include/linux/printk.hfrom
#define pr_fmt(fmt) fmt to #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Quoted 6 lines
Perhaps a better option, which could be done in a v2 of the series, is to add a temporary #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt to each file modified in patches 4-18 and then allow the follow-on script described in the 0/18 cover letter to remove those #defines
Yes, I think thats the right thing todo.
Thanks,
tglx
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Joe PerchesQuoted 4 lines · Joe Perches
There are more than 1000 uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt Make that the default define so these uses can be removed later via script.Signed-off-by Joe Perches <[email protected]>
It removes a lot of duplicates. I just hope that we will not need to add the same amount of defines to remove/change the prefix where the new default would look ugly.
I am not completely convinced that it is worth it. But it makes some sense. Feel free to use:
BTW: I tried the entire patchset and there are still many locations even in the boot log that might need an update:
[ 0.000000] main: Linux version 4.17.0-rc4-default+ (pmladek@pathway) (gcc version 7.3.1 20180226 [gcc-7-branch revision 257983] (SUSE Linux)) #4505 SMP Fri May 11 13:24:37 CEST 2018 [ 0.000000] e820: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ 0.000000] e820: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] e820: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved [ 0.000000] e820: BIOS-e820: [mem 0x0000000000100000-0x00000000bffdefff] usable [ 0.000000] e820: BIOS-e820: [mem 0x00000000bffdf000-0x00000000bfffffff] reserved [ 0.000000] e820: BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved [ 0.000000] e820: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved [ 0.000000] e820: BIOS-e820: [mem 0x0000000100000000-0x000000013fffffff] usable [ 0.000000] dmi_scan: DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 [ 0.000000] hypervisor: Hypervisor detected: KVM [ 0.000000] generic: MTRR default type: write-back [ 0.000000] generic: MTRR fixed ranges enabled: [ 0.000000] generic: 00000-9FFFF write-back [ 0.000000] generic: A0000-BFFFF uncachable [ 0.000000] generic: C0000-FFFFF write-protect [ 0.000000] generic: MTRR variable ranges enabled: [ 0.000000] generic: 0 base 000C0000000 mask 3FFC0000000 uncachable [ 0.000000] generic: 1 disabled [ 0.000000] generic: 2 disabled [ 0.000000] generic: 3 disabled [ 0.000000] generic: 4 disabled [ 0.000000] generic: 5 disabled [ 0.000000] generic: 6 disabled [ 0.000000] generic: 7 disabled [ 0.000000] libftrace: ftrace: allocating 40753 entries in 160 pages [ 0.004008] apic: APIC: Switch to symmetric I/O mode setup [ 0.056663] dca: dca service started, version 1.12.1 [ 0.057807] hugetlb: HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages [ 0.060035] cryptd: cryptd: max_cpu_qlen set to 1000 [ 0.066252] acpi: ACPI: (supports S0 S3 S4 S5) [ 0.071004] acpi: ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) [ 0.136057] usbcore: usbcore: registered new interface driver usbfs [ 0.136671] usbcore: usbcore: registered new interface driver hub [ 0.137389] usbcore: usbcore: registered new device driver usb [ 0.795954] key: Key type blacklist registered [ 0.796479] workingset: workingset: timestamp_bits=36 max_order=20 bucket_order=0 [ 0.798899] key: Key type id_resolver registered [ 0.799347] key: Key type id_legacy registered [ 0.799790] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 1.044458] ipmi_si: ipmi_si: Unable to find any System Interface(s) [ 1.046489] ioatdma: ioatdma: Intel(R) QuickData Technology Driver 4.00 [ 1.076080] ppdev: ppdev: user-space parallel port driver [ 1.484645] ehci_pci: ehci-pci: EHCI PCI platform driver [ 1.544643] parport: parport0: cannot grant exclusive access for device pps_parport [ 1.545968] pps_parport: couldn't register with parport0 [ 1.556821] usbcore: usbcore: registered new interface driver usbhid [ 1.558001] usbhid: usbhid: USB HID core driver [ 1.559213] parport: parport0: cannot grant exclusive access for device MTS64 [ 1.562908] parport: parport0: cannot grant exclusive access for device portman
Best regards,
Petr
Re: [PATCH 13/18] printk: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesQuoted 6 lines · Joe Perches
Converting
pr_fmtfrom a simple define to useKBUILD_MODNAMEadded some duplicate logging prefixes to existing uses.Remove them.
Signed-off-by Joe Perches <[email protected]>
Best Regards,
Petr
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
In reply to Petr MladekQuoted 9 lines · Petr Mladek
Quoted 4 lines · Joe Perches
There are more than 1000 uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt Make that the default define so these uses can be removed later via script.Signed-off-by Joe Perches <[email protected]>It removes a lot of duplicates. I just hope that we will not need to add the same amount of defines to remove/change the prefix where the new default would look ugly.
I expect there will be far far fewer additions, perhaps a few dozen, than the about 1200 removals.
Quoted 8 lines
I am not completely convinced that it is worth it. But it makes some sense. Feel free to use:
Acked-by Petr Mladek <[email protected]>BTW: I tried the entire patchset and there are still many locations even in the boot log that might need an update:
Thanks.
Quoted 1 line
[ 0.000000] generic: MTRR default type: write-back
generic might be removed.
Quoted 2 lines
[ 0.000000] libftrace: ftrace: allocating 40753 entries in 160 pages [ 0.004008] apic: APIC: Switch to symmetric I/O mode setup
I believe the uppercase APIC: bit should be removed.
Quoted 1 line
[ 0.796479] workingset: workingset: timestamp_bits=36 max_order=20 bucket_order=0
and I will submit patches for these other duplicates.
Quoted 7 lines
[ 1.044458] ipmi_si: ipmi_si: Unable to find any System Interface(s) [ 1.046489] ioatdma: ioatdma: Intel(R) QuickData Technology Driver 4.00 [ 1.076080] ppdev: ppdev: user-space parallel port driver [ 1.484645] ehci_pci: ehci-pci: EHCI PCI platform driver [ 1.544643] parport: parport0: cannot grant exclusive access for device pps_parport [ 1.556821] usbcore: usbcore: registered new interface driver usbhid [ 1.558001] usbhid: usbhid: USB HID core driver
cheers, Joe
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 7 lines · Joe Perches
Quoted 4 lines · Petr Mladek
On Thu 2018-05-10 08:45:29, Joe Perches wrote:
[ 0.000000] libftrace: ftrace: allocating 40753 entries in 160 pages [ 0.004008] apic: APIC: Switch to symmetric I/O mode setupI believe the uppercase APIC: bit should be removed.
I disagree on lowering the case of some prefixes.
In the case when kernel crashes at boot time and only what you have is what on your screen it's much better to catch with different cases than if everything would be either upper or lower.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Joe Perches
Quoted 3 lines · Petr Mladek
On Thu 2018-05-10 08:45:29, Joe Perches wrote:
[ 0.000000] libftrace: ftrace: allocating 40753 entries in 160 pages [ 0.004008] apic: APIC: Switch to symmetric I/O mode setup
Quoted 7 lines
Quoted 1 line
I believe the uppercase APIC: bit should be removed.
I disagree on lowering the case of some prefixes.
In the case when kernel crashes at boot time and only what you have is what on your screen it's much better to catch with different cases than if everything would be either upper or lower.
I don't parse.
My suggestion is to make "apic: " the only prefix.
ie:
--- arch/x86/kernel/apic/apic.c | 100 +++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 53 deletions(-)
arch/x86/kernel/apic/apic.c +47 -53
@@ -14,6 +14,8 @@* Mikael Pettersson : PM converted to driver model. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/perf_event.h> #include <linux/kernel_stat.h> #include <linux/mc146818rtc.h>
@@ -232,7 +234,7 @@ static int modern_apic(void)*/ static void __init apic_disable (void ) { -pr_info ("APIC: switched to apic NOOP\n" ); +pr_info ("switched to apic NOOP\n" ); apic = &apic_noop; }
@@ -430,17 +432,13 @@ int setup_APIC_eilvt(u8 offset, u8 vector, u8 msg_type, u8 mask) reserved =reserve_eilvt_offset (offset, new);if (reserved != new) { -pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for " -"vector 0x%x, but the register is already in use for " -"vector 0x%x on another cpu\n" , +pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for vector 0x%x, but the register is already in use for vector 0x%x on another cpu\n" ,smp_processor_id (), reg, offset, new, reserved);return -EINVAL ; }if (!eilvt_entry_is_changeable (old, new)) { -pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for " -"vector 0x%x, but the register is already in use for " -"vector 0x%x on this cpu\n" , +pr_err (FW_BUG "cpu %d, try to use APIC%lX (LVT offset %d) for vector 0x%x, but the register is already in use for vector 0x%x on this cpu\n" ,smp_processor_id (), reg, offset, new, old);return -EBUSY ; }
@@ -624,8 +622,8 @@ static void apic_check_deadline_errata(void)return ;setup_clear_cpu_cap (X86_FEATURE_TSC_DEADLINE_TIMER ); -pr_err (FW_BUG "TSC_DEADLINE disabled due to Errata; " -"please update microcode to version: 0x%x (or later)\n" , rev); +pr_err (FW_BUG "TSC_DEADLINE disabled due to Errata; please update microcode to version: 0x%x (or later)\n" , + rev); }/*
@@ -769,14 +767,14 @@ calibrate_by_pmtimer(long deltapm, long *delta, long *deltatsc) res = (((u64 )deltapm) * mult) >>22 ;do_div (res,1000000 ); -pr_warning ("APIC calibration not consistent " -"with PM-Timer: %ldms instead of 100ms\n" ,(long )res); +pr_warn ("calibration not consistent with PM-Timer: %ldms instead of 100ms\n" , + (long )res);/* Correct the lapic counter value */ res = (((u64)(*delta)) * pm_100ms);do_div (res, deltapm); -pr_info ("APIC delta adjusted to PM-Timer: " -"%lu (%ld)\n" , (unsigned long )res, *delta); +pr_info ("APIC delta adjusted to PM-Timer: %lu (%ld)\n" , + (unsigned long )res, *delta); *delta = (long )res;/* Correct the tsc counter value */
@@ -893,7 +891,7 @@ static int __init calibrate_APIC_clock(void)*/ if (lapic_timer_frequency < (1000000 /HZ )) {local_irq_enable (); -pr_warning ("APIC frequency too slow, disabling apic timer\n" ); +pr_warn ("frequency too slow, disabling apic timer\n" );return -1 ; }
@@ -936,8 +934,8 @@ static int __init calibrate_APIC_clock(void)local_irq_enable ();if (levt->features &CLOCK_EVT_FEAT_DUMMY ) { -pr_warning ("APIC timer disabled due to verification failure\n" ); -return -1 ; +pr_warn ("timer disabled due to verification failure\n" ); +return -1 ; }return 0 ;
@@ -1010,8 +1008,8 @@ static void local_apic_timer_interrupt(void)* spurious. */ if (!evt->event_handler) { -pr_warning ("Spurious LAPIC timer interrupt on cpu %d\n" , -smp_processor_id ()); +pr_warn ("Spurious LAPIC timer interrupt on cpu %d\n" , +smp_processor_id ());/* Switch it off */ lapic_timer_shutdown (evt);return ;
@@ -1254,7 +1252,7 @@ static int __init apic_intr_mode_select(void) APIC_INTEGRATED(boot_cpu_apic_version)) { disable_apic =1 ;pr_err (FW_BUG "Local APIC %d not detected, force emulation\n" , - boot_cpu_physical_apicid); + boot_cpu_physical_apicid);return APIC_PIC ; }#endif
@@ -1263,7 +1261,7 @@ static int __init apic_intr_mode_select(void)if (!smp_found_config) {disable_ioapic_support ();if (!acpi_lapic) { -pr_info ("APIC: ACPI MADT or MP tables are not detected\n" ); +pr_info ("ACPI MADT or MP tables are not detected\n" );return APIC_VIRTUAL_WIRE_NO_CONFIG ; }return APIC_VIRTUAL_WIRE ;
@@ -1272,7 +1270,7 @@ static int __init apic_intr_mode_select(void)#ifdef CONFIG_SMP /* If SMP should be disabled, then really disable it! */ if (!setup_max_cpus) { -pr_info ("APIC: SMP mode deactivated\n" ); +pr_info ("SMP mode deactivated\n" );return APIC_SYMMETRIC_IO_NO_ROUTING ; }
@@ -1344,23 +1342,23 @@ void __init apic_intr_mode_init(void)switch (apic_intr_mode) {case APIC_PIC : -pr_info ("APIC: Keep in PIC mode(8259)\n" ); +pr_info ("Keep in PIC mode(8259)\n" );return ;case APIC_VIRTUAL_WIRE : -pr_info ("APIC: Switch to virtual wire mode setup\n" ); +pr_info ("Switch to virtual wire mode setup\n" );default_setup_apic_routing ();break ;case APIC_VIRTUAL_WIRE_NO_CONFIG : -pr_info ("APIC: Switch to virtual wire mode setup with no configuration\n" ); +pr_info ("Switch to virtual wire mode setup with no configuration\n" ); upmode = true;default_setup_apic_routing ();break ;case APIC_SYMMETRIC_IO : -pr_info ("APIC: Switch to symmetric I/O mode setup\n" ); +pr_info ("Switch to symmetric I/O mode setup\n" );default_setup_apic_routing ();break ;case APIC_SYMMETRIC_IO_NO_ROUTING : -pr_info ("APIC: Switch to symmetric I/O mode setup in no SMP routine\n" ); +pr_info ("Switch to symmetric I/O mode setup in no SMP routine\n" );break ; }
@@ -1372,7 +1370,7 @@ static void lapic_setup_esr(void)unsigned int oldvalue, value, maxlvt;if (!lapic_is_integrated ()) { -pr_info ("No ESR for 82489DX.\n" ); +pr_info ("No ESR for 82489DX\n" );return ; }
@@ -1383,7 +1381,7 @@ static void lapic_setup_esr(void)* ESR disabled - we can't do anything useful with the * errors anyway - mbligh */ -pr_info ("Leaving ESR disabled.\n" ); +pr_info ("Leaving ESR disabled\n" );return ; }
@@ -1442,7 +1440,8 @@ static void apic_pending_intr_clear(void) } }if (acked >256 ) { -pr_err ("LAPIC pending interrupts after %d EOI\n" , acked); +pr_err ("LAPIC pending interrupts after %d EOI\n" , + acked);break ; }if (queued) {
@@ -1679,11 +1678,11 @@ static int __init setup_nox2apic(char *str)int apicid =native_apic_msr_read (APIC_ID );if (apicid >=255 ) { -pr_warning ("Apicid: %08x, cannot enforce nox2apic\n" , - apicid); +pr_warn ("Apicid: %08x, cannot enforce nox2apic\n" , + apicid);return 0 ; } -pr_warning ("x2apic already enabled.\n" ); +pr_warn ("x2apic already enabled\n" );__x2apic_disable (); }setup_clear_cpu_cap (X86_FEATURE_X2APIC );
@@ -1851,7 +1850,7 @@ static int __init apic_verify(void)*/ features =cpuid_edx (1 );if (!(features & (1 <<X86_FEATURE_APIC ))) { -pr_warning ("Could not enable APIC!\n" ); +pr_warn ("Could not enable APIC!\n" );return -1 ; }set_cpu_cap (&boot_cpu_data,X86_FEATURE_APIC );
@@ -1923,8 +1922,7 @@ static int __init detect_init_APIC(void)* "lapic" specified. */ if (!force_enable_local_apic) { -pr_info ("Local APIC disabled by BIOS -- " -"you can enable it with \"lapic\"\n" ); +pr_info ("Local APIC disabled by BIOS -- you can enable it with \"lapic\"\n" );return -1 ; }if (apic_force_enable (APIC_DEFAULT_PHYS_BASE ))
@@ -1961,7 +1959,7 @@ void __init init_apic_mappings(void)/* If no local APIC can be found return early */ if (!smp_found_config &&detect_init_APIC ()) {/* lets NOP'ify apic operations */ -pr_info ("APIC: disable apic facility\n" ); +pr_info ("disable apic facility\n" );apic_disable (); }else { apic_phys = mp_lapic_addr;
@@ -2248,9 +2246,8 @@ int generic_processor_info(int apicid, int version) disabled_cpu_apicid == apicid) {int thiscpu = num_processors + disabled_cpus; -pr_warning ("APIC: Disabling requested cpu." -" Processor %d/0x%x ignored.\n" , - thiscpu, apicid); +pr_warn ("Disabling requested cpu. Processor %d/0x%x ignored.\n" , + thiscpu, apicid); disabled_cpus++;return -ENODEV ;
@@ -2264,10 +2261,7 @@ int generic_processor_info(int apicid, int version) apicid != boot_cpu_physical_apicid) {int thiscpu = max + disabled_cpus -1 ; -pr_warning ( -"APIC: NR_CPUS/possible_cpus limit of %i almost" -" reached. Keeping one slot for boot cpu." -" Processor %d/0x%x ignored.\n" , max, thiscpu, apicid); +pr_warn ("NR_CPUS/possible_cpus limit of %i almost reached. Keeping one slot for boot cpu. Processor %d/0x%x ignored.\n" , max, thiscpu, apicid); disabled_cpus++;return -ENODEV ;
@@ -2276,9 +2270,8 @@ int generic_processor_info(int apicid, int version)if (num_processors >= nr_cpu_ids) {int thiscpu = max + disabled_cpus; -pr_warning ("APIC: NR_CPUS/possible_cpus limit of %i " -"reached. Processor %d/0x%x ignored.\n" , - max, thiscpu, apicid); +pr_warn ("NR_CPUS/possible_cpus limit of %i reached. Processor %d/0x%x ignored.\n" , + max, thiscpu, apicid); disabled_cpus++;return -EINVAL ;
@@ -2308,13 +2301,13 @@ int generic_processor_info(int apicid, int version)* Validate version */ if (version ==0x0 ) { -pr_warning ("BIOS bug: APIC version is 0 for CPU %d/0x%x, fixing up to 0x10\n" , - cpu, apicid); +pr_warn ("BIOS bug: APIC version is 0 for CPU %d/0x%x, fixing up to 0x10\n" , + cpu, apicid); version =0x10 ; }if (version != boot_cpu_apic_version) { -pr_warning ("BIOS bug: APIC version mismatch, boot CPU: %x, CPU %d: version %x\n" , +pr_warn ("BIOS bug: APIC version mismatch, boot CPU: %x, CPU %d: version %x\n" , boot_cpu_apic_version, cpu, version); }
@@ -2590,7 +2583,7 @@ static int set_multi(const struct dmi_system_id *d) {if (multi)return 0 ; -pr_info ("APIC: %s detected, Multi Chassis\n" , d->ident); +pr_info ("%s detected, Multi Chassis\n" , d->ident); multi =1 ;return 0 ; }
@@ -2686,8 +2679,8 @@ static int __init apic_set_verbosity(char *arg) apic_verbosity =APIC_VERBOSE ;#ifdef CONFIG_X86_64 else { -pr_warning ("APIC Verbosity level %s not recognised" -" use apic=verbose or apic=debug\n" , arg); +pr_warn ("Verbosity level %s not recognised use apic=verbose or apic=debug\n" , + arg);return -EINVAL ; }#endif
@@ -2736,7 +2729,8 @@ static int __init apic_set_extnmi(char *arg)else if (!strncmp ("bsp" , arg,3 )) apic_extnmi =APIC_EXTNMI_BSP ;else { -pr_warn ("Unknown external NMI delivery mode `%s' ignored\n" , arg); +pr_warn ("Unknown external NMI delivery mode `%s' ignored\n" , + arg);return -EINVAL ; }
Re: [PATCH 03/18] printk: Convert pr_fmt from blank define to KBUILD_MODNAME
Quoted 9 lines · Joe Perches
Quoted 8 lines · Andy Shevchenko
Quoted 6 lines · Joe Perches
Quoted 3 lines · Petr Mladek
On Thu 2018-05-10 08:45:29, Joe Perches wrote:
[ 0.000000] libftrace: ftrace: allocating 40753 entries in 160 pages [ 0.004008] apic: APIC: Switch to symmetric I/O mode setupI believe the uppercase APIC: bit should be removed.
Quoted 8 lines
Quoted 5 lines
I disagree on lowering the case of some prefixes.
In the case when kernel crashes at boot time and only what you have is what on your screen it's much better to catch with different cases than if everything would be either upper or lower.
I don't parse.
My suggestion is to make "apic: " the only prefix.
What I mean is after your patch it would be like:
subsys1: ...
...
framework1: ...
...
subsys2: ...
...
What I meant is what you can see in any current log, something like:
subsys1: ...
...
FRAMEWORK1: ...
...
subsys2: ...
...
When you see such on a long screen, you can momentarely put your eyes on string in question.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Steven Rostedt
maintainerRe: [PATCH] ring_buffer: Update logging to use single line output
In reply to Joe PerchesQuoted 9 lines · On Fri, 11 May 2018 14:39:18 -0700 Joe Perches <[email protected]> wrote:
With a possible change to
pr_fmtcoming, the logging output can become unbalanced when an initial line has a prefix and subsequent lines do not when a multiple line pr_<level> is emitted.Fix it by emitting a single line.
Miscellanea:
o Convert consecutive tests of
total_lostand !total_lost to if/else
I just noticed this patch. Please don't send patches Cc'd to other threads. They need to start a new thread, otherwise, like this one, it will most likely be lost.
If you want this applied still, please resend it properly.
-- Steve
Quoted 24 lines
Signed-off-by Joe Perches <[email protected]>--- kernel/trace/ring_buffer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)kernel/trace/ring_buffer.c +3
-4@@ -5132,10 +5132,9 @@ static __init int test_ringbuffer(void)pr_info (" total events: %ld\n" , total_lost + total_read);pr_info (" recorded len bytes: %ld\n" , total_len);pr_info (" recorded size bytes: %ld\n" , total_size); -if (total_lost) -pr_info (" With dropped events, record len and size may not match\n" -" alloced and written from above\n" ); -if (!total_lost) { +if (total_lost) { +pr_info (" With dropped events, record len and size may not match alloced and written from above\n" ); + }else {if (RB_WARN_ON (buffer, total_len != total_alloc || total_size != total_written))break ;
Re: [PATCH] ring_buffer: Update logging to use single line output
Quoted 11 lines · Steven Rostedt
Quoted 8 lines · On Fri, 11 May 2018 14:39:18 -0700 Joe Perches <[email protected]> wrote:
With a possible change to
pr_fmtcoming, the logging output can become unbalanced when an initial line has a prefix and subsequent lines do not when a multiple line pr_<level> is emitted.Fix it by emitting a single line.
Miscellanea:
Quoted 7 lines
Quoted 1 line
o Convert consecutive tests of
total_lostand !total_lost to if/elseI just noticed this patch. Please don't send patches Cc'd to other threads. They need to start a new thread, otherwise, like this one, it will most likely be lost.
If you want this applied still, please resend it properly.
An email sent directly to you should not be lost by you.
Quoted 28 lines
-- Steve
Quoted 24 lines
Signed-off-by Joe Perches <[email protected]>--- kernel/trace/ring_buffer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)kernel/trace/ring_buffer.c +3
-4@@ -5132,10 +5132,9 @@ static __init int test_ringbuffer(void)pr_info (" total events: %ld\n" , total_lost + total_read);pr_info (" recorded len bytes: %ld\n" , total_len);pr_info (" recorded size bytes: %ld\n" , total_size); -if (total_lost) -pr_info (" With dropped events, record len and size may not match\n" -" alloced and written from above\n" ); -if (!total_lost) { +if (total_lost) { +pr_info (" With dropped events, record len and size may not match alloced and written from above\n" ); + }else {if (RB_WARN_ON (buffer, total_len != total_alloc || total_size != total_written))break ;
Steven Rostedt
maintainerRe: [PATCH] ring_buffer: Update logging to use single line output
Quoted 7 lines · On Wed, 11 Jul 2018 21:42:53 -0700 Joe Perches <[email protected]> wrote:
Quoted 5 lines
I just noticed this patch. Please don't send patches Cc'd to other threads. They need to start a new thread, otherwise, like this one, it will most likely be lost.
If you want this applied still, please resend it properly.
An email sent directly to you should not be lost by you.
OK, it was ignored.
-- Steve
Re: [tip:x86/cleanups] x86: Remove pr_fmt duplicate logging prefixes
In reply to Joe PerchesQuoted 46 lines · Joe Perches
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · tip-bot for Joe Perches
Commit-ID: 1de392f5d5e803663abbd8ed084233f154152bcd Gitweb: https://git.kernel.org/tip/1de392f5d5e803663abbd8ed084233f154152bcd Author: Joe Perches <[email protected]> AuthorDate: Thu, 10 May 2018 08:45:30 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 13 May 2018 21:25:18 +0200Quoted 6 lines
Quoted 6 lines
x86: Remove
pr_fmtduplicate logging prefixesConverting
pr_fmtfrom a default simple #define to useKBUILD_MODNAMEadded some duplicate prefixes.Remove the duplicate prefixes.
[]
Quoted 14 lines
Maybe I'm missing something but this dropped the prefixes now completely:
(quoted diff) +3
-3-e820: BIOS-provided physical RAM map: +BIOS-provided physical RAM map: -e820: last_pfn = 0x43f000 max_arch_pfn = 0x400000000 +last_pfn = 0x43f000 max_arch_pfn = 0x400000000 -e820: last_pfn = 0x9d000 max_arch_pfn = 0x400000000 +last_pfn = 0x9d000 max_arch_pfn = 0x400000000Quoted 1 line
I don't think that was the intention.
Hi Borislav
It wasn't and isn't the intention.
This is a patch _series_, and all of the patches from 4-18 depend on patch 3 which converts the generic define in
include/linux/printk.hfrom
#define pr_fmt(fmt) fmt to #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Quoted 6 lines
Perhaps a better option, which could be done in a v2 of the series, is to add a temporary #define
pr_fmt(fmt)KBUILD_MODNAME": " fmt to each file modified in patches 4-18 and then allow the follow-on script described in the 0/18 cover letter to remove those #defines
Was there ever a v2? What I see from 1de392f5d5e8 ("x86: Remove pr_fmt duplicate logging prefixes") is exactly what Borislav noted.
For example, https://bugzilla.kernel.org/attachment.cgi?id=281007 is a v4.20 dmesg log from
https://bugzilla.kernel.org/show_bug.cgi?id=202511 . That bug also has a v4.17 dmesg log
(https://bugzilla.kernel.org/attachment.cgi?id=281011). Comparing them shows:
-Linux version 4.17.19-gentoo (root@survivor) (gcc version 7.3.0 (Gentoo 7.3.0-r3 p1.4)) #2 SMP Sat Sep 22 09:53:01 EDT 2018 +Linux version 4.20.6-gentoo (root@survivor) (gcc version 7.3.0 (Gentoo 7.3.0-r3 p1.4)) #1 SMP Tue Feb 5 09:46:51 EST 2019
...
-e820: BIOS-provided physical RAM map:
+BIOS-provided physical RAM map:
Not a big deal as far as I'm concerned, but it is a minor annoyance.
Bjorn