aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 21:23:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 21:23:19 -0500
commit7d58e1c9059eefe0066c5acf2ffa582f6f0180e3 (patch)
tree265d08c51c7f303f49b792b2362ee5f943e1c2e2
parent2bcc673101268dc50e52b83226c5bbf38391e16d (diff)
parentf4c09f87adfe31587aa4b2aea2cb2dbde2150f54 (diff)
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull smp/hotplug updates from Thomas Gleixner: "No functional changes, just removal of obsolete and outdated defines, macros and documentation" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: cpu/hotplug: Get rid of CPU hotplug notifier leftovers cpu/hotplug: Remove obsolete notifier macros
-rw-r--r--Documentation/fault-injection/notifier-error-inject.txt30
-rw-r--r--Documentation/power/suspend-and-cpuhotplug.txt9
-rw-r--r--include/linux/cpu.h30
3 files changed, 14 insertions, 55 deletions
diff --git a/Documentation/fault-injection/notifier-error-inject.txt b/Documentation/fault-injection/notifier-error-inject.txt
index 83d3f4e43e91..e861d761de24 100644
--- a/Documentation/fault-injection/notifier-error-inject.txt
+++ b/Documentation/fault-injection/notifier-error-inject.txt
@@ -6,41 +6,11 @@ specified notifier chain callbacks. It is useful to test the error handling of
6notifier call chain failures which is rarely executed. There are kernel 6notifier call chain failures which is rarely executed. There are kernel
7modules that can be used to test the following notifiers. 7modules that can be used to test the following notifiers.
8 8
9 * CPU notifier
10 * PM notifier 9 * PM notifier
11 * Memory hotplug notifier 10 * Memory hotplug notifier
12 * powerpc pSeries reconfig notifier 11 * powerpc pSeries reconfig notifier
13 * Netdevice notifier 12 * Netdevice notifier
14 13
15CPU notifier error injection module
16-----------------------------------
17This feature can be used to test the error handling of the CPU notifiers by
18injecting artificial errors to CPU notifier chain callbacks.
19
20If the notifier call chain should be failed with some events notified, write
21the error code to debugfs interface
22/sys/kernel/debug/notifier-error-inject/cpu/actions/<notifier event>/error
23
24Possible CPU notifier events to be failed are:
25
26 * CPU_UP_PREPARE
27 * CPU_UP_PREPARE_FROZEN
28 * CPU_DOWN_PREPARE
29 * CPU_DOWN_PREPARE_FROZEN
30
31Example1: Inject CPU offline error (-1 == -EPERM)
32
33 # cd /sys/kernel/debug/notifier-error-inject/cpu
34 # echo -1 > actions/CPU_DOWN_PREPARE/error
35 # echo 0 > /sys/devices/system/cpu/cpu1/online
36 bash: echo: write error: Operation not permitted
37
38Example2: inject CPU online error (-2 == -ENOENT)
39
40 # echo -2 > actions/CPU_UP_PREPARE/error
41 # echo 1 > /sys/devices/system/cpu/cpu1/online
42 bash: echo: write error: No such file or directory
43
44PM notifier error injection module 14PM notifier error injection module
45---------------------------------- 15----------------------------------
46This feature is controlled through debugfs interface 16This feature is controlled through debugfs interface
diff --git a/Documentation/power/suspend-and-cpuhotplug.txt b/Documentation/power/suspend-and-cpuhotplug.txt
index 2fc909502db5..31abd04b9572 100644
--- a/Documentation/power/suspend-and-cpuhotplug.txt
+++ b/Documentation/power/suspend-and-cpuhotplug.txt
@@ -232,7 +232,7 @@ d. Handling microcode update during suspend/hibernate:
232 hibernate/restore cycle.] 232 hibernate/restore cycle.]
233 233
234 In the current design of the kernel however, during a CPU offline operation 234 In the current design of the kernel however, during a CPU offline operation
235 as part of the suspend/hibernate cycle (the CPU_DEAD_FROZEN notification), 235 as part of the suspend/hibernate cycle (cpuhp_tasks_frozen is set),
236 the existing copy of microcode image in the kernel is not freed up. 236 the existing copy of microcode image in the kernel is not freed up.
237 And during the CPU online operations (during resume/restore), since the 237 And during the CPU online operations (during resume/restore), since the
238 kernel finds that it already has copies of the microcode images for all the 238 kernel finds that it already has copies of the microcode images for all the
@@ -252,10 +252,9 @@ Yes, they are listed below:
252 the _cpu_down() and _cpu_up() functions is *always* 0. 252 the _cpu_down() and _cpu_up() functions is *always* 0.
253 This might not reflect the true current state of the system, since the 253 This might not reflect the true current state of the system, since the
254 tasks could have been frozen by an out-of-band event such as a suspend 254 tasks could have been frozen by an out-of-band event such as a suspend
255 operation in progress. Hence, it will lead to wrong notifications being 255 operation in progress. Hence, the cpuhp_tasks_frozen variable will not
256 sent during the cpu online/offline events (eg, CPU_ONLINE notification 256 reflect the frozen state and the CPU hotplug callbacks which evaluate
257 instead of CPU_ONLINE_FROZEN) which in turn will lead to execution of 257 that variable might execute the wrong code path.
258 inappropriate code by the callbacks registered for such CPU hotplug events.
259 258
2602. If a regular CPU hotplug stress test happens to race with the freezer due 2592. If a regular CPU hotplug stress test happens to race with the freezer due
261 to a suspend operation in progress at the same time, then we could hit the 260 to a suspend operation in progress at the same time, then we could hit the
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 938ea8ae0ba4..a04ef7c15c6a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -56,27 +56,17 @@ extern void unregister_cpu(struct cpu *cpu);
56extern ssize_t arch_cpu_probe(const char *, size_t); 56extern ssize_t arch_cpu_probe(const char *, size_t);
57extern ssize_t arch_cpu_release(const char *, size_t); 57extern ssize_t arch_cpu_release(const char *, size_t);
58#endif 58#endif
59struct notifier_block; 59
60 60/*
61#define CPU_ONLINE 0x0002 /* CPU (unsigned)v is up */ 61 * These states are not related to the core CPU hotplug mechanism. They are
62#define CPU_UP_PREPARE 0x0003 /* CPU (unsigned)v coming up */ 62 * used by various (sub)architectures to track internal state
63#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
64#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
65 * lock is dropped */
66#define CPU_BROKEN 0x000B /* CPU (unsigned)v did not die properly,
67 * perhaps due to preemption. */
68
69/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
70 * operation in progress
71 */ 63 */
72#define CPU_TASKS_FROZEN 0x0010 64#define CPU_ONLINE 0x0002 /* CPU is up */
73 65#define CPU_UP_PREPARE 0x0003 /* CPU coming up */
74#define CPU_ONLINE_FROZEN (CPU_ONLINE | CPU_TASKS_FROZEN) 66#define CPU_DEAD 0x0007 /* CPU dead */
75#define CPU_UP_PREPARE_FROZEN (CPU_UP_PREPARE | CPU_TASKS_FROZEN) 67#define CPU_DEAD_FROZEN 0x0008 /* CPU timed out on unplug */
76#define CPU_UP_CANCELED_FROZEN (CPU_UP_CANCELED | CPU_TASKS_FROZEN) 68#define CPU_POST_DEAD 0x0009 /* CPU successfully unplugged */
77#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN) 69#define CPU_BROKEN 0x000B /* CPU did not die properly */
78#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
79#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
80 70
81#ifdef CONFIG_SMP 71#ifdef CONFIG_SMP
82extern bool cpuhp_tasks_frozen; 72extern bool cpuhp_tasks_frozen;