linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow
@ 2025-07-10 13:08 Rafael J. Wysocki
  2025-07-10 13:10 ` [PATCH v1 1/2] kexec_core: Fix error code path in " Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-07-10 13:08 UTC (permalink / raw)
  To: kexec
  Cc: LKML, Linux PM, Andrew Morton, Baoquan He, Mario Limonciello,
	David Woodhouse

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!




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/2] kexec_core: Fix error code path in the KEXEC_JUMP flow
  2025-07-10 13:08 [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Rafael J. Wysocki
@ 2025-07-10 13:10 ` Rafael J. Wysocki
  2025-07-11  6:16   ` Baoquan He
  2025-07-10 13:12 ` [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call Rafael J. Wysocki
  2025-07-11 11:15 ` [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Mario Limonciello
  2 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-07-10 13:10 UTC (permalink / raw)
  To: kexec
  Cc: LKML, Linux PM, Andrew Morton, Baoquan He, Mario Limonciello,
	David Woodhouse

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Fixes: 2965faa5e03d ("kexec: split kexec_load syscall from kexec core code")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/kexec_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call
  2025-07-10 13:08 [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Rafael J. Wysocki
  2025-07-10 13:10 ` [PATCH v1 1/2] kexec_core: Fix error code path in " Rafael J. Wysocki
@ 2025-07-10 13:12 ` Rafael J. Wysocki
  2025-07-11  6:17   ` Baoquan He
  2025-07-11 11:15 ` [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Mario Limonciello
  2 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-07-10 13:12 UTC (permalink / raw)
  To: kexec
  Cc: LKML, Linux PM, Andrew Morton, Baoquan He, Mario Limonciello,
	David Woodhouse

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/kexec_core.c |    1 -
 1 file changed, 1 deletion(-)

--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1136,7 +1136,6 @@
  Resume_devices:
 		dpm_resume_end(PMSG_RESTORE);
  Resume_console:
-		pm_restore_gfp_mask();
 		console_resume_all();
 		thaw_processes();
  Restore_console:




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/2] kexec_core: Fix error code path in the KEXEC_JUMP flow
  2025-07-10 13:10 ` [PATCH v1 1/2] kexec_core: Fix error code path in " Rafael J. Wysocki
@ 2025-07-11  6:16   ` Baoquan He
  2025-07-11  9:29     ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Baoquan He @ 2025-07-11  6:16 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: kexec, LKML, Linux PM, Andrew Morton, Mario Limonciello,
	David Woodhouse

On 07/10/25 at 03:10pm, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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.

Sounds very reasonable, thanks for the fix.

Acked-by: Baoquan He <bhe@redhat.com>

> 
> Fixes: 2965faa5e03d ("kexec: split kexec_load syscall from kexec core code")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  kernel/kexec_core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -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
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call
  2025-07-10 13:12 ` [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call Rafael J. Wysocki
@ 2025-07-11  6:17   ` Baoquan He
  0 siblings, 0 replies; 7+ messages in thread
From: Baoquan He @ 2025-07-11  6:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: kexec, LKML, Linux PM, Andrew Morton, Mario Limonciello,
	David Woodhouse

On 07/10/25 at 03:12pm, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  kernel/kexec_core.c |    1 -
>  1 file changed, 1 deletion(-)

LGTM,

Acked-by: Baoquan He <bhe@redhat.com>

> 
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -1136,7 +1136,6 @@
>   Resume_devices:
>  		dpm_resume_end(PMSG_RESTORE);
>   Resume_console:
> -		pm_restore_gfp_mask();
>  		console_resume_all();
>  		thaw_processes();
>   Restore_console:
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/2] kexec_core: Fix error code path in the KEXEC_JUMP flow
  2025-07-11  6:16   ` Baoquan He
@ 2025-07-11  9:29     ` Rafael J. Wysocki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-07-11  9:29 UTC (permalink / raw)
  To: Baoquan He
  Cc: Rafael J. Wysocki, kexec, LKML, Linux PM, Andrew Morton,
	Mario Limonciello, David Woodhouse

On Fri, Jul 11, 2025 at 8:16 AM Baoquan He <bhe@redhat.com> wrote:
>
> On 07/10/25 at 03:10pm, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > 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.
>
> Sounds very reasonable, thanks for the fix.
>
> Acked-by: Baoquan He <bhe@redhat.com>

Thanks!

I've queued it up for 6.17 along with the [2/2].

> >
> > Fixes: 2965faa5e03d ("kexec: split kexec_load syscall from kexec core code")
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >  kernel/kexec_core.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/kernel/kexec_core.c
> > +++ b/kernel/kexec_core.c
> > @@ -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
> >
> >
> >
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow
  2025-07-10 13:08 [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Rafael J. Wysocki
  2025-07-10 13:10 ` [PATCH v1 1/2] kexec_core: Fix error code path in " Rafael J. Wysocki
  2025-07-10 13:12 ` [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call Rafael J. Wysocki
@ 2025-07-11 11:15 ` Mario Limonciello
  2 siblings, 0 replies; 7+ messages in thread
From: Mario Limonciello @ 2025-07-11 11:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, kexec
  Cc: LKML, Linux PM, Andrew Morton, Baoquan He, David Woodhouse

On 7/10/2025 9:08 AM, Rafael J. Wysocki wrote:
> 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!
> 
> 
> 

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-11 11:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 13:08 [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Rafael J. Wysocki
2025-07-10 13:10 ` [PATCH v1 1/2] kexec_core: Fix error code path in " Rafael J. Wysocki
2025-07-11  6:16   ` Baoquan He
2025-07-11  9:29     ` Rafael J. Wysocki
2025-07-10 13:12 ` [PATCH v1 2/2] kexec_core: Drop redundant pm_restore_gfp_mask() call Rafael J. Wysocki
2025-07-11  6:17   ` Baoquan He
2025-07-11 11:15 ` [PATCH v1 0/2] kexec_core: Fix and cleanup for the KEXEC_JUMP flow Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).