Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMDGPU: add parallel restore of BO content to accelerate restore #2527

Open
wants to merge 6 commits into
base: criu-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions criu/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ int parse_options(int argc, char **argv, bool *usage_error, bool *has_exec_cmd,
BOOL_OPT("mntns-compat-mode", &opts.mntns_compat_mode),
BOOL_OPT("unprivileged", &opts.unprivileged),
BOOL_OPT("ghost-fiemap", &opts.ghost_fiemap),
BOOL_OPT("parallel", &opts.parallel_mode),
{},
};

Expand Down
2 changes: 2 additions & 0 deletions criu/crtools.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ int main(int argc, char *argv[], char *envp[])
" can be 'nftables' or 'iptables' (default).\n"
" --unprivileged accept limitations when running as non-root\n"
" consult documentation for further details\n"
" --parallel enable parallel restore of AMDGPU buffer object content\n"
" with other restore operations\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wweewrwer Is there any reason why parallel restore of buffer objects should not be enabled by default?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the best of my ability, I can't think of any scenarios where parallel restore wouldn't be applicable. I think the default method is simpler to implement, while the parallel method is more efficient. The state of processes restored through parallel restore has no differences from those restored using the default method. If most of the criu team prefer to enable the optimization by default, we can make the change :)

Copy link
Member

@rst0git rst0git Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this functionality with Podman, but it causes podman container restore to hang:

(00.000986) Forking task with 1 pid (flags 0x6c028000)
(00.000987) Creating process using clone3()
(00.001105) PID: real 389586 virt 1
(00.001120) Run restore asynchronous hook from criu master for external devices
(00.001121) plugin: `amdgpu_plugin' hook 12 -> 0x7fcb95a16f83
(00.001122) amdgpu_plugin: Begin to recv parallel restore cmd
(00.001132) Parallel restore: begin to recv cmd_head
(00.001140)      1: Found id extRootNetNS (fd 14) in inherit fd list
(00.001219)      1: timens: monotonic -602 193779164
(00.001223)      1: timens: boottime -602 193774845

Is it intended to work with containers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be enabled by default.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avagin Thanks for the confirmation! We will make the change.

"\n"
"* External resources support:\n"
" --external RES dump objects from this list as external resources:\n"
Expand Down
5 changes: 5 additions & 0 deletions criu/include/cr_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ struct cr_options {
* explicitly request it as it comes with many limitations.
*/
int unprivileged;
/*
* If parallel_mode is not 0, parallel restore of AMDGPU
* buffer object contents with other restore operations is enabled.
*/
int parallel_mode;
};

extern struct cr_options opts;
Expand Down