-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlinux-uek5-v4.14.35-1902.304.6.4-kvm.patch
104 lines (97 loc) · 3.44 KB
/
linux-uek5-v4.14.35-1902.304.6.4-kvm.patch
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From b4aafea9a9727da3912de3389df40b4c346ca51c Mon Sep 17 00:00:00 2001
From: Dongli Zhang <dongli.zhang0129@gmail.com>
Date: Fri, 12 Feb 2021 15:10:13 -0800
Subject: [PATCH 1/1] linux-uek5-v4.14.35-1902.304.6.4-kvm
Signed-off-by: Dongli Zhang <dongli.zhang0129@gmail.com>
---
arch/x86/kernel/process.c | 6 ++++++
arch/x86/kernel/smpboot.c | 12 ++++++++++++
include/linux/cpumask.h | 9 +++++++++
kernel/smp.c | 3 +++
4 files changed, 30 insertions(+)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 84f90f22f869..c3760b358caa 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -582,6 +582,12 @@ bool xen_set_default_idle(void)
}
#endif
+/*
+ * called by:
+ * - arch/x86/kernel/reboot.c|715| <<native_machine_halt>> stop_this_cpu(NULL);
+ * - arch/x86/kernel/smp.c|167| <<smp_stop_nmi_callback>> stop_this_cpu(NULL);
+ * - arch/x86/kernel/smp.c|180| <<smp_reboot_interrupt>> stop_this_cpu(NULL);
+ */
void stop_this_cpu(void *dummy)
{
local_irq_disable();
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 8069451df9ba..e25a355b7335 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -215,6 +215,10 @@ static int enable_start_cpu0;
/*
* Activate a secondary processor.
*/
+/*
+ * 在以下使用start_secondary():
+ * - arch/x86/kernel/smpboot.c|988| <<do_boot_cpu>> initial_code = (unsigned long )start_secondary;
+ */
static void notrace start_secondary(void *unused)
{
/*
@@ -972,6 +976,10 @@ void common_cpu_up(unsigned int cpu, struct task_struct *idle)
* Returns zero if CPU booted OK, else error code from
* ->wakeup_secondary_cpu.
*/
+/*
+ * called by:
+ * - arch/x86/kernel/smpboot.c|1126| <<native_cpu_up>> err = do_boot_cpu(apicid, cpu, tidle, &cpu0_nmi_registered);
+ */
static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle,
int *cpu0_nmi_registered)
{
@@ -1553,6 +1561,10 @@ static void remove_siblinginfo(int cpu)
recompute_smt_state();
}
+/*
+ * called by:
+ * - arch/x86/kernel/smpboot.c|1574| <<cpu_disable_common>> remove_cpu_from_maps(cpu);
+ */
static void remove_cpu_from_maps(int cpu)
{
set_cpu_online(cpu, false);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 09b8d8aaa35f..cfc2a22abe7d 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -794,6 +794,15 @@ set_cpu_present(unsigned int cpu, bool present)
cpumask_clear_cpu(cpu, &__cpu_present_mask);
}
+/*
+ * x86下的调用:
+ * - arch/x86/kernel/process.c|591| <<stop_this_cpu>> set_cpu_online(smp_processor_id(), false);
+ * - arch/x86/kernel/smpboot.c|263| <<start_secondary>> set_cpu_online(smp_processor_id(), true);
+ * - arch/x86/kernel/smpboot.c|1558| <<remove_cpu_from_maps>> set_cpu_online(cpu, false);
+ * - arch/x86/xen/smp_pv.c|80| <<cpu_bringup>> set_cpu_online(cpu, true);
+ * - arch/x86/xen/smp_pv.c|462| <<stop_self>> set_cpu_online(cpu, false);
+ * - kernel/cpu.c|2269| <<boot_cpu_init>> set_cpu_online(cpu, true);
+ */
static inline void
set_cpu_online(unsigned int cpu, bool online)
{
diff --git a/kernel/smp.c b/kernel/smp.c
index 44ce7a6dd1bc..287d1e36dff1 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -578,6 +578,9 @@ void __init smp_init(void)
}
num_nodes = num_online_nodes();
+ /*
+ * 返回cpumask_weight(cpu_online_mask)
+ */
num_cpus = num_online_cpus();
pr_info("Brought up %d node%s, %d CPU%s\n",
num_nodes, (num_nodes > 1 ? "s" : ""),
--
2.17.1