Skip to content

Commit 9e76561

Browse files
mcgrofingomolnar
authored andcommitted
x86/mm/pat: Convert to pr_*() usage
Use pr_info() instead of the old printk to prefix the component where things are coming from. With this readers will know exactly where the message is coming from. We use pr_* helpers but define pr_fmt to the empty string for easier grepping for those error messages. We leave the users of dprintk() in place, this will print only when the debugpat kernel parameter is enabled. We want to leave those enabled as a debug feature, but also make them use the same prefix. Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> [ Kill pr_fmt. ] Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Andy Walls <awalls@md.metrocast.net> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Dave Airlie <airlied@redhat.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Doug Ledford <dledford@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: cocci@systeme.lip6.fr Cc: plagnioj@jcrosoft.com Cc: tomi.valkeinen@ti.com Link: http://lkml.kernel.org/r/1430425520-22275-2-git-send-email-mcgrof@do-not-panic.com Link: http://lkml.kernel.org/r/1432628901-18044-9-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent b73522e commit 9e76561

3 files changed

Lines changed: 26 additions & 26 deletions

File tree

‎arch/x86/mm/pat.c‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@
3333
#include "pat_internal.h"
3434
#include "mm_internal.h"
3535

36+
#undef pr_fmt
37+
#define pr_fmt(fmt) "" fmt
38+
3639
#ifdef CONFIG_X86_PAT
3740
int __read_mostly pat_enabled = 1;
3841

3942
static inline void pat_disable(const char *reason)
4043
{
4144
pat_enabled = 0;
42-
printk(KERN_INFO "%s\n", reason);
45+
pr_info("x86/PAT: %s\n", reason);
4346
}
4447

4548
static int __init nopat(char *str)
@@ -188,7 +191,7 @@ void pat_init_cache_modes(void)
188191
pat_msg + 4 * i);
189192
update_cache_mode_entry(i, cache);
190193
}
191-
pr_info("PAT configuration [0-7]: %s\n", pat_msg);
194+
pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
192195
}
193196

194197
#define PAT(x, y) ((u64)PAT_ ## y << ((x)*8))
@@ -211,8 +214,7 @@ void pat_init(void)
211214
* switched to PAT on the boot CPU. We have no way to
212215
* undo PAT.
213216
*/
214-
printk(KERN_ERR "PAT enabled, "
215-
"but not supported by secondary CPU\n");
217+
pr_err("x86/PAT: PAT enabled, but not supported by secondary CPU\n");
216218
BUG();
217219
}
218220
}
@@ -347,7 +349,7 @@ static int reserve_ram_pages_type(u64 start, u64 end,
347349
page = pfn_to_page(pfn);
348350
type = get_page_memtype(page);
349351
if (type != -1) {
350-
pr_info("reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n",
352+
pr_info("x86/PAT: reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n",
351353
start, end - 1, type, req_type);
352354
if (new_type)
353355
*new_type = type;
@@ -451,9 +453,9 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type,
451453

452454
err = rbt_memtype_check_insert(new, new_type);
453455
if (err) {
454-
printk(KERN_INFO "reserve_memtype failed [mem %#010Lx-%#010Lx], track %s, req %s\n",
455-
start, end - 1,
456-
cattr_name(new->type), cattr_name(req_type));
456+
pr_info("x86/PAT: reserve_memtype failed [mem %#010Lx-%#010Lx], track %s, req %s\n",
457+
start, end - 1,
458+
cattr_name(new->type), cattr_name(req_type));
457459
kfree(new);
458460
spin_unlock(&memtype_lock);
459461

@@ -497,8 +499,8 @@ int free_memtype(u64 start, u64 end)
497499
spin_unlock(&memtype_lock);
498500

499501
if (!entry) {
500-
printk(KERN_INFO "%s:%d freeing invalid memtype [mem %#010Lx-%#010Lx]\n",
501-
current->comm, current->pid, start, end - 1);
502+
pr_info("x86/PAT: %s:%d freeing invalid memtype [mem %#010Lx-%#010Lx]\n",
503+
current->comm, current->pid, start, end - 1);
502504
return -EINVAL;
503505
}
504506

@@ -628,8 +630,8 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
628630

629631
while (cursor < to) {
630632
if (!devmem_is_allowed(pfn)) {
631-
printk(KERN_INFO "Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n",
632-
current->comm, from, to - 1);
633+
pr_info("x86/PAT: Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n",
634+
current->comm, from, to - 1);
633635
return 0;
634636
}
635637
cursor += PAGE_SIZE;
@@ -698,8 +700,7 @@ int kernel_map_sync_memtype(u64 base, unsigned long size,
698700
size;
699701

700702
if (ioremap_change_attr((unsigned long)__va(base), id_sz, pcm) < 0) {
701-
printk(KERN_INFO "%s:%d ioremap_change_attr failed %s "
702-
"for [mem %#010Lx-%#010Lx]\n",
703+
pr_info("x86/PAT: %s:%d ioremap_change_attr failed %s for [mem %#010Lx-%#010Lx]\n",
703704
current->comm, current->pid,
704705
cattr_name(pcm),
705706
base, (unsigned long long)(base + size-1));
@@ -734,7 +735,7 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
734735

735736
pcm = lookup_memtype(paddr);
736737
if (want_pcm != pcm) {
737-
printk(KERN_WARNING "%s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n",
738+
pr_warn("x86/PAT: %s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n",
738739
current->comm, current->pid,
739740
cattr_name(want_pcm),
740741
(unsigned long long)paddr,
@@ -755,13 +756,12 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
755756
if (strict_prot ||
756757
!is_new_memtype_allowed(paddr, size, want_pcm, pcm)) {
757758
free_memtype(paddr, paddr + size);
758-
printk(KERN_ERR "%s:%d map pfn expected mapping type %s"
759-
" for [mem %#010Lx-%#010Lx], got %s\n",
760-
current->comm, current->pid,
761-
cattr_name(want_pcm),
762-
(unsigned long long)paddr,
763-
(unsigned long long)(paddr + size - 1),
764-
cattr_name(pcm));
759+
pr_err("x86/PAT: %s:%d map pfn expected mapping type %s for [mem %#010Lx-%#010Lx], got %s\n",
760+
current->comm, current->pid,
761+
cattr_name(want_pcm),
762+
(unsigned long long)paddr,
763+
(unsigned long long)(paddr + size - 1),
764+
cattr_name(pcm));
765765
return -EINVAL;
766766
}
767767
/*

‎arch/x86/mm/pat_internal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
extern int pat_debug_enable;
55

66
#define dprintk(fmt, arg...) \
7-
do { if (pat_debug_enable) printk(KERN_INFO fmt, ##arg); } while (0)
7+
do { if (pat_debug_enable) pr_info("x86/PAT: " fmt, ##arg); } while (0)
88

99
struct memtype {
1010
u64 start;

‎arch/x86/mm/pat_rbtree.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ static int memtype_rb_check_conflict(struct rb_root *root,
160160
return 0;
161161

162162
failure:
163-
printk(KERN_INFO "%s:%d conflicting memory types "
164-
"%Lx-%Lx %s<->%s\n", current->comm, current->pid, start,
165-
end, cattr_name(found_type), cattr_name(match->type));
163+
pr_info("x86/PAT: %s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
164+
current->comm, current->pid, start, end,
165+
cattr_name(found_type), cattr_name(match->type));
166166
return -EBUSY;
167167
}
168168

0 commit comments

Comments
 (0)