Commit 6a5c083d authored by Thomas Renninger's avatar Thomas Renninger Committed by Greg Kroah-Hartman

Dynamic Debug: Initialize dynamic debug earlier via arch_initcall

Having the ddebug_query= boot parameter it makes sense to set up
dynamic debug as soon as possible.

I expect sysfs files cannot be set up via an arch_initcall, because
this one is even before fs_initcall. Therefore I splitted the
dynamic_debug_init function into an early one and a later one providing
/sys/../dynamic_debug/control file.

Possibly dynamic_debug can be initialized even earlier, not sure whether
this still makes sense then. I picked up arch_initcall as it covers
quite a lot already.

Dynamic debug needs to allocate memory, therefore it's not easily possible to
set it up even before the command line gets parsed.
Therefore the boot param query string is stored in a temp string which is
applied when dynamic debug gets set up.

This has been tested with ddebug_query="file ec.c +p"
and I could retrieve pr_debug() messages early at boot during ACPI setup:
ACPI: EC: Look up EC in DSDT
ACPI: EC: ---> status = 0x08
ACPI: EC: transaction start
ACPI: EC: <--- command = 0x80
ACPI: EC: ~~~> interrupt
ACPI: EC: ---> status = 0x08
ACPI: EC: <--- data = 0xa4
...
ACPI: Interpreter enabled
ACPI: (supports S0 S3 S4 S5)
ACPI: Using IOAPIC for interrupt routing
ACPI: EC: ---> status = 0x00
ACPI: EC: transaction start
ACPI: EC: <--- command = 0x80
Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
Acked-by: jbaron@redhat.com
Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
CC: linux-acpi@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a648ec05
...@@ -748,13 +748,14 @@ static void ddebug_remove_all_tables(void) ...@@ -748,13 +748,14 @@ static void ddebug_remove_all_tables(void)
mutex_unlock(&ddebug_lock); mutex_unlock(&ddebug_lock);
} }
static int __init dynamic_debug_init(void) static __initdata int ddebug_init_success;
static int __init dynamic_debug_init_debugfs(void)
{ {
struct dentry *dir, *file; struct dentry *dir, *file;
struct _ddebug *iter, *iter_start;
const char *modname = NULL; if (!ddebug_init_success)
int ret = 0; return -ENODEV;
int n = 0;
dir = debugfs_create_dir("dynamic_debug", NULL); dir = debugfs_create_dir("dynamic_debug", NULL);
if (!dir) if (!dir)
...@@ -765,6 +766,16 @@ static int __init dynamic_debug_init(void) ...@@ -765,6 +766,16 @@ static int __init dynamic_debug_init(void)
debugfs_remove(dir); debugfs_remove(dir);
return -ENOMEM; return -ENOMEM;
} }
return 0;
}
static int __init dynamic_debug_init(void)
{
struct _ddebug *iter, *iter_start;
const char *modname = NULL;
int ret = 0;
int n = 0;
if (__start___verbose != __stop___verbose) { if (__start___verbose != __stop___verbose) {
iter = __start___verbose; iter = __start___verbose;
modname = iter->modname; modname = iter->modname;
...@@ -795,11 +806,13 @@ static int __init dynamic_debug_init(void) ...@@ -795,11 +806,13 @@ static int __init dynamic_debug_init(void)
} }
out_free: out_free:
if (ret) { if (ret)
ddebug_remove_all_tables(); ddebug_remove_all_tables();
debugfs_remove(dir); else
debugfs_remove(file); ddebug_init_success = 1;
}
return 0; return 0;
} }
module_init(dynamic_debug_init); /* Allow early initialization for boot messages via boot param */
arch_initcall(dynamic_debug_init);
/* Debugfs setup must be done later */
module_init(dynamic_debug_init_debugfs);
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