Skip to content

Commit 9d52b0b

Browse files
marmarekjgross1
authored andcommitted
xen: take system_transition_mutex on suspend
Xen's do_suspend() calls dpm_suspend_start() without taking required system_transition_mutex. Since 12ffc3b moved the pm_restrict_gfp_mask() call, not taking that mutex results in a WARN. Take the mutex in do_suspend(), and use mutex_trylock() to follow how enter_state() does this. Suggested-by: Jürgen Groß <jgross@suse.com> Fixes: 12ffc3b "PM: Restrict swap use to later in the suspend sequence" Link: https://lore.kernel.org/xen-devel/aKiBJeqsYx_4Top5@mail-itl/ Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Cc: stable@vger.kernel.org # v6.16+ Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20250921162853.223116-1-marmarek@invisiblethingslab.com>
1 parent f770c3d commit 9d52b0b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/xen/manage.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/reboot.h>
1212
#include <linux/sysrq.h>
1313
#include <linux/stop_machine.h>
14+
#include <linux/suspend.h>
1415
#include <linux/freezer.h>
1516
#include <linux/syscore_ops.h>
1617
#include <linux/export.h>
@@ -95,10 +96,16 @@ static void do_suspend(void)
9596

9697
shutting_down = SHUTDOWN_SUSPEND;
9798

99+
if (!mutex_trylock(&system_transition_mutex))
100+
{
101+
pr_err("%s: failed to take system_transition_mutex\n", __func__);
102+
goto out;
103+
}
104+
98105
err = freeze_processes();
99106
if (err) {
100107
pr_err("%s: freeze processes failed %d\n", __func__, err);
101-
goto out;
108+
goto out_unlock;
102109
}
103110

104111
err = freeze_kernel_threads();
@@ -155,6 +162,8 @@ static void do_suspend(void)
155162

156163
out_thaw:
157164
thaw_processes();
165+
out_unlock:
166+
mutex_unlock(&system_transition_mutex);
158167
out:
159168
shutting_down = SHUTDOWN_INVALID;
160169
}

0 commit comments

Comments
 (0)