diff options
author | Vivek Goyal <vgoyal@in.ibm.com> | 2007-02-13 07:26:22 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-02-13 07:26:22 -0500 |
commit | ee5bfa642a0d4b0f6ec6200bf96e5e647f93fcdb (patch) | |
tree | ed348c3f5d940b211919bc5191cfea5ea1b5a6fa /init | |
parent | f8657e1b55901e6c227094258d1fa3642fa242bd (diff) |
[PATCH] generic: Break init() in two parts to avoid MODPOST warnings
o init() is a non __init function in .text section but it calls many
functions which are in .init.text section. Hence MODPOST generates lots
of cross reference warnings on i386 if compiled with CONFIG_RELOCATABLE=y
WARNING: vmlinux - Section mismatch: reference to .init.text:smp_prepare_cpus from .text between 'init' (at offset 0xc0101049) and 'rest_init'
WARNING: vmlinux - Section mismatch: reference to .init.text:migration_init from .text between 'init' (at offset 0xc010104e) and 'rest_init'
WARNING: vmlinux - Section mismatch: reference to .init.text:spawn_ksoftirqd from .text between 'init' (at offset 0xc0101053) and 'rest_init'
o This patch breaks down init() in two parts. One part which can go
in .init.text section and can be freed and other part which has to
be non __init(init_post()). Now init() calls init_post() and init_post()
does not call any functions present in .init sections. Hence getting
rid of warnings.
Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/init/main.c b/init/main.c index 4e9e92bb2b89..62ded9f3b393 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -727,7 +727,49 @@ static void run_init_process(char *init_filename) | |||
727 | kernel_execve(init_filename, argv_init, envp_init); | 727 | kernel_execve(init_filename, argv_init, envp_init); |
728 | } | 728 | } |
729 | 729 | ||
730 | static int init(void * unused) | 730 | /* This is a non __init function. Force it to be noinline otherwise gcc |
731 | * makes it inline to init() and it becomes part of init.text section | ||
732 | */ | ||
733 | static int noinline init_post(void) | ||
734 | { | ||
735 | free_initmem(); | ||
736 | unlock_kernel(); | ||
737 | mark_rodata_ro(); | ||
738 | system_state = SYSTEM_RUNNING; | ||
739 | numa_default_policy(); | ||
740 | |||
741 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) | ||
742 | printk(KERN_WARNING "Warning: unable to open an initial console.\n"); | ||
743 | |||
744 | (void) sys_dup(0); | ||
745 | (void) sys_dup(0); | ||
746 | |||
747 | if (ramdisk_execute_command) { | ||
748 | run_init_process(ramdisk_execute_command); | ||
749 | printk(KERN_WARNING "Failed to execute %s\n", | ||
750 | ramdisk_execute_command); | ||
751 | } | ||
752 | |||
753 | /* | ||
754 | * We try each of these until one succeeds. | ||
755 | * | ||
756 | * The Bourne shell can be used instead of init if we are | ||
757 | * trying to recover a really broken machine. | ||
758 | */ | ||
759 | if (execute_command) { | ||
760 | run_init_process(execute_command); | ||
761 | printk(KERN_WARNING "Failed to execute %s. Attempting " | ||
762 | "defaults...\n", execute_command); | ||
763 | } | ||
764 | run_init_process("/sbin/init"); | ||
765 | run_init_process("/etc/init"); | ||
766 | run_init_process("/bin/init"); | ||
767 | run_init_process("/bin/sh"); | ||
768 | |||
769 | panic("No init found. Try passing init= option to kernel."); | ||
770 | } | ||
771 | |||
772 | static int __init init(void * unused) | ||
731 | { | 773 | { |
732 | lock_kernel(); | 774 | lock_kernel(); |
733 | /* | 775 | /* |
@@ -775,39 +817,6 @@ static int init(void * unused) | |||
775 | * we're essentially up and running. Get rid of the | 817 | * we're essentially up and running. Get rid of the |
776 | * initmem segments and start the user-mode stuff.. | 818 | * initmem segments and start the user-mode stuff.. |
777 | */ | 819 | */ |
778 | free_initmem(); | 820 | init_post(); |
779 | unlock_kernel(); | 821 | return 0; |
780 | mark_rodata_ro(); | ||
781 | system_state = SYSTEM_RUNNING; | ||
782 | numa_default_policy(); | ||
783 | |||
784 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) | ||
785 | printk(KERN_WARNING "Warning: unable to open an initial console.\n"); | ||
786 | |||
787 | (void) sys_dup(0); | ||
788 | (void) sys_dup(0); | ||
789 | |||
790 | if (ramdisk_execute_command) { | ||
791 | run_init_process(ramdisk_execute_command); | ||
792 | printk(KERN_WARNING "Failed to execute %s\n", | ||
793 | ramdisk_execute_command); | ||
794 | } | ||
795 | |||
796 | /* | ||
797 | * We try each of these until one succeeds. | ||
798 | * | ||
799 | * The Bourne shell can be used instead of init if we are | ||
800 | * trying to recover a really broken machine. | ||
801 | */ | ||
802 | if (execute_command) { | ||
803 | run_init_process(execute_command); | ||
804 | printk(KERN_WARNING "Failed to execute %s. Attempting " | ||
805 | "defaults...\n", execute_command); | ||
806 | } | ||
807 | run_init_process("/sbin/init"); | ||
808 | run_init_process("/etc/init"); | ||
809 | run_init_process("/bin/init"); | ||
810 | run_init_process("/bin/sh"); | ||
811 | |||
812 | panic("No init found. Try passing init= option to kernel."); | ||
813 | } | 822 | } |