* [PATCH 1/2] printk: introduce pr_default() macro
@ 2016-02-05 13:48 Chen Yucong
2016-02-05 13:48 ` [PATCH 2/2] x86: use " Chen Yucong
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chen Yucong @ 2016-02-05 13:48 UTC (permalink / raw)
To: mingo; +Cc: tglx, hpa, x86, akpm, linux-kernel
Until now, we cover all log-levels by pr_<level> macros except
KERN_DEFAULT one. Add it for convenience.
Signed-off-by: Chen Yucong <slaoub@gmail.com>
---
include/linux/printk.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 51dd6b8..9808130 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -274,6 +274,8 @@ extern asmlinkage void dump_stack(void) __cold;
*/
#define pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)
+#define pr_default(fmt, ...) \
+ printk(KERN_DEFAULT pr_fmt(fmt), ##__VA_ARGS__)
/* pr_devel() should produce zero code unless DEBUG is defined */
#ifdef DEBUG
@@ -345,6 +347,8 @@ extern asmlinkage void dump_stack(void) __cold;
printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
#define pr_cont_once(fmt, ...) \
printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_default_once(fmt, ...) \
+ printk_once(KERN_DEFAULT pr_fmt(fmt), ##__VA_ARGS__)
#if defined(DEBUG)
#define pr_devel_once(fmt, ...) \
@@ -396,6 +400,8 @@ extern asmlinkage void dump_stack(void) __cold;
printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#define pr_info_ratelimited(fmt, ...) \
printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_default_ratelimited(fmt, ...) \
+ printk_ratelimited(KERN_DEFAULT pr_fmt(fmt), ##__VA_ARGS__)
/* no pr_cont_ratelimited, don't do that... */
#if defined(DEBUG)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] x86: use pr_default() macro
2016-02-05 13:48 [PATCH 1/2] printk: introduce pr_default() macro Chen Yucong
@ 2016-02-05 13:48 ` Chen Yucong
2016-02-05 16:14 ` [PATCH 1/2] printk: introduce " Joe Perches
2016-02-05 16:14 ` Joe Perches
2 siblings, 0 replies; 5+ messages in thread
From: Chen Yucong @ 2016-02-05 13:48 UTC (permalink / raw)
To: mingo; +Cc: tglx, hpa, x86, akpm, linux-kernel
- convert printk(KERN_DEFAULT ...) to pr_default(...)
Signed-off-by: Chen Yucong <slaoub@gmail.com>
---
arch/x86/kernel/dumpstack.c | 3 +--
arch/x86/kernel/dumpstack_64.c | 4 ++--
arch/x86/kernel/process_32.c | 29 ++++++++++++++---------------
arch/x86/kernel/process_64.c | 41 ++++++++++++++++++++---------------------
arch/x86/mm/fault.c | 2 +-
5 files changed, 38 insertions(+), 41 deletions(-)
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 993706a..1ae9a6d 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -257,8 +257,7 @@ int __die(const char *str, struct pt_regs *regs, long err)
unsigned short ss;
unsigned long sp;
#endif
- printk(KERN_DEFAULT
- "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
+ pr_default("%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
#ifdef CONFIG_PREEMPT
printk("PREEMPT ");
#endif
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 5f1c626..8e6c739 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -316,11 +316,11 @@ void show_regs(struct pt_regs *regs)
unsigned char c;
u8 *ip;
- printk(KERN_DEFAULT "Stack:\n");
+ pr_default("Stack:\n");
show_stack_log_lvl(NULL, regs, (unsigned long *)sp,
0, KERN_DEFAULT);
- printk(KERN_DEFAULT "Code: ");
+ pr_default("Code: ");
ip = (u8 *)regs->ip - code_prologue;
if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 9f95091..4039da4 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -83,17 +83,17 @@ void __show_regs(struct pt_regs *regs, int all)
savesegment(gs, gs);
}
- printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
- (u16)regs->cs, regs->ip, regs->flags,
- smp_processor_id());
+ pr_default("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
+ (u16)regs->cs, regs->ip, regs->flags,
+ smp_processor_id());
print_symbol("EIP is at %s\n", regs->ip);
- printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
- regs->ax, regs->bx, regs->cx, regs->dx);
- printk(KERN_DEFAULT "ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
- regs->si, regs->di, regs->bp, sp);
- printk(KERN_DEFAULT " DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
- (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss);
+ pr_default("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
+ regs->ax, regs->bx, regs->cx, regs->dx);
+ pr_default("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
+ regs->si, regs->di, regs->bp, sp);
+ pr_default(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
+ (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss);
if (!all)
return;
@@ -102,8 +102,8 @@ void __show_regs(struct pt_regs *regs, int all)
cr2 = read_cr2();
cr3 = read_cr3();
cr4 = __read_cr4_safe();
- printk(KERN_DEFAULT "CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
- cr0, cr2, cr3, cr4);
+ pr_default("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
+ cr0, cr2, cr3, cr4);
get_debugreg(d0, 0);
get_debugreg(d1, 1);
@@ -117,10 +117,9 @@ void __show_regs(struct pt_regs *regs, int all)
(d6 == DR6_RESERVED) && (d7 == 0x400))
return;
- printk(KERN_DEFAULT "DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
- d0, d1, d2, d3);
- printk(KERN_DEFAULT "DR6: %08lx DR7: %08lx\n",
- d6, d7);
+ pr_default("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
+ d0, d1, d2, d3);
+ pr_default("DR6: %08lx DR7: %08lx\n", d6, d7);
}
void release_thread(struct task_struct *dead_task)
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 71a18a2..37ff6be 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -61,20 +61,20 @@ void __show_regs(struct pt_regs *regs, int all)
unsigned int fsindex, gsindex;
unsigned int ds, cs, es;
- printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
+ pr_default("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
printk_address(regs->ip);
- printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
- regs->sp, regs->flags);
- printk(KERN_DEFAULT "RAX: %016lx RBX: %016lx RCX: %016lx\n",
- regs->ax, regs->bx, regs->cx);
- printk(KERN_DEFAULT "RDX: %016lx RSI: %016lx RDI: %016lx\n",
- regs->dx, regs->si, regs->di);
- printk(KERN_DEFAULT "RBP: %016lx R08: %016lx R09: %016lx\n",
- regs->bp, regs->r8, regs->r9);
- printk(KERN_DEFAULT "R10: %016lx R11: %016lx R12: %016lx\n",
- regs->r10, regs->r11, regs->r12);
- printk(KERN_DEFAULT "R13: %016lx R14: %016lx R15: %016lx\n",
- regs->r13, regs->r14, regs->r15);
+ pr_default("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
+ regs->sp, regs->flags);
+ pr_default("RAX: %016lx RBX: %016lx RCX: %016lx\n",
+ regs->ax, regs->bx, regs->cx);
+ pr_default("RDX: %016lx RSI: %016lx RDI: %016lx\n",
+ regs->dx, regs->si, regs->di);
+ pr_default("RBP: %016lx R08: %016lx R09: %016lx\n",
+ regs->bp, regs->r8, regs->r9);
+ pr_default("R10: %016lx R11: %016lx R12: %016lx\n",
+ regs->r10, regs->r11, regs->r12);
+ pr_default("R13: %016lx R14: %016lx R15: %016lx\n",
+ regs->r13, regs->r14, regs->r15);
asm("movl %%ds,%0" : "=r" (ds));
asm("movl %%cs,%0" : "=r" (cs));
@@ -94,12 +94,11 @@ void __show_regs(struct pt_regs *regs, int all)
cr3 = read_cr3();
cr4 = __read_cr4();
- printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
- fs, fsindex, gs, gsindex, shadowgs);
- printk(KERN_DEFAULT "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
- es, cr0);
- printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
- cr4);
+ pr_default("FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
+ fs, fsindex, gs, gsindex, shadowgs);
+ pr_default("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
+ es, cr0);
+ pr_default("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4);
get_debugreg(d0, 0);
get_debugreg(d1, 1);
@@ -113,8 +112,8 @@ void __show_regs(struct pt_regs *regs, int all)
(d6 == DR6_RESERVED) && (d7 == 0x400))
return;
- printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
- printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
+ pr_default("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
+ pr_default("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
}
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index eef44d9..531fe75 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -723,7 +723,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
sig = 0;
/* Executive summary in case the body of the oops scrolled away */
- printk(KERN_DEFAULT "CR2: %016lx\n", address);
+ pr_default("CR2: %016lx\n", address);
oops_end(flags, regs, sig);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] printk: introduce pr_default() macro
2016-02-05 13:48 [PATCH 1/2] printk: introduce pr_default() macro Chen Yucong
2016-02-05 13:48 ` [PATCH 2/2] x86: use " Chen Yucong
@ 2016-02-05 16:14 ` Joe Perches
2016-02-05 16:14 ` Joe Perches
2 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2016-02-05 16:14 UTC (permalink / raw)
To: Chen Yucong, mingo; +Cc: tglx, hpa, x86, akpm, linux-kernel
On Fri, 2016-02-05 at 21:48 +0800, Chen Yucong wrote:
> Until now, we cover all log-levels by pr_<level> macros except
> KERN_DEFAULT one. Add it for convenience.
>
> Signed-off-by: Chen Yucong <slaoub@gmail.com>
> ---
> include/linux/printk.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 51dd6b8..9808130 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -274,6 +274,8 @@ extern asmlinkage void dump_stack(void) __cold;
> */
> #define pr_cont(fmt, ...) \
> printk(KERN_CONT fmt, ##__VA_ARGS__)
> +#define pr_default(fmt, ...) \
> + printk(KERN_DEFAULT pr_fmt(fmt), ##__VA_ARGS__)
>
> /* pr_devel() should produce zero code unless DEBUG is defined */
> #ifdef DEBUG
> @@ -345,6 +347,8 @@ extern asmlinkage void dump_stack(void) __cold;
> printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
> #define pr_cont_once(fmt, ...)
> \
> printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_default_once(fmt, ...) \
> + printk_once(KERN_DEFAULT pr_fmt(fmt), ##__VA_ARGS__)
>
> #if defined(DEBUG)
> #define pr_devel_once(fmt, ...)
> \
> @@ -396,6 +400,8 @@ extern asmlinkage void dump_stack(void) __cold;
> printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
> #define pr_info_ratelimited(fmt, ...)
> \
> printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
> +#define pr_default_ratelimited(fmt, ...)
> \
> + printk_ratelimited(KERN_DEFAULT pr_fmt(fmt), ##__VA_ARGS__)
> /* no pr_cont_ratelimited, don't do that... */
>
> #if defined(DEBUG)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] printk: introduce pr_default() macro
2016-02-05 13:48 [PATCH 1/2] printk: introduce pr_default() macro Chen Yucong
2016-02-05 13:48 ` [PATCH 2/2] x86: use " Chen Yucong
2016-02-05 16:14 ` [PATCH 1/2] printk: introduce " Joe Perches
@ 2016-02-05 16:14 ` Joe Perches
2016-02-09 9:52 ` Ingo Molnar
2 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2016-02-05 16:14 UTC (permalink / raw)
To: Chen Yucong, mingo; +Cc: tglx, hpa, x86, akpm, linux-kernel, Linus Torvalds
On Fri, 2016-02-05 at 21:48 +0800, Chen Yucong wrote:
> Until now, we cover all log-levels by pr_ macros except
> KERN_DEFAULT one. Add it for convenience.
I'd rather it be removed altogether.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] printk: introduce pr_default() macro
2016-02-05 16:14 ` Joe Perches
@ 2016-02-09 9:52 ` Ingo Molnar
0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2016-02-09 9:52 UTC (permalink / raw)
To: Joe Perches
Cc: Chen Yucong, tglx, hpa, x86, akpm, linux-kernel, Linus Torvalds
* Joe Perches <joe@perches.com> wrote:
> On Fri, 2016-02-05 at 21:48 +0800, Chen Yucong wrote:
> > Until now, we cover all log-levels by pr_ macros except
> > KERN_DEFAULT one. Add it for convenience.
>
> I'd rather it be removed altogether.
Yes, they should be converted to KERN_WARNING (which is the default loglevel),
and another patch should remove KERN_DEFAULT altogether.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-09 9:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05 13:48 [PATCH 1/2] printk: introduce pr_default() macro Chen Yucong
2016-02-05 13:48 ` [PATCH 2/2] x86: use " Chen Yucong
2016-02-05 16:14 ` [PATCH 1/2] printk: introduce " Joe Perches
2016-02-05 16:14 ` Joe Perches
2016-02-09 9:52 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).