Skip to content

Commit dc6ffa6

Browse files
rafaeljwbp3tk0v
authored andcommitted
kexec_core: Add and update comments regarding the KEXEC_JUMP flow
The KEXEC_JUMP flow is analogous to hibernation flows occurring before and after creating an image and before and after jumping from the restore kernel to the image one, which is why it uses the same device callbacks as those hibernation flows. Add comments explaining that to the code in question and update an existing comment in it which appears a bit out of context. No functional changes. Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2114796 commit dc6ffa6

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

kernel/kexec_core.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,12 @@ int kernel_kexec(void)
10011001

10021002
#ifdef CONFIG_KEXEC_JUMP
10031003
if (kexec_image->preserve_context) {
1004+
/*
1005+
* This flow is analogous to hibernation flows that occur
1006+
* before creating an image and before jumping from the
1007+
* restore kernel to the image one, so it uses the same
1008+
* device callbacks as those two flows.
1009+
*/
10041010
pm_prepare_console();
10051011
error = freeze_processes();
10061012
if (error) {
@@ -1011,12 +1017,10 @@ int kernel_kexec(void)
10111017
error = dpm_suspend_start(PMSG_FREEZE);
10121018
if (error)
10131019
goto Resume_console;
1014-
/* At this point, dpm_suspend_start() has been called,
1015-
* but *not* dpm_suspend_end(). We *must* call
1016-
* dpm_suspend_end() now. Otherwise, drivers for
1017-
* some devices (e.g. interrupt controllers) become
1018-
* desynchronized with the actual state of the
1019-
* hardware at resume time, and evil weirdness ensues.
1020+
/*
1021+
* dpm_suspend_end() must be called after dpm_suspend_start()
1022+
* to complete the transition, like in the hibernation flows
1023+
* mentioned above.
10201024
*/
10211025
error = dpm_suspend_end(PMSG_FREEZE);
10221026
if (error)
@@ -1052,6 +1056,13 @@ int kernel_kexec(void)
10521056

10531057
#ifdef CONFIG_KEXEC_JUMP
10541058
if (kexec_image->preserve_context) {
1059+
/*
1060+
* This flow is analogous to hibernation flows that occur after
1061+
* creating an image and after the image kernel has got control
1062+
* back, and in case the devices have been reset or otherwise
1063+
* manipulated in the meantime, it uses the device callbacks
1064+
* used by the latter.
1065+
*/
10551066
syscore_resume();
10561067
Enable_irqs:
10571068
local_irq_enable();

0 commit comments

Comments
 (0)