#include <linux/gfp.h>
#include <linux/percpu.h>
#include <linux/kmod.h>
+#include <linux/vmalloc.h>
#include <linux/kernel_stat.h>
#include <linux/start_kernel.h>
#include <linux/security.h>
#include <linux/key.h>
#include <linux/unwind.h>
#include <linux/buffer_head.h>
+#include <linux/page_cgroup.h>
#include <linux/debug_locks.h>
#include <linux/debugobjects.h>
#include <linux/lockdep.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/idr.h>
+#include <linux/ftrace.h>
#include <asm/io.h>
#include <asm/bugs.h>
static void __init setup_per_cpu_areas(void)
{
- unsigned long size, i, old_size;
+ unsigned long size, i;
char *ptr;
unsigned long nr_possible_cpus = num_possible_cpus();
- unsigned long align = 1;
- unsigned da_size;
/* Copy section for each CPU (we discard the original) */
- old_size = PERCPU_ENOUGH_ROOM;
- da_size = per_cpu_dyn_array_size(&align);
- align = max_t(unsigned long, PAGE_SIZE, align);
- size = ALIGN(old_size + da_size, align);
+ size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE);
ptr = alloc_bootmem_pages(size * nr_possible_cpus);
for_each_possible_cpu(i) {
__per_cpu_offset[i] = ptr - __per_cpu_start;
memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
- per_cpu_alloc_dyn_array(i, ptr + old_size);
ptr += size;
}
}
{
}
-void pre_alloc_dyn_array(void)
-{
-#ifdef CONFIG_HAVE_DYN_ARRAY
- unsigned long total_size = 0, size, phys;
- unsigned long max_align = 1;
- struct dyn_array **daa;
- char *ptr;
-
- /* get the total size at first */
- for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) {
- struct dyn_array *da = *daa;
-
- size = da->size * (*da->nr);
- print_fn_descriptor_symbol("dyn_array %s ", da->name);
- printk(KERN_CONT "size:%#lx nr:%d align:%#lx\n",
- da->size, *da->nr, da->align);
- total_size += roundup(size, da->align);
- if (da->align > max_align)
- max_align = da->align;
- }
- if (total_size)
- printk(KERN_DEBUG "dyn_array total_size: %#lx\n",
- total_size);
- else
- return;
-
- /* allocate them all together */
- max_align = max_t(unsigned long, max_align, PAGE_SIZE);
- ptr = __alloc_bootmem_nopanic(total_size, max_align, 0);
- if (!ptr)
- panic("Can not alloc dyn_alloc\n");
-
- phys = virt_to_phys(ptr);
- for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) {
- struct dyn_array *da = *daa;
-
- size = da->size * (*da->nr);
- print_fn_descriptor_symbol("dyn_array %s ", da->name);
-
- phys = roundup(phys, da->align);
- *da->name = phys_to_virt(phys);
- printk(KERN_CONT " ==> [%#lx - %#lx]\n", phys, phys + size);
-
- phys += size;
-
- if (da->init_work)
- da->init_work(da);
- }
-#endif
-}
-
-unsigned long per_cpu_dyn_array_size(unsigned long *align)
-{
- unsigned long total_size = 0;
-#ifdef CONFIG_HAVE_DYN_ARRAY
- unsigned long size;
- struct dyn_array **daa;
- unsigned max_align = 1;
-
- for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
- struct dyn_array *da = *daa;
-
- size = da->size * (*da->nr);
- print_fn_descriptor_symbol("per_cpu_dyn_array %s ", da->name);
- printk(KERN_CONT "size:%#lx nr:%d align:%#lx\n",
- da->size, *da->nr, da->align);
- total_size += roundup(size, da->align);
- if (da->align > max_align)
- max_align = da->align;
- }
- if (total_size) {
- printk(KERN_DEBUG "per_cpu_dyn_array total_size: %#lx\n",
- total_size);
- *align = max_align;
- }
-#endif
- return total_size;
-}
-
-void per_cpu_alloc_dyn_array(int cpu, char *ptr)
-{
-#ifdef CONFIG_HAVE_DYN_ARRAY
- unsigned long size, phys;
- struct dyn_array **daa;
- unsigned long addr;
- void **array;
-
- phys = virt_to_phys(ptr);
- for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) {
- struct dyn_array *da = *daa;
-
- size = da->size * (*da->nr);
- print_fn_descriptor_symbol("per_cpu_dyn_array %s ", da->name);
-
- phys = roundup(phys, da->align);
- addr = (unsigned long)da->name;
- addr += per_cpu_offset(cpu);
- array = (void **)addr;
- *array = phys_to_virt(phys);
- *da->name = *array; /* so init_work could use it directly */
- printk(KERN_CONT " ==> [%#lx - %#lx]\n", phys, phys + size);
-
- phys += size;
-
- if (da->init_work) {
- da->init_work(da);
- }
- }
-#endif
-}
-
asmlinkage void __init start_kernel(void)
{
char * command_line;
printk(KERN_NOTICE);
printk(linux_banner);
setup_arch(&command_line);
- pre_alloc_dyn_array();
mm_init_owner(&init_mm, &init_task);
setup_command_line(command_line);
unwind_setup();
initrd_start = 0;
}
#endif
+ vmalloc_init();
vfs_caches_init_early();
cpuset_init_early();
+ page_cgroup_init();
mem_init();
enable_debug_pagealloc();
cpu_hotplug_init();
acpi_early_init(); /* before LAPIC and SMP init */
+ ftrace_init();
+
/* Do the rest non-__init'ed, we're now alive */
rest_init();
}
static int initcall_debug;
-
-static int __init initcall_debug_setup(char *str)
-{
- initcall_debug = 1;
- return 1;
-}
-__setup("initcall_debug", initcall_debug_setup);
+core_param(initcall_debug, initcall_debug, bool, 0644);
int do_one_initcall(initcall_t fn)
{
int count = preempt_count();
- ktime_t t0, t1, delta;
+ ktime_t delta;
char msgbuf[64];
- int result;
+ struct boot_trace it;
if (initcall_debug) {
- printk("calling %pF @ %i\n", fn, task_pid_nr(current));
- t0 = ktime_get();
+ it.caller = task_pid_nr(current);
+ printk("calling %pF @ %i\n", fn, it.caller);
+ it.calltime = ktime_get();
}
- result = fn();
+ it.result = fn();
if (initcall_debug) {
- t1 = ktime_get();
- delta = ktime_sub(t1, t0);
-
- printk("initcall %pF returned %d after %Ld msecs\n",
- fn, result,
- (unsigned long long) delta.tv64 >> 20);
+ it.rettime = ktime_get();
+ delta = ktime_sub(it.rettime, it.calltime);
+ it.duration = (unsigned long long) delta.tv64 >> 10;
+ printk("initcall %pF returned %d after %Ld usecs\n", fn,
+ it.result, it.duration);
+ trace_boot(&it, fn);
}
msgbuf[0] = 0;
- if (result && result != -ENODEV && initcall_debug)
- sprintf(msgbuf, "error code %d ", result);
+ if (it.result && it.result != -ENODEV && initcall_debug)
+ sprintf(msgbuf, "error code %d ", it.result);
if (preempt_count() != count) {
strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
printk("initcall %pF returned with %s\n", fn, msgbuf);
}
- return result;
+ return it.result;
}
static void __init do_basic_setup(void)
{
rcu_init_sched(); /* needed by module_init stage. */
- /* drivers will send hotplug events */
- init_workqueues();
usermodehelper_init();
driver_init();
init_irq_proc();
cad_pid = task_pid(current);
+ init_workqueues();
+
smp_prepare_cpus(setup_max_cpus);
do_pre_smp_initcalls();
+ start_boot_trace();
smp_init();
sched_init_smp();
* we're essentially up and running. Get rid of the
* initmem segments and start the user-mode stuff..
*/
+ stop_boot_trace();
init_post();
return 0;
}