Commit 9e76561f authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Ingo Molnar

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: default avatarLuis R. Rodriguez <mcgrof@suse.com>
[ Kill pr_fmt. ]
Signed-off-by: default avatarBorislav 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.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent b73522e0
...@@ -33,13 +33,16 @@ ...@@ -33,13 +33,16 @@
#include "pat_internal.h" #include "pat_internal.h"
#include "mm_internal.h" #include "mm_internal.h"
#undef pr_fmt
#define pr_fmt(fmt) "" fmt
#ifdef CONFIG_X86_PAT #ifdef CONFIG_X86_PAT
int __read_mostly pat_enabled = 1; int __read_mostly pat_enabled = 1;
static inline void pat_disable(const char *reason) static inline void pat_disable(const char *reason)
{ {
pat_enabled = 0; pat_enabled = 0;
printk(KERN_INFO "%s\n", reason); pr_info("x86/PAT: %s\n", reason);
} }
static int __init nopat(char *str) static int __init nopat(char *str)
...@@ -188,7 +191,7 @@ void pat_init_cache_modes(void) ...@@ -188,7 +191,7 @@ void pat_init_cache_modes(void)
pat_msg + 4 * i); pat_msg + 4 * i);
update_cache_mode_entry(i, cache); update_cache_mode_entry(i, cache);
} }
pr_info("PAT configuration [0-7]: %s\n", pat_msg); pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
} }
#define PAT(x, y) ((u64)PAT_ ## y << ((x)*8)) #define PAT(x, y) ((u64)PAT_ ## y << ((x)*8))
...@@ -211,8 +214,7 @@ void pat_init(void) ...@@ -211,8 +214,7 @@ void pat_init(void)
* switched to PAT on the boot CPU. We have no way to * switched to PAT on the boot CPU. We have no way to
* undo PAT. * undo PAT.
*/ */
printk(KERN_ERR "PAT enabled, " pr_err("x86/PAT: PAT enabled, but not supported by secondary CPU\n");
"but not supported by secondary CPU\n");
BUG(); BUG();
} }
} }
...@@ -347,7 +349,7 @@ static int reserve_ram_pages_type(u64 start, u64 end, ...@@ -347,7 +349,7 @@ static int reserve_ram_pages_type(u64 start, u64 end,
page = pfn_to_page(pfn); page = pfn_to_page(pfn);
type = get_page_memtype(page); type = get_page_memtype(page);
if (type != -1) { if (type != -1) {
pr_info("reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n", pr_info("x86/PAT: reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n",
start, end - 1, type, req_type); start, end - 1, type, req_type);
if (new_type) if (new_type)
*new_type = type; *new_type = type;
...@@ -451,9 +453,9 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type, ...@@ -451,9 +453,9 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type,
err = rbt_memtype_check_insert(new, new_type); err = rbt_memtype_check_insert(new, new_type);
if (err) { if (err) {
printk(KERN_INFO "reserve_memtype failed [mem %#010Lx-%#010Lx], track %s, req %s\n", pr_info("x86/PAT: reserve_memtype failed [mem %#010Lx-%#010Lx], track %s, req %s\n",
start, end - 1, start, end - 1,
cattr_name(new->type), cattr_name(req_type)); cattr_name(new->type), cattr_name(req_type));
kfree(new); kfree(new);
spin_unlock(&memtype_lock); spin_unlock(&memtype_lock);
...@@ -497,8 +499,8 @@ int free_memtype(u64 start, u64 end) ...@@ -497,8 +499,8 @@ int free_memtype(u64 start, u64 end)
spin_unlock(&memtype_lock); spin_unlock(&memtype_lock);
if (!entry) { if (!entry) {
printk(KERN_INFO "%s:%d freeing invalid memtype [mem %#010Lx-%#010Lx]\n", pr_info("x86/PAT: %s:%d freeing invalid memtype [mem %#010Lx-%#010Lx]\n",
current->comm, current->pid, start, end - 1); current->comm, current->pid, start, end - 1);
return -EINVAL; return -EINVAL;
} }
...@@ -628,8 +630,8 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size) ...@@ -628,8 +630,8 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
while (cursor < to) { while (cursor < to) {
if (!devmem_is_allowed(pfn)) { if (!devmem_is_allowed(pfn)) {
printk(KERN_INFO "Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n", pr_info("x86/PAT: Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n",
current->comm, from, to - 1); current->comm, from, to - 1);
return 0; return 0;
} }
cursor += PAGE_SIZE; cursor += PAGE_SIZE;
...@@ -698,8 +700,7 @@ int kernel_map_sync_memtype(u64 base, unsigned long size, ...@@ -698,8 +700,7 @@ int kernel_map_sync_memtype(u64 base, unsigned long size,
size; size;
if (ioremap_change_attr((unsigned long)__va(base), id_sz, pcm) < 0) { if (ioremap_change_attr((unsigned long)__va(base), id_sz, pcm) < 0) {
printk(KERN_INFO "%s:%d ioremap_change_attr failed %s " pr_info("x86/PAT: %s:%d ioremap_change_attr failed %s for [mem %#010Lx-%#010Lx]\n",
"for [mem %#010Lx-%#010Lx]\n",
current->comm, current->pid, current->comm, current->pid,
cattr_name(pcm), cattr_name(pcm),
base, (unsigned long long)(base + size-1)); 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, ...@@ -734,7 +735,7 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
pcm = lookup_memtype(paddr); pcm = lookup_memtype(paddr);
if (want_pcm != pcm) { if (want_pcm != pcm) {
printk(KERN_WARNING "%s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n", pr_warn("x86/PAT: %s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n",
current->comm, current->pid, current->comm, current->pid,
cattr_name(want_pcm), cattr_name(want_pcm),
(unsigned long long)paddr, (unsigned long long)paddr,
...@@ -755,13 +756,12 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot, ...@@ -755,13 +756,12 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
if (strict_prot || if (strict_prot ||
!is_new_memtype_allowed(paddr, size, want_pcm, pcm)) { !is_new_memtype_allowed(paddr, size, want_pcm, pcm)) {
free_memtype(paddr, paddr + size); free_memtype(paddr, paddr + size);
printk(KERN_ERR "%s:%d map pfn expected mapping type %s" pr_err("x86/PAT: %s:%d map pfn expected mapping type %s for [mem %#010Lx-%#010Lx], got %s\n",
" for [mem %#010Lx-%#010Lx], got %s\n", current->comm, current->pid,
current->comm, current->pid, cattr_name(want_pcm),
cattr_name(want_pcm), (unsigned long long)paddr,
(unsigned long long)paddr, (unsigned long long)(paddr + size - 1),
(unsigned long long)(paddr + size - 1), cattr_name(pcm));
cattr_name(pcm));
return -EINVAL; return -EINVAL;
} }
/* /*
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
extern int pat_debug_enable; extern int pat_debug_enable;
#define dprintk(fmt, arg...) \ #define dprintk(fmt, arg...) \
do { if (pat_debug_enable) printk(KERN_INFO fmt, ##arg); } while (0) do { if (pat_debug_enable) pr_info("x86/PAT: " fmt, ##arg); } while (0)
struct memtype { struct memtype {
u64 start; u64 start;
......
...@@ -160,9 +160,9 @@ static int memtype_rb_check_conflict(struct rb_root *root, ...@@ -160,9 +160,9 @@ static int memtype_rb_check_conflict(struct rb_root *root,
return 0; return 0;
failure: failure:
printk(KERN_INFO "%s:%d conflicting memory types " pr_info("x86/PAT: %s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
"%Lx-%Lx %s<->%s\n", current->comm, current->pid, start, current->comm, current->pid, start, end,
end, cattr_name(found_type), cattr_name(match->type)); cattr_name(found_type), cattr_name(match->type));
return -EBUSY; return -EBUSY;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment