Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146072
b: refs/heads/master
c: 0f9a623
h: refs/heads/master
v: v3
  • Loading branch information
Stuart Bennett authored and Ingo Molnar committed Apr 29, 2009
1 parent 4f5f109 commit 4653aff
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46e91d00b1165b14b484aa33800e1bba0794ae1a
refs/heads/master: 0f9a623dd6c9b5b4dd00c232f29525bfc7a8ecf2
27 changes: 22 additions & 5 deletions trunk/arch/x86/mm/kmmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);

if (!ctx->active) {
pr_debug("kmmio: spurious debug trap on CPU %d.\n",
/*
* debug traps without an active context are due to either
* something external causing them (f.e. using a debugger while
* mmio tracing enabled), or erroneous behaviour
*/
pr_warning("kmmio: unexpected debug trap on CPU %d.\n",
smp_processor_id());
goto out;
}
Expand Down Expand Up @@ -529,8 +534,8 @@ void unregister_kmmio_probe(struct kmmio_probe *p)
}
EXPORT_SYMBOL(unregister_kmmio_probe);

static int kmmio_die_notifier(struct notifier_block *nb, unsigned long val,
void *args)
static int
kmmio_die_notifier(struct notifier_block *nb, unsigned long val, void *args)
{
struct die_args *arg = args;

Expand All @@ -545,11 +550,23 @@ static struct notifier_block nb_die = {
.notifier_call = kmmio_die_notifier
};

static int __init init_kmmio(void)
int kmmio_init(void)
{
int i;

for (i = 0; i < KMMIO_PAGE_TABLE_SIZE; i++)
INIT_LIST_HEAD(&kmmio_page_table[i]);

return register_die_notifier(&nb_die);
}
fs_initcall(init_kmmio); /* should be before device_initcall() */

void kmmio_cleanup(void)
{
int i;

unregister_die_notifier(&nb_die);
for (i = 0; i < KMMIO_PAGE_TABLE_SIZE; i++) {
WARN_ONCE(!list_empty(&kmmio_page_table[i]),
KERN_ERR "kmmio_page_table not empty at cleanup, any further tracing will leak memory.\n");
}
}
2 changes: 2 additions & 0 deletions trunk/arch/x86/mm/mmio-mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ void enable_mmiotrace(void)

if (nommiotrace)
pr_info(NAME "MMIO tracing disabled.\n");
kmmio_init();
enter_uniprocessor();
spin_lock_irq(&trace_lock);
atomic_inc(&mmiotrace_enabled);
Expand All @@ -473,6 +474,7 @@ void disable_mmiotrace(void)

clear_trace_list(); /* guarantees: no more kmmio callbacks */
leave_uniprocessor();
kmmio_cleanup();
pr_info(NAME "disabled.\n");
out:
mutex_unlock(&mmiotrace_mutex);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/mmiotrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ extern unsigned int kmmio_count;

extern int register_kmmio_probe(struct kmmio_probe *p);
extern void unregister_kmmio_probe(struct kmmio_probe *p);
extern int kmmio_init(void);
extern void kmmio_cleanup(void);

#ifdef CONFIG_MMIOTRACE
/* kmmio is active by some kmmio_probes? */
Expand Down

0 comments on commit 4653aff

Please sign in to comment.