Commit 3a0340be authored by Joe Perches's avatar Joe Perches Committed by Ingo Molnar

x86: mmio-mod.c: Use pr_fmt

- Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 - Remove #define NAME
 - Remove NAME from pr_<level>
Signed-off-by: default avatarJoe Perches <joe@perches.com>
LKML-Reference: <009cb214c45ef932df0242856228f4739cc91408.1260383912.git.joe@perches.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 1bd591a5
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
* *
* Derived from the read-mod example from relay-examples by Tom Zanussi. * Derived from the read-mod example from relay-examples by Tom Zanussi.
*/ */
#define pr_fmt(fmt) "mmiotrace: "
#define DEBUG 1 #define DEBUG 1
#include <linux/module.h> #include <linux/module.h>
...@@ -36,8 +39,6 @@ ...@@ -36,8 +39,6 @@
#include "pf_in.h" #include "pf_in.h"
#define NAME "mmiotrace: "
struct trap_reason { struct trap_reason {
unsigned long addr; unsigned long addr;
unsigned long ip; unsigned long ip;
...@@ -96,17 +97,18 @@ static void print_pte(unsigned long address) ...@@ -96,17 +97,18 @@ static void print_pte(unsigned long address)
pte_t *pte = lookup_address(address, &level); pte_t *pte = lookup_address(address, &level);
if (!pte) { if (!pte) {
pr_err(NAME "Error in %s: no pte for page 0x%08lx\n", pr_err("Error in %s: no pte for page 0x%08lx\n",
__func__, address); __func__, address);
return; return;
} }
if (level == PG_LEVEL_2M) { if (level == PG_LEVEL_2M) {
pr_emerg(NAME "4MB pages are not currently supported: " pr_emerg("4MB pages are not currently supported: 0x%08lx\n",
"0x%08lx\n", address); address);
BUG(); BUG();
} }
pr_info(NAME "pte for 0x%lx: 0x%llx 0x%llx\n", address, pr_info("pte for 0x%lx: 0x%llx 0x%llx\n",
address,
(unsigned long long)pte_val(*pte), (unsigned long long)pte_val(*pte),
(unsigned long long)pte_val(*pte) & _PAGE_PRESENT); (unsigned long long)pte_val(*pte) & _PAGE_PRESENT);
} }
...@@ -118,8 +120,7 @@ static void print_pte(unsigned long address) ...@@ -118,8 +120,7 @@ static void print_pte(unsigned long address)
static void die_kmmio_nesting_error(struct pt_regs *regs, unsigned long addr) static void die_kmmio_nesting_error(struct pt_regs *regs, unsigned long addr)
{ {
const struct trap_reason *my_reason = &get_cpu_var(pf_reason); const struct trap_reason *my_reason = &get_cpu_var(pf_reason);
pr_emerg(NAME "unexpected fault for address: 0x%08lx, " pr_emerg("unexpected fault for address: 0x%08lx, last fault for address: 0x%08lx\n",
"last fault for address: 0x%08lx\n",
addr, my_reason->addr); addr, my_reason->addr);
print_pte(addr); print_pte(addr);
print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip); print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip);
...@@ -213,7 +214,7 @@ static void post(struct kmmio_probe *p, unsigned long condition, ...@@ -213,7 +214,7 @@ static void post(struct kmmio_probe *p, unsigned long condition,
/* this should always return the active_trace count to 0 */ /* this should always return the active_trace count to 0 */
my_reason->active_traces--; my_reason->active_traces--;
if (my_reason->active_traces) { if (my_reason->active_traces) {
pr_emerg(NAME "unexpected post handler"); pr_emerg("unexpected post handler");
BUG(); BUG();
} }
...@@ -244,7 +245,7 @@ static void ioremap_trace_core(resource_size_t offset, unsigned long size, ...@@ -244,7 +245,7 @@ static void ioremap_trace_core(resource_size_t offset, unsigned long size,
}; };
if (!trace) { if (!trace) {
pr_err(NAME "kmalloc failed in ioremap\n"); pr_err("kmalloc failed in ioremap\n");
return; return;
} }
...@@ -282,7 +283,7 @@ void mmiotrace_ioremap(resource_size_t offset, unsigned long size, ...@@ -282,7 +283,7 @@ void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
if (!is_enabled()) /* recheck and proper locking in *_core() */ if (!is_enabled()) /* recheck and proper locking in *_core() */
return; return;
pr_debug(NAME "ioremap_*(0x%llx, 0x%lx) = %p\n", pr_debug("ioremap_*(0x%llx, 0x%lx) = %p\n",
(unsigned long long)offset, size, addr); (unsigned long long)offset, size, addr);
if ((filter_offset) && (offset != filter_offset)) if ((filter_offset) && (offset != filter_offset))
return; return;
...@@ -301,7 +302,7 @@ static void iounmap_trace_core(volatile void __iomem *addr) ...@@ -301,7 +302,7 @@ static void iounmap_trace_core(volatile void __iomem *addr)
struct remap_trace *tmp; struct remap_trace *tmp;
struct remap_trace *found_trace = NULL; struct remap_trace *found_trace = NULL;
pr_debug(NAME "Unmapping %p.\n", addr); pr_debug("Unmapping %p.\n", addr);
spin_lock_irq(&trace_lock); spin_lock_irq(&trace_lock);
if (!is_enabled()) if (!is_enabled())
...@@ -363,8 +364,7 @@ static void clear_trace_list(void) ...@@ -363,8 +364,7 @@ static void clear_trace_list(void)
* Caller also ensures is_enabled() cannot change. * Caller also ensures is_enabled() cannot change.
*/ */
list_for_each_entry(trace, &trace_list, list) { list_for_each_entry(trace, &trace_list, list) {
pr_notice(NAME "purging non-iounmapped " pr_notice("purging non-iounmapped trace @0x%08lx, size 0x%lx.\n",
"trace @0x%08lx, size 0x%lx.\n",
trace->probe.addr, trace->probe.len); trace->probe.addr, trace->probe.len);
if (!nommiotrace) if (!nommiotrace)
unregister_kmmio_probe(&trace->probe); unregister_kmmio_probe(&trace->probe);
...@@ -387,7 +387,7 @@ static void enter_uniprocessor(void) ...@@ -387,7 +387,7 @@ static void enter_uniprocessor(void)
if (downed_cpus == NULL && if (downed_cpus == NULL &&
!alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) { !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
pr_notice(NAME "Failed to allocate mask\n"); pr_notice("Failed to allocate mask\n");
goto out; goto out;
} }
...@@ -395,20 +395,19 @@ static void enter_uniprocessor(void) ...@@ -395,20 +395,19 @@ static void enter_uniprocessor(void)
cpumask_copy(downed_cpus, cpu_online_mask); cpumask_copy(downed_cpus, cpu_online_mask);
cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus); cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
if (num_online_cpus() > 1) if (num_online_cpus() > 1)
pr_notice(NAME "Disabling non-boot CPUs...\n"); pr_notice("Disabling non-boot CPUs...\n");
put_online_cpus(); put_online_cpus();
for_each_cpu(cpu, downed_cpus) { for_each_cpu(cpu, downed_cpus) {
err = cpu_down(cpu); err = cpu_down(cpu);
if (!err) if (!err)
pr_info(NAME "CPU%d is down.\n", cpu); pr_info("CPU%d is down.\n", cpu);
else else
pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err); pr_err("Error taking CPU%d down: %d\n", cpu, err);
} }
out: out:
if (num_online_cpus() > 1) if (num_online_cpus() > 1)
pr_warning(NAME "multiple CPUs still online, " pr_warning("multiple CPUs still online, may miss events.\n");
"may miss events.\n");
} }
/* __ref because leave_uniprocessor calls cpu_up which is __cpuinit, /* __ref because leave_uniprocessor calls cpu_up which is __cpuinit,
...@@ -420,13 +419,13 @@ static void __ref leave_uniprocessor(void) ...@@ -420,13 +419,13 @@ static void __ref leave_uniprocessor(void)
if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0) if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
return; return;
pr_notice(NAME "Re-enabling CPUs...\n"); pr_notice("Re-enabling CPUs...\n");
for_each_cpu(cpu, downed_cpus) { for_each_cpu(cpu, downed_cpus) {
err = cpu_up(cpu); err = cpu_up(cpu);
if (!err) if (!err)
pr_info(NAME "enabled CPU%d.\n", cpu); pr_info("enabled CPU%d.\n", cpu);
else else
pr_err(NAME "cannot re-enable CPU%d: %d\n", cpu, err); pr_err("cannot re-enable CPU%d: %d\n", cpu, err);
} }
} }
...@@ -434,7 +433,7 @@ static void __ref leave_uniprocessor(void) ...@@ -434,7 +433,7 @@ static void __ref leave_uniprocessor(void)
static void enter_uniprocessor(void) static void enter_uniprocessor(void)
{ {
if (num_online_cpus() > 1) if (num_online_cpus() > 1)
pr_warning(NAME "multiple CPUs are online, may miss events. " pr_warning("multiple CPUs are online, may miss events. "
"Suggest booting with maxcpus=1 kernel argument.\n"); "Suggest booting with maxcpus=1 kernel argument.\n");
} }
...@@ -450,13 +449,13 @@ void enable_mmiotrace(void) ...@@ -450,13 +449,13 @@ void enable_mmiotrace(void)
goto out; goto out;
if (nommiotrace) if (nommiotrace)
pr_info(NAME "MMIO tracing disabled.\n"); pr_info("MMIO tracing disabled.\n");
kmmio_init(); kmmio_init();
enter_uniprocessor(); enter_uniprocessor();
spin_lock_irq(&trace_lock); spin_lock_irq(&trace_lock);
atomic_inc(&mmiotrace_enabled); atomic_inc(&mmiotrace_enabled);
spin_unlock_irq(&trace_lock); spin_unlock_irq(&trace_lock);
pr_info(NAME "enabled.\n"); pr_info("enabled.\n");
out: out:
mutex_unlock(&mmiotrace_mutex); mutex_unlock(&mmiotrace_mutex);
} }
...@@ -475,7 +474,7 @@ void disable_mmiotrace(void) ...@@ -475,7 +474,7 @@ void disable_mmiotrace(void)
clear_trace_list(); /* guarantees: no more kmmio callbacks */ clear_trace_list(); /* guarantees: no more kmmio callbacks */
leave_uniprocessor(); leave_uniprocessor();
kmmio_cleanup(); kmmio_cleanup();
pr_info(NAME "disabled.\n"); pr_info("disabled.\n");
out: out:
mutex_unlock(&mmiotrace_mutex); mutex_unlock(&mmiotrace_mutex);
} }
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