aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2010-08-06 10:11:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:16:42 -0400
commit6a5c083de2f5fbf89a4b0a251be2c2205434d7ea (patch)
tree72f738d63e35749da1d79f534494cff10e644208 /lib
parenta648ec05bb950fae2f35d0490ddd6cf15010af72 (diff)
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: Thomas Renninger <trenn@suse.de> Acked-by: jbaron@redhat.com Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> CC: linux-acpi@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/dynamic_debug.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 44ce66bdb211..a687d902daab 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -748,13 +748,14 @@ static void ddebug_remove_all_tables(void)
748 mutex_unlock(&ddebug_lock); 748 mutex_unlock(&ddebug_lock);
749} 749}
750 750
751static int __init dynamic_debug_init(void) 751static __initdata int ddebug_init_success;
752
753static int __init dynamic_debug_init_debugfs(void)
752{ 754{
753 struct dentry *dir, *file; 755 struct dentry *dir, *file;
754 struct _ddebug *iter, *iter_start; 756
755 const char *modname = NULL; 757 if (!ddebug_init_success)
756 int ret = 0; 758 return -ENODEV;
757 int n = 0;
758 759
759 dir = debugfs_create_dir("dynamic_debug", NULL); 760 dir = debugfs_create_dir("dynamic_debug", NULL);
760 if (!dir) 761 if (!dir)
@@ -765,6 +766,16 @@ static int __init dynamic_debug_init(void)
765 debugfs_remove(dir); 766 debugfs_remove(dir);
766 return -ENOMEM; 767 return -ENOMEM;
767 } 768 }
769 return 0;
770}
771
772static int __init dynamic_debug_init(void)
773{
774 struct _ddebug *iter, *iter_start;
775 const char *modname = NULL;
776 int ret = 0;
777 int n = 0;
778
768 if (__start___verbose != __stop___verbose) { 779 if (__start___verbose != __stop___verbose) {
769 iter = __start___verbose; 780 iter = __start___verbose;
770 modname = iter->modname; 781 modname = iter->modname;
@@ -795,11 +806,13 @@ static int __init dynamic_debug_init(void)
795 } 806 }
796 807
797out_free: 808out_free:
798 if (ret) { 809 if (ret)
799 ddebug_remove_all_tables(); 810 ddebug_remove_all_tables();
800 debugfs_remove(dir); 811 else
801 debugfs_remove(file); 812 ddebug_init_success = 1;
802 }
803 return 0; 813 return 0;
804} 814}
805module_init(dynamic_debug_init); 815/* Allow early initialization for boot messages via boot param */
816arch_initcall(dynamic_debug_init);
817/* Debugfs setup must be done later */
818module_init(dynamic_debug_init_debugfs);