summaryrefslogtreecommitdiffstats
path: root/test-console-blocked.patch
blob: 58ab8117058ff79c8fe6a1a8250548b0b65a7e63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
diff --git a/init/main.c b/init/main.c
index b5cc0a7..640623a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -68,6 +68,8 @@
 #include <linux/shmem_fs.h>
 #include <linux/slab.h>
 #include <linux/perf_event.h>
+#include <linux/console.h>
+#include <linux/mm.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -462,6 +464,16 @@ static void __init mm_init(void)
 	vmalloc_init();
 }
 
+static void contprint(void *dummy)
+{
+	int i;
+
+	printk("%i-<", smp_processor_id());
+	for (i = 0; i < 10; i++)
+		printk("%i-%i ", smp_processor_id(), i);
+	printk("%i->\n", smp_processor_id());
+}
+
 asmlinkage void __init start_kernel(void)
 {
 	char * command_line;
@@ -562,6 +574,33 @@ asmlinkage void __init start_kernel(void)
 
 	kmem_cache_init_late();
 
+	console_lock();
+	smp_call_function_single(0, contprint, NULL, 1);
+	smp_call_function_single(1, contprint, NULL, 1);
+	smp_call_function_single(0, contprint, NULL, 1);
+	smp_call_function_single(1, contprint, NULL, 1);
+
+	show_free_areas(0);
+
+	{
+		int i;
+
+		pr_info("[");
+		for (i = 0; i < 4; i++)
+			pr_cont("%i ", i);
+		pr_cont("]\n");
+	}
+	console_unlock();
+
+	{
+		int i;
+
+		pr_info("[");
+		for (i = 0; i < 4; i++)
+			pr_cont("%i ", i);
+		pr_cont("]\n");
+	}
+
 	/*
 	 * HACK ALERT! This is early. We're enabling the console before
 	 * we've done PCI setups etc, and console_init() must be aware of
@@ -864,6 +903,13 @@ static int __init kernel_init(void * unused)
 
 	do_basic_setup();
 
+	console_lock();
+	smp_call_function_single(0, contprint, NULL, 1);
+	smp_call_function_single(1, contprint, NULL, 1);
+	smp_call_function_single(0, contprint, NULL, 1);
+	smp_call_function_single(1, contprint, NULL, 1);
+	console_unlock();
+
 	/* Open the /dev/console on the rootfs, this should never fail */
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");