* [PATCH V3] x86, cpu: trivial printk formatting fixes
@ 2014-11-05 22:28 Steven Honeyman
2014-11-05 22:41 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Steven Honeyman @ 2014-11-05 22:28 UTC (permalink / raw)
To: Borislav Petkov, Joe Perches, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, Jiri Kosina
Cc: x86, linux-kernel, Steven Honeyman
dmesg (from util-linux) currently has two methods for reading the kernel message ring buffer: /dev/kmsg and syslog(2). Since kernel 3.5.0 kmsg has been the default, which escapes control characters (e.g. new lines) before they are shown.
This change means that when dmesg is using /dev/kmsg, a 2 line printk makes the output messy, because the second line does not get a timestamp.
For example:
[ 0.012863] CPU0: Thermal monitoring enabled (TM1)
[ 0.012869] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 1024
Last level dTLB entries: 4KB 1024, 2MB 1024, 4MB 1024, 1GB 4
[ 0.012958] Freeing SMP alternatives memory: 28K (ffffffff81d86000 - ffffffff81d8d000)
[ 0.014961] dmar: Host address width 39
Because printk.c intentionally escapes control characters, they should not be there in the first place.
This patch fixes two occurrences of this.
V2: Revert change to log level, only fix the newline formatting issue
V3: Expand patch description
Signed-off-by: Steven Honeyman <stevenhoneyman@gmail.com>
---
arch/x86/kernel/cpu/common.c | 11 ++++++-----
arch/x86/kernel/cpu/intel.c | 6 ++----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4b4f78c..fbdd7bf 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -494,12 +494,13 @@ void cpu_detect_tlb(struct cpuinfo_x86 *c)
if (this_cpu->c_detect_tlb)
this_cpu->c_detect_tlb(c);
- printk(KERN_INFO "Last level iTLB entries: 4KB %d, 2MB %d, 4MB %d\n"
- "Last level dTLB entries: 4KB %d, 2MB %d, 4MB %d, 1GB %d\n",
+ pr_info("Last level iTLB entries: 4KB %d, 2MB %d, 4MB %d\n",
tlb_lli_4k[ENTRIES], tlb_lli_2m[ENTRIES],
- tlb_lli_4m[ENTRIES], tlb_lld_4k[ENTRIES],
- tlb_lld_2m[ENTRIES], tlb_lld_4m[ENTRIES],
- tlb_lld_1g[ENTRIES]);
+ tlb_lli_4m[ENTRIES]);
+
+ pr_info("Last level dTLB entries: 4KB %d, 2MB %d, 4MB %d, 1GB %d\n",
+ tlb_lld_4k[ENTRIES], tlb_lld_2m[ENTRIES],
+ tlb_lld_4m[ENTRIES], tlb_lld_1g[ENTRIES]);
}
void detect_ht(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9cc6b6f..dcd08a3 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -487,10 +487,8 @@ static void init_intel(struct cpuinfo_x86 *c)
rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
if ((epb & 0xF) == ENERGY_PERF_BIAS_PERFORMANCE) {
- printk_once(KERN_WARNING "ENERGY_PERF_BIAS:"
- " Set to 'normal', was 'performance'\n"
- "ENERGY_PERF_BIAS: View and update with"
- " x86_energy_perf_policy(8)\n");
+ pr_info_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
+ pr_info_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
}
--
2.1.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3] x86, cpu: trivial printk formatting fixes
2014-11-05 22:28 [PATCH V3] x86, cpu: trivial printk formatting fixes Steven Honeyman
@ 2014-11-05 22:41 ` Joe Perches
2014-11-05 22:46 ` Steven Honeyman
2014-11-05 22:52 ` [PATCH V3b] " Steven Honeyman
0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2014-11-05 22:41 UTC (permalink / raw)
To: Steven Honeyman
Cc: Borislav Petkov, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
Jiri Kosina, x86, linux-kernel
On Wed, 2014-11-05 at 22:28 +0000, Steven Honeyman wrote:
> dmesg (from util-linux) currently has two methods for reading the
> kernel message ring buffer: /dev/kmsg and syslog(2). Since kernel
> 3.5.0 kmsg has been the default, which escapes control characters
> (e.g. new lines) before they are shown.
>
> This change means that when dmesg is using /dev/kmsg, a 2 line printk
> makes the output messy, because the second line does not get a
> timestamp.
> For example:
>
> [ 0.012863] CPU0: Thermal monitoring enabled (TM1)
> [ 0.012869] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 1024
> Last level dTLB entries: 4KB 1024, 2MB 1024, 4MB 1024, 1GB 4
> [ 0.012958] Freeing SMP alternatives memory: 28K (ffffffff81d86000
> - ffffffff81d8d000)
> [ 0.014961] dmar: Host address width 39
>
> Because printk.c intentionally escapes control characters, they should
> not be there in the first place.
> This patch fixes two occurrences of this.
>
> V2: Revert change to log level, only fix the newline formatting issue
> V3: Expand patch description
The log level change is back...
> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
[]
> @@ -487,10 +487,8 @@ static void init_intel(struct cpuinfo_x86 *c)
>
> rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
> if ((epb & 0xF) == ENERGY_PERF_BIAS_PERFORMANCE) {
> - printk_once(KERN_WARNING "ENERGY_PERF_BIAS:"
> - " Set to 'normal', was 'performance'\n"
> - "ENERGY_PERF_BIAS: View and update with"
> - " x86_energy_perf_policy(8)\n");
> + pr_info_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
> + pr_info_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
> epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
> wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3] x86, cpu: trivial printk formatting fixes
2014-11-05 22:41 ` Joe Perches
@ 2014-11-05 22:46 ` Steven Honeyman
2014-11-05 22:52 ` [PATCH V3b] " Steven Honeyman
1 sibling, 0 replies; 5+ messages in thread
From: Steven Honeyman @ 2014-11-05 22:46 UTC (permalink / raw)
To: Joe Perches
Cc: Borislav Petkov, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
Jiri Kosina, x86, linux-kernel
On 5 November 2014 22:41, Joe Perches <joe@perches.com> wrote:
> On Wed, 2014-11-05 at 22:28 +0000, Steven Honeyman wrote:
...
>> V2: Revert change to log level, only fix the newline formatting issue
>> V3: Expand patch description
>
> The log level change is back...
Oh oops - sorry for that, I must have mixed up my source dirs! 2 mins for V3b...
Thanks,
Steven
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V3b] x86, cpu: trivial printk formatting fixes
2014-11-05 22:41 ` Joe Perches
2014-11-05 22:46 ` Steven Honeyman
@ 2014-11-05 22:52 ` Steven Honeyman
2014-11-05 23:10 ` Borislav Petkov
1 sibling, 1 reply; 5+ messages in thread
From: Steven Honeyman @ 2014-11-05 22:52 UTC (permalink / raw)
To: Borislav Petkov, Joe Perches, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, Jiri Kosina
Cc: x86, linux-kernel, Steven Honeyman
dmesg (from util-linux) currently has two methods for reading the kernel message ring buffer: /dev/kmsg and syslog(2). Since kernel 3.5.0 kmsg has been the default, which escapes control characters (e.g. new lines) before they are shown.
This change means that when dmesg is using /dev/kmsg, a 2 line printk makes the output messy, because the second line does not get a timestamp.
For example:
[ 0.012863] CPU0: Thermal monitoring enabled (TM1)
[ 0.012869] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 1024
Last level dTLB entries: 4KB 1024, 2MB 1024, 4MB 1024, 1GB 4
[ 0.012958] Freeing SMP alternatives memory: 28K (ffffffff81d86000 - ffffffff81d8d000)
[ 0.014961] dmar: Host address width 39
Because printk.c intentionally escapes control characters, they should not be there in the first place.
This patch fixes two occurrences of this.
V2: Revert change to log level, only fix the newline formatting issue
V3: Expand patch description
V3b: Fix silly mistake (log level)
Signed-off-by: Steven Honeyman <stevenhoneyman@gmail.com>
---
arch/x86/kernel/cpu/common.c | 11 ++++++-----
arch/x86/kernel/cpu/intel.c | 6 ++----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4b4f78c..fbdd7bf 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -494,12 +494,13 @@ void cpu_detect_tlb(struct cpuinfo_x86 *c)
if (this_cpu->c_detect_tlb)
this_cpu->c_detect_tlb(c);
- printk(KERN_INFO "Last level iTLB entries: 4KB %d, 2MB %d, 4MB %d\n"
- "Last level dTLB entries: 4KB %d, 2MB %d, 4MB %d, 1GB %d\n",
+ pr_info("Last level iTLB entries: 4KB %d, 2MB %d, 4MB %d\n",
tlb_lli_4k[ENTRIES], tlb_lli_2m[ENTRIES],
- tlb_lli_4m[ENTRIES], tlb_lld_4k[ENTRIES],
- tlb_lld_2m[ENTRIES], tlb_lld_4m[ENTRIES],
- tlb_lld_1g[ENTRIES]);
+ tlb_lli_4m[ENTRIES]);
+
+ pr_info("Last level dTLB entries: 4KB %d, 2MB %d, 4MB %d, 1GB %d\n",
+ tlb_lld_4k[ENTRIES], tlb_lld_2m[ENTRIES],
+ tlb_lld_4m[ENTRIES], tlb_lld_1g[ENTRIES]);
}
void detect_ht(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9cc6b6f..dcd08a3 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -487,10 +487,8 @@ static void init_intel(struct cpuinfo_x86 *c)
rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
if ((epb & 0xF) == ENERGY_PERF_BIAS_PERFORMANCE) {
- printk_once(KERN_WARNING "ENERGY_PERF_BIAS:"
- " Set to 'normal', was 'performance'\n"
- "ENERGY_PERF_BIAS: View and update with"
- " x86_energy_perf_policy(8)\n");
+ pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
+ pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
}
--
2.1.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3b] x86, cpu: trivial printk formatting fixes
2014-11-05 22:52 ` [PATCH V3b] " Steven Honeyman
@ 2014-11-05 23:10 ` Borislav Petkov
0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2014-11-05 23:10 UTC (permalink / raw)
To: Steven Honeyman
Cc: Joe Perches, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
Jiri Kosina, x86, linux-kernel
On Wed, Nov 05, 2014 at 10:52:18PM +0000, Steven Honeyman wrote:
> dmesg (from util-linux) currently has two methods for reading the kernel message ring buffer: /dev/kmsg and syslog(2). Since kernel 3.5.0 kmsg has been the default, which escapes control characters (e.g. new lines) before they are shown.
>
> This change means that when dmesg is using /dev/kmsg, a 2 line printk makes the output messy, because the second line does not get a timestamp.
> For example:
>
> [ 0.012863] CPU0: Thermal monitoring enabled (TM1)
> [ 0.012869] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 1024
> Last level dTLB entries: 4KB 1024, 2MB 1024, 4MB 1024, 1GB 4
> [ 0.012958] Freeing SMP alternatives memory: 28K (ffffffff81d86000 - ffffffff81d8d000)
> [ 0.014961] dmar: Host address width 39
>
> Because printk.c intentionally escapes control characters, they should not be there in the first place.
> This patch fixes two occurrences of this.
>
> V2: Revert change to log level, only fix the newline formatting issue
> V3: Expand patch description
> V3b: Fix silly mistake (log level)
>
> Signed-off-by: Steven Honeyman <stevenhoneyman@gmail.com>
Acked-by: Borislav Petkov <bp@suse.de>
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-05 23:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 22:28 [PATCH V3] x86, cpu: trivial printk formatting fixes Steven Honeyman
2014-11-05 22:41 ` Joe Perches
2014-11-05 22:46 ` Steven Honeyman
2014-11-05 22:52 ` [PATCH V3b] " Steven Honeyman
2014-11-05 23:10 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome