On Thu, Sep 25, 2025 at 5:59 PM Mario Limonciello (AMD)
<[email protected]> wrote:
>
> Hybrid sleep will hibernate the system followed by running through
> the suspend routine.  Since both the hibernate and the suspend routine
> will call pm_restrict_gfp_mask(), pm_restore_gfp_mask() must be called
> before starting the suspend sequence.
>
> Add an explicit call to pm_restore_gfp_mask() to power_down() before
> the suspend sequence starts. Don't call pm_restore_gfp_mask() when
> exiting suspend sequence it is already called:
>
> ```
> power_down()
> ->suspend_devices_and_enter()
> -->dpm_resume_end()
> ```
>
> Reported-by: Ionut Nechita <[email protected]>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4573
> Tested-by: Ionut Nechita <[email protected]>
> Fixes: 12ffc3b1513eb ("PM: Restrict swap use to later in the suspend 
> sequence")
> Tested-by: Kenneth Crudup <[email protected]>
> Acked-by: Alex Deucher <[email protected]>
> Signed-off-by: Mario Limonciello (AMD) <[email protected]>
> ---
> v2:
>  * Move under CONFIG_SUSPEND scope (LKP robot)
>  * Add tags
> ---
>  kernel/power/hibernate.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index 2f66ab4538231..52c1818749724 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -695,6 +695,7 @@ static void power_down(void)
>
>  #ifdef CONFIG_SUSPEND
>         if (hibernation_mode == HIBERNATION_SUSPEND) {
> +               pm_restore_gfp_mask();
>                 error = suspend_devices_and_enter(mem_sleep_current);
>                 if (error) {
>                         hibernation_mode = hibernation_ops ?
> @@ -862,7 +863,15 @@ int hibernate(void)
>                                 power_down();
>                 }
>                 in_suspend = 0;
> -               pm_restore_gfp_mask();
> +               switch (hibernation_mode) {
> +#ifdef CONFIG_SUSPEND
> +               case HIBERNATION_SUSPEND:
> +                       break;
> +#endif
> +               default:
> +                       pm_restore_gfp_mask();
> +                       break;
> +               }

You're breaking HIBERNATION_TEST_RESUME here AFAICS and power_down()
doesn't return.

>         } else {
>                 pm_pr_dbg("Hibernation image restored successfully.\n");
>         }
> --

Reply via email to