|
@@ -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);
|
|
struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);
|
|
|
|
|
|
if (!ctx->active) {
|
|
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());
|
|
smp_processor_id());
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
@@ -529,8 +534,8 @@ void unregister_kmmio_probe(struct kmmio_probe *p)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(unregister_kmmio_probe);
|
|
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;
|
|
struct die_args *arg = args;
|
|
|
|
|
|
@@ -545,11 +550,23 @@ static struct notifier_block nb_die = {
|
|
.notifier_call = kmmio_die_notifier
|
|
.notifier_call = kmmio_die_notifier
|
|
};
|
|
};
|
|
|
|
|
|
-static int __init init_kmmio(void)
|
|
|
|
|
|
+int kmmio_init(void)
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
|
|
+
|
|
for (i = 0; i < KMMIO_PAGE_TABLE_SIZE; i++)
|
|
for (i = 0; i < KMMIO_PAGE_TABLE_SIZE; i++)
|
|
INIT_LIST_HEAD(&kmmio_page_table[i]);
|
|
INIT_LIST_HEAD(&kmmio_page_table[i]);
|
|
|
|
+
|
|
return register_die_notifier(&nb_die);
|
|
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");
|
|
|
|
+ }
|
|
|
|
+}
|