Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Luis R. Rodriguez and committed by
Ingo Molnar
9e76561f b73522e0

+26 -26
+22 -22
arch/x86/mm/pat.c
··· 33 33 #include "pat_internal.h" 34 34 #include "mm_internal.h" 35 35 36 + #undef pr_fmt 37 + #define pr_fmt(fmt) "" fmt 38 + 36 39 #ifdef CONFIG_X86_PAT 37 40 int __read_mostly pat_enabled = 1; 38 41 39 42 static inline void pat_disable(const char *reason) 40 43 { 41 44 pat_enabled = 0; 42 - printk(KERN_INFO "%s\n", reason); 45 + pr_info("x86/PAT: %s\n", reason); 43 46 } 44 47 45 48 static int __init nopat(char *str) ··· 191 188 pat_msg + 4 * i); 192 189 update_cache_mode_entry(i, cache); 193 190 } 194 - pr_info("PAT configuration [0-7]: %s\n", pat_msg); 191 + pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg); 195 192 } 196 193 197 194 #define PAT(x, y) ((u64)PAT_ ## y << ((x)*8)) ··· 214 211 * switched to PAT on the boot CPU. We have no way to 215 212 * undo PAT. 216 213 */ 217 - printk(KERN_ERR "PAT enabled, " 218 - "but not supported by secondary CPU\n"); 214 + pr_err("x86/PAT: PAT enabled, but not supported by secondary CPU\n"); 219 215 BUG(); 220 216 } 221 217 } ··· 349 347 page = pfn_to_page(pfn); 350 348 type = get_page_memtype(page); 351 349 if (type != -1) { 352 - pr_info("reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n", 350 + pr_info("x86/PAT: reserve_ram_pages_type failed [mem %#010Lx-%#010Lx], track 0x%x, req 0x%x\n", 353 351 start, end - 1, type, req_type); 354 352 if (new_type) 355 353 *new_type = type; ··· 453 451 454 452 err = rbt_memtype_check_insert(new, new_type); 455 453 if (err) { 456 - printk(KERN_INFO "reserve_memtype failed [mem %#010Lx-%#010Lx], track %s, req %s\n", 457 - start, end - 1, 458 - cattr_name(new->type), cattr_name(req_type)); 454 + pr_info("x86/PAT: reserve_memtype failed [mem %#010Lx-%#010Lx], track %s, req %s\n", 455 + start, end - 1, 456 + cattr_name(new->type), cattr_name(req_type)); 459 457 kfree(new); 460 458 spin_unlock(&memtype_lock); 461 459 ··· 499 497 spin_unlock(&memtype_lock); 500 498 501 499 if (!entry) { 502 - printk(KERN_INFO "%s:%d freeing invalid memtype [mem %#010Lx-%#010Lx]\n", 503 - current->comm, current->pid, start, end - 1); 500 + pr_info("x86/PAT: %s:%d freeing invalid memtype [mem %#010Lx-%#010Lx]\n", 501 + current->comm, current->pid, start, end - 1); 504 502 return -EINVAL; 505 503 } 506 504 ··· 630 628 631 629 while (cursor < to) { 632 630 if (!devmem_is_allowed(pfn)) { 633 - printk(KERN_INFO "Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n", 634 - current->comm, from, to - 1); 631 + pr_info("x86/PAT: Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n", 632 + current->comm, from, to - 1); 635 633 return 0; 636 634 } 637 635 cursor += PAGE_SIZE; ··· 700 698 size; 701 699 702 700 if (ioremap_change_attr((unsigned long)__va(base), id_sz, pcm) < 0) { 703 - printk(KERN_INFO "%s:%d ioremap_change_attr failed %s " 704 - "for [mem %#010Lx-%#010Lx]\n", 701 + pr_info("x86/PAT: %s:%d ioremap_change_attr failed %s for [mem %#010Lx-%#010Lx]\n", 705 702 current->comm, current->pid, 706 703 cattr_name(pcm), 707 704 base, (unsigned long long)(base + size-1)); ··· 735 734 736 735 pcm = lookup_memtype(paddr); 737 736 if (want_pcm != pcm) { 738 - printk(KERN_WARNING "%s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n", 737 + pr_warn("x86/PAT: %s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n", 739 738 current->comm, current->pid, 740 739 cattr_name(want_pcm), 741 740 (unsigned long long)paddr, ··· 756 755 if (strict_prot || 757 756 !is_new_memtype_allowed(paddr, size, want_pcm, pcm)) { 758 757 free_memtype(paddr, paddr + size); 759 - printk(KERN_ERR "%s:%d map pfn expected mapping type %s" 760 - " for [mem %#010Lx-%#010Lx], got %s\n", 761 - current->comm, current->pid, 762 - cattr_name(want_pcm), 763 - (unsigned long long)paddr, 764 - (unsigned long long)(paddr + size - 1), 765 - cattr_name(pcm)); 758 + pr_err("x86/PAT: %s:%d map pfn expected mapping type %s for [mem %#010Lx-%#010Lx], got %s\n", 759 + current->comm, current->pid, 760 + cattr_name(want_pcm), 761 + (unsigned long long)paddr, 762 + (unsigned long long)(paddr + size - 1), 763 + cattr_name(pcm)); 766 764 return -EINVAL; 767 765 } 768 766 /*
+1 -1
arch/x86/mm/pat_internal.h
··· 4 4 extern int pat_debug_enable; 5 5 6 6 #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) 8 8 9 9 struct memtype { 10 10 u64 start;
+3 -3
arch/x86/mm/pat_rbtree.c
··· 160 160 return 0; 161 161 162 162 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)); 166 166 return -EBUSY; 167 167 } 168 168