Commit faa97abe authored by Pekka Enberg's avatar Pekka Enberg

kmemtrace: allow kmemtrace to be enabled after boot

The kmemtrace_init() function returns early if kmemtrace is disabled at boot
causing kmemtrace_setup_late() to also bail out on NULL channel. This has the
unfortunate side effect that none of the debugfs files needed to enable
kmemtrace after boot are created.

Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent 2e67624c
...@@ -307,29 +307,29 @@ early_param("kmemtrace.subbufs", kmemtrace_set_subbufs); ...@@ -307,29 +307,29 @@ early_param("kmemtrace.subbufs", kmemtrace_set_subbufs);
void kmemtrace_init(void) void kmemtrace_init(void)
{ {
if (!kmemtrace_enabled)
return;
if (!kmemtrace_n_subbufs) if (!kmemtrace_n_subbufs)
kmemtrace_n_subbufs = KMEMTRACE_DEF_N_SUBBUFS; kmemtrace_n_subbufs = KMEMTRACE_DEF_N_SUBBUFS;
kmemtrace_chan = relay_open(NULL, NULL, KMEMTRACE_SUBBUF_SIZE, kmemtrace_chan = relay_open(NULL, NULL, KMEMTRACE_SUBBUF_SIZE,
kmemtrace_n_subbufs, &relay_callbacks, kmemtrace_n_subbufs, &relay_callbacks,
NULL); NULL);
if (unlikely(!kmemtrace_chan)) { if (!kmemtrace_chan) {
printk(KERN_ERR "kmemtrace: could not open relay channel.\n"); printk(KERN_ERR "kmemtrace: could not open relay channel.\n");
return; return;
} }
if (unlikely(kmemtrace_start_probes())) if (!kmemtrace_enabled) {
goto probe_fail; printk(KERN_INFO "kmemtrace: disabled. Pass "
"kemtrace.enable=yes as kernel parameter for "
printk(KERN_INFO "kmemtrace: early init successful.\n"); "boot-time tracing.");
return; return;
}
probe_fail: if (kmemtrace_start_probes()) {
printk(KERN_ERR "kmemtrace: could not register marker probes!\n"); printk(KERN_ERR "kmemtrace: could not register marker probes!\n");
kmemtrace_cleanup(); kmemtrace_cleanup();
return;
}
printk(KERN_INFO "kmemtrace: enabled.\n");
} }
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