2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

criu: Restore rseq_cs state slightly earlier in the restore sequence and run the plugin finalizer later in the dump sequence

Restore rseq_cs state before calling RESUME_DEVICES_LATE as the CUDA plugin will
temporarily unfreeze a thread during the plugin hook to assist with device
restore

Run the plugin finalizer later in the dump sequence since the finalizer is used
by the CUDA plugin to handle some process cleanup

Signed-off-by: Jesus Ramos <jeramos@nvidia.com>
This commit is contained in:
Jesus Ramos 2024-06-06 11:12:39 -07:00 committed by Andrei Vagin
parent 7ac4537069
commit 1012e542e5
2 changed files with 8 additions and 5 deletions

View File

@ -2035,7 +2035,6 @@ static int cr_dump_finish(int ret)
if (bfd_flush_images())
ret = -1;
cr_plugin_fini(CR_PLUGIN_STAGE__DUMP, ret);
cgp_fini();
if (!ret) {
@ -2089,6 +2088,9 @@ static int cr_dump_finish(int ret)
if (arch_set_thread_regs(root_item, true) < 0)
return -1;
cr_plugin_fini(CR_PLUGIN_STAGE__DUMP, ret);
pstree_switch_state(root_item, (ret || post_dump_ret) ? TASK_ALIVE : opts.final_state);
timing_stop(TIME_FROZEN);
free_pstree(root_item);

View File

@ -2224,6 +2224,11 @@ skip_ns_bouncing:
}
finalize_restore();
/* just before releasing threads we have to restore rseq_cs */
if (restore_rseq_cs())
pr_err("Unable to restore rseq_cs state\n");
/*
* Some external devices such as GPUs might need a very late
* trigger to kick-off some events, memory notifiers and for
@ -2255,10 +2260,6 @@ skip_ns_bouncing:
if (restore_freezer_state())
pr_err("Unable to restore freezer state\n");
/* just before releasing threads we have to restore rseq_cs */
if (restore_rseq_cs())
pr_err("Unable to restore rseq_cs state\n");
/* Detaches from processes and they continue run through sigreturn. */
if (finalize_restore_detach())
goto out_kill_network_unlocked;