kexec_core: Fix and cleanup for the KEXEC_JUMP flow
Subsystems (3)
cover kexec_core: Fix and cleanup for the KEXEC_JUMP flow
Hi Everyone,
These two patches fix an error code path issue in the KEXEC_JUMP flow (patch [1/2]) and clean it up a bit afterward (patch [2/2]).
Please see patch changelogs for details.
Thanks!
PATCH 1/2 kexec_core: Fix error code path in the KEXEC_JUMP flow
From: Rafael J. Wysocki <[email protected]>
If dpm_suspend_start() fails, dpm_resume_end() must be called to recover devices whose suspend callbacks have been called, but this does not happen in the KEXEC_JUMP flow's error path due to a confused goto target label.
Address this by using the correct target label in the goto statement in question.
--- kernel/kexec_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kexec_core.c +1 -1
@@ -1080,7 +1080,7 @@console_suspend_all (); error =dpm_suspend_start (PMSG_FREEZE );if (error) - goto Resume_console; + goto Resume_devices;/* * dpm_suspend_end() must be called after dpm_suspend_start() * to complete the transition, like in the hibernation flows
Re: [PATCH v1 1/2] kexec_core: Fix error code path in the KEXEC_JUMP flow
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
If
dpm_suspend_start()fails,dpm_resume_end()must be called to recover devices whose suspend callbacks have been called, but this does not happen in theKEXEC_JUMPflow's error path due to a confused goto target label.Address this by using the correct target label in the goto statement in question.
Sounds very reasonable, thanks for the fix.
Quoted 21 lines
Fixes 2965faa5e03d ("kexec: split kexec_load syscall from kexec core code")Signed-off-by Rafael J. Wysocki <[email protected]>--- kernel/kexec_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/kexec_core.c +1
-1@@ -1080,7 +1080,7 @@console_suspend_all (); error =dpm_suspend_start (PMSG_FREEZE );if (error) - goto Resume_console; + goto Resume_devices;/* * dpm_suspend_end() must be called after dpm_suspend_start() * to complete the transition, like in the hibernation flows
Re: [PATCH v1 1/2] kexec_core: Fix error code path in the KEXEC_JUMP flow
Quoted 9 lines · Baoquan He
Quoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
If
dpm_suspend_start()fails,dpm_resume_end()must be called to recover devices whose suspend callbacks have been called, but this does not happen in theKEXEC_JUMPflow's error path due to a confused goto target label.
Quoted 6 lines
Quoted 2 lines
Address this by using the correct target label in the goto statement in question.
Sounds very reasonable, thanks for the fix.
Acked-by Baoquan He <[email protected]>
Thanks!
I've queued it up for 6.17 along with the [2/2].
Quoted 22 lines
Quoted 21 lines
Fixes 2965faa5e03d ("kexec: split kexec_load syscall from kexec core code")Signed-off-by Rafael J. Wysocki <[email protected]>--- kernel/kexec_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/kexec_core.c +1
-1@@ -1080,7 +1080,7 @@console_suspend_all (); error =dpm_suspend_start (PMSG_FREEZE );if (error) - goto Resume_console; + goto Resume_devices;/* * dpm_suspend_end() must be called after dpm_suspend_start() * to complete the transition, like in the hibernation flows
PATCH 2/2 kexec_core: Drop redundant pm_restore_gfp_mask() call
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Drop the direct pm_restore_gfp_mask() call from the KEXEC_JUMP flow in kernel_kexec() because it is redundant. Namely, dpm_resume_end() called beforehand in the same code path invokes that function and it is sufficient to invoke it once.
--- kernel/kexec_core.c | 1 - 1 file changed, 1 deletion(-)
kernel/kexec_core.c +0 -1
@@ -1136,7 +1136,6 @@ Resume_devices:dpm_resume_end (PMSG_RESTORE ); Resume_console: -pm_restore_gfp_mask ();console_resume_all ();thaw_processes (); Restore_console:
Re: [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call
Quoted 11 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Drop the direct
pm_restore_gfp_mask()call from theKEXEC_JUMPflow inkernel_kexec()because it is redundant. Namely,dpm_resume_end()called beforehand in the same code path invokes that function and it is sufficient to invoke it once.Signed-off-by Rafael J. Wysocki <[email protected]>--- kernel/kexec_core.c | 1 - 1 file changed, 1 deletion(-)
LGTM,
Quoted 14 lines
kernel/kexec_core.c +0
-1@@ -1136,7 +1136,6 @@ Resume_devices:dpm_resume_end (PMSG_RESTORE ); Resume_console: -pm_restore_gfp_mask ();console_resume_all ();thaw_processes (); Restore_console:
Quoted 11 lines · Rafael J. Wysocki
Hi Everyone,
These two patches fix an error code path issue in the
KEXEC_JUMPflow (patch [1/2]) and clean it up a bit afterward (patch [2/2]).Please see patch changelogs for details.
Thanks!