From 0f561fedffdd63c737ad3bd2a6aee23e3bad170d Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 13 Jun 2023 21:33:56 +0200 Subject: [PATCH 01/53] Rebuilt for Python 3.12 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 682b7de..a121569 100644 --- a/criu.spec +++ b/criu.spec @@ -17,7 +17,7 @@ Name: criu Version: 3.18 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPLv2 URL: http://criu.org/ @@ -217,6 +217,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Jun 13 2023 Python Maint - 3.18-2 +- Rebuilt for Python 3.12 + * Tue Apr 25 2034 Adrian Reber - 3.18-1 - Update to 3.18 - Apply patch from upstream to support newer CPUs From f637ae8c275561fc633449f46de2ac384fa8f310 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 4 Jul 2023 22:32:12 -0400 Subject: [PATCH 02/53] Fix build with latest pip pip now uses wheel in certain circumstances, which results in a .dist-info directory instead of an .egg-info one. --- criu.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index a121569..5d9315d 100644 --- a/criu.spec +++ b/criu.spec @@ -53,6 +53,7 @@ BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel l %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools +BuildRequires: %{py_prefix}-wheel BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel @@ -209,7 +210,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files -n crit %{_bindir}/crit -%{python3_sitelib}/crit-%{version}*egg-info +%{python3_sitelib}/crit-%{version}.dist-info/ %doc %{_mandir}/man1/crit.1* %files -n criu-ns From 451a795464bc9899297912acab6bc0d8795d591d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 6 Jul 2023 08:44:54 +0200 Subject: [PATCH 03/53] migrated to SPDX license remove RHEL 7 conditionals Signed-off-by: Adrian Reber --- aio-fix.patch | 11 - compel.1 | 373 ------------- crit.1 | 235 --------- criu-ns.1 | 194 ------- criu.8 | 1403 ------------------------------------------------- criu.spec | 70 +-- 6 files changed, 7 insertions(+), 2279 deletions(-) delete mode 100644 aio-fix.patch delete mode 100644 compel.1 delete mode 100644 crit.1 delete mode 100644 criu-ns.1 delete mode 100644 criu.8 diff --git a/aio-fix.patch b/aio-fix.patch deleted file mode 100644 index 8589d55..0000000 --- a/aio-fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/criu/aio.c 2015-07-01 11:02:50.360004543 -0400 -+++ b/criu/aio.c 2015-07-01 11:03:33.099757812 -0400 -@@ -74,7 +74,7 @@ - * up back to the k_max_reqs. - */ - -- return (k_max_reqs - 2) / 2; -+ return (k_max_reqs - 2); - } - - unsigned long aio_rings_args_size(struct vm_area_list *vmas) diff --git a/compel.1 b/compel.1 deleted file mode 100644 index 7ed58b9..0000000 --- a/compel.1 +++ /dev/null @@ -1,373 +0,0 @@ -'\" t -.\" Title: compel -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 09/12/2019 -.\" Manual: CRIU Manual -.\" Source: criu 3.13 -.\" Language: English -.\" -.TH "COMPEL" "1" "09/12/2019" "criu 3\&.13" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -compel \- Execute parasitic code within another process\&. -.SH "Synopsis" -.sp -\fBcompel\fR \fIhgen\fR [\fIoption\fR \&...] -.sp -\fBcompel\fR \fIplugins\fR [\fIPLUGIN_NAME\fR \&...] -.sp -\fBcompel\fR [\fI\-\-compat\fR] \fIincludes\fR | \fIcflags\fR | \fIldflags\fR -.sp -\fBcompel\fR [\fI\-\-compat\fR] [\fI\-\-static\fR] \fIlibs\fR -.SH "DESCRIPTION" -.sp -\fBcompel\fR is a utility to execute arbitrary code, also called parasite code, in the context of a foreign process\&. The parasitic code, once compiled with compel flags and packed, can be executed in the context of other tasks\&. Currently there is only one way to load the parasitic blob into victim task using libcompel\&.a, called c\-header\&. -.SH "ARGUMENTS" -.SS "Positional Arguments" -.PP -\fBhgen\fR -.RS 4 -create a header from the \&.po file, which is the parasite binary\&. -.RE -.PP -\fBplugins\fR -.RS 4 -prints the plugins available\&. -.RE -.PP -\fBldflags\fR -.RS 4 -prints the ldflags available to compel during linking of parasite code\&. -.RE -.PP -\fBcflags\fR -.RS 4 -prints the compel cflags to be used during compilation of parasitic code\&. -.RE -.PP -\fBincludes\fR -.RS 4 -prints list of standard include directories\&. -.RE -.PP -\fBlibs\fR -.RS 4 -prints list of static or dynamic libraries that compel can link with\&. -.RE -.SH "OPTIONS" -.PP -\fB\-f\fR, \fB\-\-file\fR \fIFILE\fR -.RS 4 -Path to the binary file, -\fIFILE\fR, which -\fBcompel\fR -must turn into a header -.RE -.PP -\fB\-o\fR, \fB\-\-output\fR \fIFILE\fR -.RS 4 -Path to the header file, -\fIFILE\fR, where compel must write the resulting header\&. -.RE -.PP -\fB\-p\fR, \fB\-\-prefix\fR \fINAME\fR -.RS 4 -Specify prefix for var names -.RE -.PP -\fB\-l\fR, \fB\-\-log\-level\fR \fINUM\fR -.RS 4 -Default log level of compel\&. -.RE -.PP -\fB\-h\fR, \fB\-\-help\fR -.RS 4 -Prints usage and exits\&. -.RE -.PP -\fB\-V\fR, \fB\-\-version\fR -.RS 4 -Prints version number of compel\&. -.RE -.SH "SOURCE EXAMPLES" -.SS "Parasitic Code" -.sp -\fB#include \fR -.sp -\fBint parasite_trap_cmd(int cmd, void *args);\fR //gets called by compel_run_in_thread() -.sp -\fBint parasite_daemon_cmd(int cmd, void *arg);\fR // gets called by compel_rpc_call() and compel_rpc_call_sync() -.sp -\fBvoid parasite_cleanup(void);\fR //gets called on parasite unload by compel_cure() -.SS "Infecting code" -.sp -The parasitic code is compiled and converted to a header using \fBcompel\fR, and included here\&. -.sp -\fB#include \fR -.sp -\fB#include "parasite\&.h"\fR -.sp -Following steps are perfomed to infect the victim process: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -stop the task: -\fBint compel_stop_task(int pid);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -prepare infection handler: -\fBstruct parasite_ctl *compel_prepare(int pid);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -execute system call: -\fBint compel_syscall(ctl, int syscall_nr, long *ret, int arg \&...);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -infect victim: -\fBint compel_infect(ctl, nr_thread, size_of_args_area);\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -cure the victim: -\fBint compel_cure(ctl);\fR -//ctl pointer is freed by this call -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Resume victim: -\fBint compel_resume_task(pid, orig_state, state);\fR -.RE -.sp -\fBctl\fR must be configured with blob information by calling \fBPREFIX_setup_c_header()\fR, with ctl as its argument\&. \fBPREFIX\fR is the argument given to \fB\-p\fR when calling hgen, else it is deduced from file name\&. -.SH "EXAMPLES" -.sp -To generate a header file(\&.h) from a parasite binary file(\&.po) use: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray - compel hgen \-f parasite\&.po \-o parasite\&.h -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.sp -\fIparasite\&.po\fR file is obtained by compiling the parasite source with compel flags and linking it with the compel plugins\&. -.SH "AUTHOR" -.sp -The CRIU team\&. diff --git a/crit.1 b/crit.1 deleted file mode 100644 index ab8398e..0000000 --- a/crit.1 +++ /dev/null @@ -1,235 +0,0 @@ -'\" t -.\" Title: crit -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/23/2019 -.\" Manual: CRIU Manual -.\" Source: criu 3.12 -.\" Language: English -.\" -.TH "CRIT" "1" "04/23/2019" "criu 3\&.12" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -crit \- CRiu Image Tool -.SH "Synopsis" -.sp -\fBcrit\fR \fIdecode\fR [\-h] [\-i IN] [\-o OUT] [\-\-pretty] -.sp -\fBcrit\fR \fIencode\fR [\-h] [\-i IN] [\-o OUT] -.sp -\fBcrit\fR \fIinfo\fR [\-h] in -.sp -\fBcrit\fR \fIx\fR [\-h] dir {ps,fds,mems} -.sp -\fBcrit\fR \fIshow\fR [\-h] in -.SH "DESCRIPTION" -.sp -\fBcrit\fR is a feature\-rich replacement for existing \fBcriu\fR show\&. -.SH "ARGUMENTS" -.SS "Positional Arguments" -.PP -\fBdecode\fR -.RS 4 -convert -\fBcriu\fR -image from binary type JSON -.RE -.PP -\fBencode\fR -.RS 4 -convert -\fBcriu\fR -image from JSON type to binary -.RE -.PP -\fBinfo\fR -.RS 4 -show info about image -.RE -.PP -\fBx\fR -.RS 4 -explore image directory -.RE -.PP -\fBshow\fR -.RS 4 -convert -\fBcriu\fR -image from binary to human\-readable JSON -.RE -.SS "Optional Arguments" -.PP -\fB\-h\fR, \fB\-\-help\fR -.RS 4 -Print some help and exit -.RE -.SH "SEE ALSO" -.sp -criu(8) -.SH "AUTHOR" -.sp -The CRIU team diff --git a/criu-ns.1 b/criu-ns.1 deleted file mode 100644 index 3ad79bd..0000000 --- a/criu-ns.1 +++ /dev/null @@ -1,194 +0,0 @@ -'\" t -.\" Title: criu-ns -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 09/22/2021 -.\" Manual: CRIU Manual -.\" Source: criu 3.16 -.\" Language: English -.\" -.TH "CRIU\-NS" "1" "09/22/2021" "criu 3\&.16" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -criu-ns \- run criu in different namespaces -.SH "Synopsis" -.sp -\fBcriu\-ns\fR \fIdump\fR \-t PID [] -.sp -\fBcriu\-ns\fR \fIpre\-dump\fR \-t PID [] -.sp -\fBcriu\-ns\fR \fIrestore\fR [] -.sp -\fBcriu\-ns\fR \fIcheck\fR [] -.SH "DESCRIPTION" -.sp -The \fBcriu\-ns\fR command executes \fIcriu\fR in a new PID and mount namespace\&. The purpose of this wrapper script is to enable restoring a process tree that might require a specific PID that is already used on the system; so called "PID mismatch" problem\&. -.SH "SEE ALSO" -.sp -nsenter(1) namespaces(7) criu(8) -.SH "AUTHOR" -.sp -The CRIU team diff --git a/criu.8 b/criu.8 deleted file mode 100644 index eea1e76..0000000 --- a/criu.8 +++ /dev/null @@ -1,1403 +0,0 @@ -'\" t -.\" Title: criu -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/23/2019 -.\" Manual: CRIU Manual -.\" Source: criu 3.12 -.\" Language: English -.\" -.TH "CRIU" "8" "04/23/2019" "criu 3\&.12" "CRIU Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * (re)Define some macros -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" toupper - uppercase a string (locale-aware) -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de toupper -.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ -\\$* -.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH-xref - format a cross-reference to an SH section -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de SH-xref -.ie n \{\ -.\} -.toupper \\$* -.el \{\ -\\$* -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SH - level-one heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SH -.\" put an extra blank line of space above the head in non-TTY output -.if t \{\ -.sp 1 -.\} -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[an-margin]u -.ti 0 -.HTML-TAG ".NH \\n[an-level]" -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -\." make the size of the head bigger -.ps +3 -.ft B -.ne (2v + 1u) -.ie n \{\ -.\" if n (TTY output), use uppercase -.toupper \\$* -.\} -.el \{\ -.nr an-break-flag 0 -.\" if not n (not TTY), use normal case (not uppercase) -\\$1 -.in \\n[an-margin]u -.ti 0 -.\" if not n (not TTY), put a border/line under subheading -.sp -.6 -\l'\n(.lu' -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" SS - level-two heading that works better for non-TTY output -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de1 SS -.sp \\n[PD]u -.nr an-level 1 -.set-an-margin -.nr an-prevailing-indent \\n[IN] -.fi -.in \\n[IN]u -.ti \\n[SN]u -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.ps \\n[PS-SS]u -\." make the size of the head bigger -.ps +2 -.ft B -.ne (2v + 1u) -.if \\n[.$] \&\\$* -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BB/EB - put background/screen (filled box) around block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BB -.if t \{\ -.sp -.5 -.br -.in +2n -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EB -.if t \{\ -.if "\\$2"adjust-for-leading-newline" \{\ -.sp -1 -.\} -.br -.di -.in -.ll -.gcolor -.nr BW \\n(.lu-\\n(.i -.nr BH \\n(dn+.5v -.ne \\n(BHu+.5v -.ie "\\$2"adjust-for-leading-newline" \{\ -\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.el \{\ -\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[] -.\} -.in 0 -.sp -.5v -.nf -.BX -.in -.sp .5v -.fi -.\} -.. -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" BM/EM - put colored marker in margin next to block of text -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.de BM -.if t \{\ -.br -.ll -2n -.gcolor red -.di BX -.\} -.. -.de EM -.if t \{\ -.br -.di -.ll -.gcolor -.nr BH \\n(dn -.ne \\n(BHu -\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[] -.in 0 -.nf -.BX -.in -.fi -.\} -.. -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "Name" -criu \- checkpoint/restore in userspace -.SH "Synopsis" -.sp -\fBcriu\fR \fIcommand\fR [\fIoption\fR \&...] -.SH "DESCRIPTION" -.sp -\fBcriu\fR is a tool for checkpointing and restoring running applications\&. It does this by saving their state as a collection of files (see the \fBdump\fR command) and creating equivalent processes from those files (see the \fBrestore\fR command)\&. The restore operation can be performed at a later time, on a different system, or both\&. -.SH "OPTIONS" -.sp -Most of the true / false long options (the ones without arguments) can be prefixed with \fB\-\-no\-\fR to negate the option (example: \fB\-\-display\-stats\fR and \fB\-\-no\-display\-stats\fR)\&. -.SS "Common options" -.sp -Common options are applicable to any \fIcommand\fR\&. -.PP -\fB\-v\fR[\fBv\fR\&...], \fB\-\-verbosity\fR -.RS 4 -Increase verbosity up from the default level\&. Multiple -\fBv\fR -can be used, each increasing verbosity by one level\&. Using long option without argument increases verbosity by one level\&. -.RE -.PP -\fB\-v\fR\fInum\fR, \fB\-\-verbosity\fR=\fInum\fR -.RS 4 -Set verbosity level to -\fInum\fR\&. The higher the level, the more output is produced\&. - -The following levels are available: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v0\fR -no output; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v1\fR -only errors; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v2\fR -above plus warnings (this is the default level); -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v3\fR -above plus information messages and timestamps; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-v4\fR -above plus lots of debug\&. -.RE -.RE -.PP -\fB\-\-config\fR \fIfile\fR -.RS 4 -Pass a specific configuration file to criu\&. -.RE -.PP -\fB\-\-no\-default\-config\fR -.RS 4 -Forbid parsing of default configuration files\&. -.RE -.PP -\fB\-\-pidfile\fR \fIfile\fR -.RS 4 -Write root task, service or page\-server pid into a -\fIfile\fR\&. -.RE -.PP -\fB\-o\fR, \fB\-\-log\-file\fR \fIfile\fR -.RS 4 -Write logging messages to -\fIfile\fR\&. -.RE -.PP -\fB\-\-display\-stats\fR -.RS 4 -During dump as well as during restore -\fBcriu\fR -collects information like the time required to dump or restore the process or the number of pages dumped or restored\&. This information is always written to the files -\fIstats\-dump\fR -and -\fIstats\-restore\fR -and can be easily displayed using -\fBcrit\fR\&. The option -\fB\-\-display\-stats\fR -additionally prints out this information on the console at the end of a dump or a restore\&. -.RE -.PP -\fB\-D\fR, \fB\-\-images\-dir\fR \fIpath\fR -.RS 4 -Use -\fIpath\fR -as a base directory where to look for sets of image files\&. -.RE -.PP -\fB\-\-prev\-images\-dir\fR \fIpath\fR -.RS 4 -Use -\fIpath\fR -as a parent directory where to look for sets of image files\&. This option makes sense in case of incremental dumps\&. -.RE -.PP -\fB\-W\fR, \fB\-\-work\-dir\fR \fIdir\fR -.RS 4 -Use directory -\fIdir\fR -for putting logs, pidfiles and statistics\&. If not specified, -\fIpath\fR -from -\fB\-D\fR -option is taken\&. -.RE -.PP -\fB\-\-close\fR \fIfd\fR -.RS 4 -Close file descriptor -\fIfd\fR -before performing any actions\&. -.RE -.PP -\fB\-L\fR, \fB\-\-libdir\fR \fIpath\fR -.RS 4 -Path to plugins directory\&. -.RE -.PP -\fB\-\-action\-script\fR \fIscript\fR -.RS 4 -Add an external action script to be executed at certain stages\&. The environment variable -\fBCRTOOLS_SCRIPT_ACTION\fR -is available to the script to find out which action is being executed, and its value can be one of the following: -.PP -\fBpre\-dump\fR -.RS 4 -run prior to beginning a -\fBdump\fR -.RE -.PP -\fBpost\-dump\fR -.RS 4 -run upon -\fBdump\fR -completion -.RE -.PP -\fBpre\-restore\fR -.RS 4 -run prior to beginning a -\fBrestore\fR -.RE -.PP -\fBpost\-restore\fR -.RS 4 -run upon -\fBrestore\fR -completion -.RE -.PP -\fBpre\-resume\fR -.RS 4 -run when all processes and resources are restored but tasks are stopped waiting for final kick to run\&. Must not fail\&. -.RE -.PP -\fBpost\-resume\fR -.RS 4 -called at the very end, when everything is restored and processes were resumed -.RE -.PP -\fBnetwork\-lock\fR -.RS 4 -run to lock network in a target network namespace -.RE -.PP -\fBnetwork\-unlock\fR -.RS 4 -run to unlock network in a target network namespace -.RE -.PP -\fBsetup\-namespaces\fR -.RS 4 -run once root task has just been created with required namespaces\&. Note it is an early stage of restore, when nothing is restored yet, except for namespaces themselves -.RE -.PP -\fBpost\-setup\-namespaces\fR -.RS 4 -called after the namespaces are configured -.RE -.PP -\fBorphan\-pts\-master\fR -.RS 4 -called after master pty is opened and unlocked\&. This hook can be used only in the RPC mode, and the notification message contains a file descriptor for the master pty -.RE -.RE -.PP -\fB\-V\fR, \fB\-\-version\fR -.RS 4 -Print program version and exit\&. -.RE -.PP -\fB\-h\fR, \fB\-\-help\fR -.RS 4 -Print some help and exit\&. -.RE -.SS "pre\-dump" -.sp -Performs the pre\-dump procedure, during which \fBcriu\fR creates a snapshot of memory changes since the previous \fBpre\-dump\fR\&. Note that during this \fBcriu\fR also creates the fsnotify cache which speeds up the \fBrestore\fR procedure\&. \fBpre\-dump\fR requires at least \fB\-t\fR option (see \fBdump\fR below)\&. In addition, \fBpage\-server\fR options may be specified\&. -.PP -\fB\-\-track\-mem\fR -.RS 4 -Turn on memory changes tracker in the kernel\&. If the option is not passed the memory tracker get turned on implicitly\&. -.RE -.SS "dump" -.sp -Performs a checkpoint procedure\&. -.PP -\fB\-t\fR, \fB\-\-tree\fR \fIpid\fR -.RS 4 -Checkpoint the whole process tree starting from -\fIpid\fR\&. -.RE -.PP -\fB\-R\fR, \fB\-\-leave\-running\fR -.RS 4 -Leave tasks in running state after checkpoint, instead of killing\&. This option is pretty dangerous and should be used only if you understand what you are doing\&. -.sp -Note if task is about to run after been checkpointed, it can modify TCP connections, delete files and do other dangerous actions\&. Therefore, -\fBcriu\fR -can not guarantee that the next -\fBrestore\fR -action will succeed\&. Most likely if this option is used, at least the file system snapshot must be made with the help of -\fBpost\-dump\fR -action script\&. -.sp -In other words, do not use it unless really needed\&. -.RE -.PP -\fB\-s\fR, \fB\-\-leave\-stopped\fR -.RS 4 -Leave tasks in stopped state after checkpoint, instead of killing\&. -.RE -.PP -\fB\-\-external\fR \fItype\fR\fB[\fR\fIid\fR\fB]:\fR\fIvalue\fR -.RS 4 -Dump an instance of an external resource\&. The generic syntax is -\fItype\fR -of resource, followed by resource -\fIid\fR -(enclosed in literal square brackets), and optional -\fIvalue\fR -(prepended by a literal colon)\&. The following resource types are currently supported: -\fBmnt\fR, -\fBdev\fR, -\fBfile\fR, -\fBtty\fR, -\fBunix\fR\&. Syntax depends on type\&. Note to restore external resources, either -\fB\-\-external\fR -or -\fB\-\-inherit\-fd\fR -is used, depending on resource type\&. -.RE -.PP -\fB\-\-external mnt[\fR\fImountpoint\fR\fB]:\fR\fIname\fR -.RS 4 -Dump an external bind mount referenced by -\fImountpoint\fR, saving it to image under the identifier -\fIname\fR\&. -.RE -.PP -\fB\-\-external mnt[]:\fR\fIflags\fR -.RS 4 -Dump all external bind mounts, autodetecting those\&. Optional -\fIflags\fR -can contain -\fBm\fR -to also dump external master mounts, -\fBs\fR -to also dump external shared mounts (default behavior is to abort dumping if such mounts are found)\&. If -\fIflags\fR -are not provided, colon is optional\&. -.RE -.PP -\fB\-\-external dev[\fR\fImajor\fR\fB/\fR\fIminor\fR\fB]:\fR\fIname\fR -.RS 4 -Allow to dump a mount namespace having a real block device mounted\&. A block device is identified by its -\fImajor\fR -and -\fIminor\fR -numbers, and -\fBcriu\fR -saves its information to image under the identifier -\fIname\fR\&. -.RE -.PP -\fB\-\-external file[\fR\fImnt_id\fR\fB:\fR\fIinode\fR\fB]\fR -.RS 4 -Dump an external file, i\&.e\&. an opened file that is can not be resolved from the current mount namespace, which can not be dumped without using this option\&. The file is identified by -\fImnt_id\fR -(a field obtained from -\fB/proc/\fR\fIpid\fR\fB/fdinfo/\fR\fIN\fR) and -\fIinode\fR -(as returned by -\fBstat\fR(2))\&. -.RE -.PP -\fB\-\-external tty[\fR\fIrdev\fR\fB:\fR\fIdev\fR\fB]\fR -.RS 4 -Dump an external TTY, identified by -\fBst_rdev\fR -and -\fBst_dev\fR -fields returned by -\fBstat\fR(2)\&. -.RE -.PP -\fB\-\-external unix[\fR\fIid\fR\fB]\fR -.RS 4 -Tell -\fBcriu\fR -that one end of a pair of UNIX sockets (created by -\fBsocketpair\fR(2)) with -\fIid\fR -is OK to be disconnected\&. -.RE -.PP -\fB\-\-freeze\-cgroup\fR -.RS 4 -Use cgroup freezer to collect processes\&. -.RE -.PP -\fB\-\-manage\-cgroups\fR -.RS 4 -Collect cgroups into the image thus they gonna be restored then\&. Without this option, -\fBcriu\fR -will not save cgroups configuration associated with a task\&. -.RE -.PP -\fB\-\-cgroup\-props\fR \fIspec\fR -.RS 4 -Specify controllers and their properties to be saved into the image file\&. -\fBcriu\fR -predefines specifications for common controllers, but since the kernel can add new controllers and modify their properties, there should be a way to specify ones matched the kernel\&. -.sp -\fIspec\fR -argument describes the controller and properties specification in a simplified YAML form: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray -"c1": - \- "strategy": "merge" - \- "properties": ["a", "b"] -"c2": - \- "strategy": "replace" - \- "properties": ["c", "d"] -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.sp -where -\fIc1\fR -and -\fIc2\fR -are controllers names, and -\fIa\fR, -\fIb\fR, -\fIc\fR, -\fId\fR -are their properties\&. -.sp -Note the format: double quotes, spaces and new lines are required\&. The -\fIstrategy\fR -specifies what to do if a controller specified already exists as a built\-in one: -\fBcriu\fR -can either -\fBmerge\fR -or -\fBreplace\fR -such\&. -.sp -For example, the command line for the above example should look like this: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray -\-\-cgroup\-props "\e"c1\e":\en \- \e"strategy\e": \e"merge\e"\en \- \e"properties\e": [\e"a\e", \e"b\e"]\en \e"c2\e":\en \- \e"strategy\e": \e"replace\e"\en \- \e"properties\e": [\e"c\e", \e"d\e"]" -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.RE -.PP -\fB\-\-cgroup\-props\-file\fR \fIfile\fR -.RS 4 -Same as -\fB\-\-cgroup\-props\fR, except the specification is read from the -\fIfile\fR\&. -.RE -.PP -\fB\-\-cgroup\-dump\-controller\fR \fIname\fR -.RS 4 -Dump a controller with -\fIname\fR -only, skipping anything else that was discovered automatically (usually via -\fB/proc\fR)\&. This option is useful when one needs -\fBcriu\fR -to skip some controllers\&. -.RE -.PP -\fB\-\-cgroup\-props\-ignore\-default\fR -.RS 4 -When combined with -\fB\-\-cgroup\-props\fR, makes -\fBcriu\fR -substitute a predefined controller property with the new one shipped\&. If the option is not used, the predefined properties are merged with the provided ones\&. -.RE -.PP -\fB\-\-tcp\-established\fR -.RS 4 -Checkpoint established TCP connections\&. -.RE -.PP -\fB\-\-skip\-in\-flight\fR -.RS 4 -This option skips in\-flight TCP connections\&. If any TCP connections that are not yet completely established are found, -\fBcriu\fR -ignores these connections, rather than errors out\&. The TCP stack on the client side is expected to handle the re\-connect gracefully\&. -.RE -.PP -\fB\-\-evasive\-devices\fR -.RS 4 -Use any path to a device file if the original one is inaccessible\&. -.RE -.PP -\fB\-\-page\-server\fR -.RS 4 -Send pages to a page server (see the -\fBpage\-server\fR -command)\&. -.RE -.PP -\fB\-\-force\-irmap\fR -.RS 4 -Force resolving names for inotify and fsnotify watches\&. -.RE -.PP -\fB\-\-auto\-dedup\fR -.RS 4 -Deduplicate "old" data in pages images of previous -\fBdump\fR\&. This option implies incremental -\fBdump\fR -mode (see the -\fBpre\-dump\fR -command)\&. -.RE -.PP -\fB\-l\fR, \fB\-\-file\-locks\fR -.RS 4 -Dump file locks\&. It is necessary to make sure that all file lock users are taken into dump, so it is only safe to use this for enclosed containers where locks are not held by any processes outside of dumped process tree\&. -.RE -.PP -\fB\-\-link\-remap\fR -.RS 4 -Allows to link unlinked files back, if possible (modifies filesystem during -\fBrestore\fR)\&. -.RE -.PP -\fB\-\-ghost\-limit\fR \fIsize\fR -.RS 4 -Set the maximum size of deleted file to be carried inside image\&. By default, up to 1M file is allowed\&. Using this option allows to not put big deleted files inside images\&. Argument -\fIsize\fR -may be postfixed with a -\fBK\fR, -\fBM\fR -or -\fBG\fR, which stands for kilo\-, mega, and gigabytes, accordingly\&. -.RE -.PP -\fB\-j\fR, \fB\-\-shell\-job\fR -.RS 4 -Allow one to dump shell jobs\&. This implies the restored task will inherit session and process group ID from the -\fBcriu\fR -itself\&. This option also allows to migrate a single external tty connection, to migrate applications like -\fBtop\fR\&. If used with -\fBdump\fR -command, it must be specified with -\fBrestore\fR -as well\&. -.RE -.PP -\fB\-\-cpu\-cap\fR [\fIcap\fR[,\fIcap\fR\&...]] -.RS 4 -Specify CPU capabilities to write to an image file\&. The argument is a comma\-separated list of: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnone\fR -to ignore capabilities at all; the image will not be produced on dump, neither any check performed on restore; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBfpu\fR -to check if FPU module is compatible; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBins\fR -to check if CPU supports all instructions required; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBcpu\fR -to check if CPU capabilities are exactly matching; -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBall\fR -for all above set\&. -.RE -.sp -By default the option is set to -\fBfpu\fR -and -\fBins\fR\&. -.RE -.PP -\fB\-\-cgroup\-root\fR [\fIcontroller\fR:]/\fInewroot\fR -.RS 4 -Change the root for the controller that will be dumped\&. By default, -\fBcriu\fR -simply dumps everything below where any of the tasks live\&. However, if a container moves all of its tasks into a cgroup directory below the container engine\(cqs default directory for tasks, permissions will not be preserved on the upper directories with no tasks in them, which may cause problems\&. -.RE -.PP -\fB\-\-lazy\-pages\fR -.RS 4 -Perform the dump procedure without writing memory pages into the image files and prepare to service page requests over the network\&. When -\fBdump\fR -runs in this mode it presumes that -\fBlazy\-pages\fR -daemon will connect to it and fetch memory pages to lazily inject them into the restored process address space\&. This option is intended for post\-copy (lazy) migration and should be used in conjunction with -\fBrestore\fR -with appropriate options\&. -.RE -.SS "restore" -.sp -Restores previously checkpointed processes\&. -.PP -\fB\-\-inherit\-fd\fR \fBfd[\fR\fIN\fR\fB]:\fR\fIresource\fR -.RS 4 -Inherit a file descriptor\&. This option lets -\fBcriu\fR -use an already opened file descriptor -\fIN\fR -for restoring a file identified by -\fIresource\fR\&. This option can be used to restore an external resource dumped with the help of -\fB\-\-external\fR -\fBfile\fR, -\fBtty\fR, and -\fBunix\fR -options\&. -.sp -The -\fIresource\fR -argument can be one of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtty[\fR\fIrdev\fR\fB:\fR\fIdev\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpipe[\fR\fIinode\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsocket[\fR\fIinode\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBfile[\fR\fImnt_id\fR\fB:\fR\fIinode\fR\fB]\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIpath/to/file\fR -.RE -.sp -Note that square brackets used in this option arguments are literals and usually need to be escaped from shell\&. -.RE -.PP -\fB\-d\fR, \fB\-\-restore\-detached\fR -.RS 4 -Detach -\fBcriu\fR -itself once restore is complete\&. -.RE -.PP -\fB\-s\fR, \fB\-\-leave\-stopped\fR -.RS 4 -Leave tasks in stopped state after restore (rather than resuming their execution)\&. -.RE -.PP -\fB\-S\fR, \fB\-\-restore\-sibling\fR -.RS 4 -Restore root task as a sibling (makes sense only with -\fB\-\-restore\-detached\fR)\&. -.RE -.PP -\fB\-\-log\-pid\fR -.RS 4 -Write separate logging files per each pid\&. -.RE -.PP -\fB\-r\fR, \fB\-\-root\fR \fIpath\fR -.RS 4 -Change the root filesystem to -\fIpath\fR -(when run in a mount namespace)\&. -.RE -.PP -\fB\-\-external\fR \fItype\fR\fB[\fR\fIid\fR\fB]:\fR\fIvalue\fR -.RS 4 -Restore an instance of an external resource\&. The generic syntax is -\fItype\fR -of resource, followed by resource -\fIid\fR -(enclosed in literal square brackets), and optional -\fIvalue\fR -(prepended by a literal colon)\&. The following resource types are currently supported: -\fBmnt\fR, -\fBdev\fR, -\fBveth\fR, -\fBmacvlan\fR\&. Syntax depends on type\&. Note to restore external resources dealing with opened file descriptors (such as dumped with the help of -\fB\-\-external\fR -\fBfile\fR, -\fBtty\fR, and -\fBunix\fR -options), option -\fB\-\-inherit\-fd\fR -should be used\&. -.RE -.PP -\fB\-\-external mnt[\fR\fIname\fR\fB]:\fR\fImountpoint\fR -.RS 4 -Restore an external bind mount referenced in the image by -\fIname\fR, bind\-mounting it from the host -\fImountpoint\fR -to a proper mount point\&. -.RE -.PP -\fB\-\-external mnt[]\fR -.RS 4 -Restore all external bind mounts (dumped with the help of -\fB\-\-external mnt[]\fR -auto\-detection)\&. -.RE -.PP -\fB\-\-external dev[\fR\fIname\fR\fB]:\fR\fI/dev/path\fR -.RS 4 -Restore an external mount device, identified in the image by -\fIname\fR, using the existing block device -\fI/dev/path\fR\&. -.RE -.PP -\fB\-\-external veth[\fR\fIinner_dev\fR\fB]:\fR\fIouter_dev\fR\fB@\fR\fIbridge\fR -.RS 4 -Set the outer VETH device name (corresponding to -\fIinner_dev\fR -being restored) to -\fIouter_dev\fR\&. If optional -\fB@\fR\fIbridge\fR -is specified, -\fIouter_dev\fR -is added to that bridge\&. If the option is not used, -\fIouter_dev\fR -will be autogenerated by the kernel\&. -.RE -.PP -\fB\-\-external macvlan[\fR\fIinner_dev\fR\fB]:\fR\fIouter_dev\fR -.RS 4 -When restoring an image that have a MacVLAN device in it, this option must be used to specify to which -\fIouter_dev\fR -(an existing network device in CRIU namespace) the restored -\fIinner_dev\fR -should be bound to\&. -.RE -.PP -\fB\-\-manage\-cgroups\fR [\fImode\fR] -.RS 4 -Restore cgroups configuration associated with a task from the image\&. Controllers are always restored in an optimistic way \(em if already present in system, -\fBcriu\fR -reuses it, otherwise it will be created\&. -.RE -.sp -The \fImode\fR may be one of the following: -.PP -\fBnone\fR -.RS 4 -Do not restore cgroup properties but require cgroup to pre\-exist at the moment of -\fBrestore\fR -procedure\&. -.RE -.PP -\fBprops\fR -.RS 4 -Restore cgroup properties and require cgroup to pre\-exist\&. -.RE -.PP -\fBsoft\fR -.RS 4 -Restore cgroup properties if only cgroup has been created by -\fBcriu\fR, otherwise do not restore properties\&. This is the default if mode is unspecified\&. -.RE -.PP -\fBfull\fR -.RS 4 -Always restore all cgroups and their properties\&. -.RE -.PP -\fBstrict\fR -.RS 4 -Restore all cgroups and their properties from the scratch, requiring them to not present in the system\&. -.PP -\fB\-\-cgroup\-root\fR [\fIcontroller\fR\fB:\fR]/\fInewroot\fR -.RS 4 -Change the root cgroup the controller will be installed into\&. No controller means that root is the default for all controllers not specified\&. -.RE -.PP -\fB\-\-tcp\-established\fR -.RS 4 -Restore previously dumped established TCP connections\&. This implies that the network has been locked between -\fBdump\fR -and -\fBrestore\fR -phases so other side of a connection simply notice a kind of lag\&. -.RE -.PP -\fB\-\-tcp\-close\fR -.RS 4 -Restore connected TCP sockets in closed state\&. -.RE -.PP -\fB\-\-veth\-pair\fR \fIIN\fR\fB=\fR\fIOUT\fR -.RS 4 -Correspondence between outside and inside names of veth devices\&. -.RE -.PP -\fB\-l\fR, \fB\-\-file\-locks\fR -.RS 4 -Restore file locks from the image\&. -.RE -.PP -\fB\-\-lsm\-profile\fR \fItype\fR\fB:\fR\fIname\fR -.RS 4 -Specify an LSM profile to be used during restore\&. The -\FCtype\F[] -can be either -\fBapparmor\fR -or -\fBselinux\fR\&. -.RE -.PP -\fB\-\-auto\-dedup\fR -.RS 4 -As soon as a page is restored it get punched out from image\&. -.RE -.PP -\fB\-j\fR, \fB\-\-shell\-job\fR -.RS 4 -Restore shell jobs, in other words inherit session and process group ID from the criu itself\&. -.RE -.PP -\fB\-\-cpu\-cap\fR [\fIcap\fR[,\fIcap\fR\&...]] -.RS 4 -Specify CPU capabilities to be present on the CPU the process is restoring\&. To inverse a capability, prefix it with -\fB^\fR\&. This option implies that -\fB\-\-cpu\-cap\fR -has been passed on -\fBdump\fR -as well, except -\fBfpu\fR -option case\&. The -\fIcap\fR -argument can be the following (or a set of comma\-separated values): -.RE -.RE -.PP -\fBall\fR -.RS 4 -Require all capabilities\&. This is -\fBdefault\fR -mode if -\fB\-\-cpu\-cap\fR -is passed without arguments\&. Most safe mode\&. -.RE -.PP -\fBcpu\fR -.RS 4 -Require the CPU to have all capabilities in image to match runtime CPU\&. -.RE -.PP -\fBfpu\fR -.RS 4 -Require the CPU to have compatible FPU\&. For example the process might be dumped with xsave capability but attempted to restore without it present on target CPU\&. In such case we refuse to proceed\&. This is -\fBdefault\fR -mode if -\fB\-\-cpu\-cap\fR -is not present in command line\&. Note this argument might be passed even if on the -\fBdump\fR -no -\fB\-\-cpu\-cap\fR -have been specified because FPU frames are always encoded into images\&. -.RE -.PP -\fBins\fR -.RS 4 -Require CPU compatibility on instructions level\&. -.RE -.PP -\fBnone\fR -.RS 4 -Ignore capabilities\&. Most dangerous mode\&. The behaviour is implementation dependent\&. Try to not use it until really required\&. -.sp -For example, this option can be used in case -\fB\-\-cpu\-cap=cpu\fR -was used during -\fBdump\fR, and images are migrated to a less capable CPU and are to be restored\&. By default, -\fBcriu\fR -shows an error that CPU capabilities are not adequate, but this can be suppressed by using -\fB\-\-cpu\-cap=none\fR\&. -.PP -\fB\-\-weak\-sysctls\fR -.RS 4 -Silently skip restoring sysctls that are not available\&. This allows to restore on an older kernel, or a kernel configured without some options\&. -.RE -.PP -\fB\-\-lazy\-pages\fR -.RS 4 -Restore the processes without filling out the entire memory contents\&. When this option is used, -\fBrestore\fR -sets up the infrastructure required to fill memory pages either on demand when the process accesses them or in the background without stopping the restored process\&. This option requires running -\fBlazy\-pages\fR -daemon\&. -.RE -.RE -.SS "check" -.sp -Checks whether the kernel supports the features needed by \fBcriu\fR to dump and restore a process tree\&. -.sp -There are three categories of kernel support, as described below\&. \fBcriu check\fR always checks Category 1 features unless \fB\-\-feature\fR is specified which only checks a specified feature\&. -.PP -\fBCategory 1\fR -.RS 4 -Absolutely required\&. These are features like support for -\fB/proc/PID/map_files\fR, -\fBNETLINK_SOCK_DIAG\fR -socket monitoring, -\fB/proc/sys/kernel/ns_last_pid\fR -etc\&. -.RE -.PP -\fBCategory 2\fR -.RS 4 -Required only for specific cases\&. These are features like AIO remap, -\fB/dev/net/tun\fR -and others that are only required if a process being dumped or restored is using those\&. -.RE -.PP -\fBCategory 3\fR -.RS 4 -Experimental\&. These are features like -\fBtask\-diag\fR -that are used for experimental purposes (mostly during development)\&. -.RE -.sp -If there are no errors or warnings, \fBcriu\fR prints "Looks good\&." and its exit code is 0\&. -.sp -A missing Category 1 feature causes \fBcriu\fR to print "Does not look good\&." and its exit code is non\-zero\&. -.sp -Missing Category 2 and 3 features cause \fBcriu\fR to print "Looks good but \&..." and its exit code is be non\-zero\&. -.sp -Without any options, \fBcriu check\fR checks Category 1 features\&. This behavior can be changed by using the following options: -.PP -\fB\-\-extra\fR -.RS 4 -Check kernel support for Category 2 features\&. -.RE -.PP -\fB\-\-experimental\fR -.RS 4 -Check kernel support for Category 3 features\&. -.RE -.PP -\fB\-\-all\fR -.RS 4 -Check kernel support for Category 1, 2, and 3 features\&. -.RE -.PP -\fB\-\-feature\fR \fIname\fR -.RS 4 -Check a specific feature\&. If -\fIname\fR -is -\fBlist\fR, a list of valid kernel feature names that can be checked will be printed\&. -.RE -.SS "page\-server" -.sp -Launches \fBcriu\fR in page server mode\&. -.PP -\fB\-\-daemon\fR -.RS 4 -Runs page server as a daemon (background process)\&. -.RE -.PP -\fB\-\-status\-fd\fR -.RS 4 -Write \e0 to the FD and close it once page\-server is ready to handle requests\&. The status\-fd allows to not daemonize a process and get its exit code at the end\&. It isn\(cqt supposed to use \-\-daemon and \-\-status\-fd together\&. -.RE -.PP -\fB\-\-address\fR \fIaddress\fR -.RS 4 -Page server IP address or hostname\&. -.RE -.PP -\fB\-\-port\fR \fInumber\fR -.RS 4 -Page server port number\&. -.RE -.PP -\fB\-\-ps\-socket\fR \fIfd\fR -.RS 4 -Use provided file descriptor as socket for incoming connection\&. In this case \-\-address and \-\-port are ignored\&. Useful for intercepting page\-server traffic e\&.g\&. to add encryption or authentication\&. -.RE -.PP -\fB\-\-lazy\-pages\fR -.RS 4 -Serve local memory dump to a remote -\fBlazy\-pages\fR -daemon\&. In this mode the -\fBpage\-server\fR -reads local memory dump and allows the remote -\fBlazy\-pages\fR -daemon to request memory pages in random order\&. -.RE -.SS "lazy\-pages" -.sp -Launches \fBcriu\fR in lazy\-pages daemon mode\&. -.sp -The \fBlazy\-pages\fR daemon is responsible for managing user\-level demand paging for the restored processes\&. It gets information required to fill the process memory pages from the \fBrestore\fR and from the checkpoint directory\&. When a restored process access certain memory page for the first time, the \fBlazy\-pages\fR daemon injects its contents into the process address space\&. The memory pages that are not yet requested by the restored processes are injected in the background\&. -.SS "exec" -.sp -Executes a system call inside a destination task\*(Aqs context\&. This functionality is deprecated; please use \fBCompel\fR instead\&. -.SS "service" -.sp -Launches \fBcriu\fR in RPC daemon mode, where \fBcriu\fR is listening for RPC commands over socket to perform\&. This is convenient for a case where daemon itself is running in a privileged (superuser) mode but clients are not\&. -.SS "dedup" -.sp -Starts pagemap data deduplication procedure, where \fBcriu\fR scans over all pagemap files and tries to minimize the number of pagemap entries by obtaining the references from a parent pagemap image\&. -.SS "cpuinfo dump" -.sp -Fetches current CPU features and write them into an image file\&. -.SS "cpuinfo check" -.sp -Fetches current CPU features (i\&.e\&. CPU the \fBcriu\fR is running on) and test if they are compatible with the ones present in an image file\&. -.SH "CONFIGURATION FILES" -.sp -\fBCriu\fR supports usage of configuration files to avoid the need of writing every option on command line, which is useful especially with repeated usage of same options\&. A specific configuration file can be passed with the "\fB\-\-config\fR \fIfile\fR" option\&. If no file is passed, the default configuration files \fI/etc/criu/default\&.conf\fR and \fI$HOME/\&.criu/default\&.conf\fR are parsed (if present on the system)\&. If the environment variable CRIU_CONFIG_FILE is set, it will also be parsed\&. -.sp -The options passed to CRIU via CLI, RPC or configuration file are evaluated in the following order: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(/etc/criu/default\&.conf) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config($HOME/\&.criu/default\&.conf) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(CRIU_CONFIG_FILE) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(\fB\-\-config\fR -\fIfile\fR) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(CLI) or apply_config(RPC) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -apply_config(RPC configuration file) (only for RPC mode) -.RE -.sp -Default configuration file parsing can be deactivated with "\fB\-\-no\-default\-config\fR" if needed\&. Parsed configuration files are merged with command line options, which allows overriding boolean options\&. -.SS "Configuration file syntax" -.sp -Comments are supported using \*(Aq#\*(Aq sign\&. The rest of the line is ignored\&. Options are the same as command line options without the \*(Aq\-\-\*(Aq prefix, use one option per line (with corresponding argument if applicable, divided by whitespaces)\&. If needed, the argument can be provided in double quotes (this should be needed only if the argument contains whitespaces)\&. In case this type of argument contains a literal double quote as well, it can be escaped using the \*(Aq\e\*(Aq sign\&. Usage of commands is disallowed and all other escape sequences are interpreted literally\&. -.sp -Example of configuration file to illustrate syntax: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray -$ cat ~/\&.criu/default\&.conf -tcp\-established -work\-dir "/home/USERNAME/criu/my \e"work\e" directory" -#this is a comment -no\-restore\-sibling # this is another comment -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.SS "Configuration files in RPC mode" -.sp -Not only does \fBcriu\fR evaluate configuration files in CLI mode, it also evaluates configuration files in RPC mode\&. Just as in CLI mode the configuration file values are evaluated first\&. This means that any option set via RPC will overwrite the configuration file setting\&. The user can thus change \fBcriu\fR\*(Aqs default behavior but it is not possible to change settings which are explicitly set by the RPC client\&. -.sp -The RPC client can, however, specify an additional configuration file which will be evaluated after the RPC options (see above for option evaluation order)\&. The RPC client can specify this additional configuration file via "req\&.opts\&.config_file = \fI/path/to/file\fR"\&. The values from this configuration file will overwrite all other configuration file settings or RPC options\&. \fBThis can lead to undesired behavior of criu and should only be used carefully\&.\fR -.SH "EXAMPLES" -.sp -To checkpoint a program with pid of \fB1234\fR and write all image files into directory \fBcheckpoint\fR: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray - criu dump \-D checkpoint \-t 1234 -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.sp -To restore this program detaching criu itself: -.sp -.if n \{\ -.RS 4 -.\} -.fam C -.ps -1 -.nf -.BB lightgray - criu restore \-d \-D checkpoint -.EB lightgray -.fi -.fam -.ps +1 -.if n \{\ -.RE -.\} -.SH "AUTHOR" -.sp -The CRIU team\&. -.SH "COPYRIGHT" -.sp -Copyright (C) 2011\-2016, Parallels Holdings, Inc\&. diff --git a/criu.spec b/criu.spec index 5d9315d..f0ebb52 100644 --- a/criu.spec +++ b/criu.spec @@ -1,10 +1,5 @@ -%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 %global py_prefix python3 %global py_binary %{py_prefix} -%else -%global py_prefix python -%global py_binary python2 -%endif # With annobin enabled, CRIU does not work anymore. It seems CRIU's # parasite code breaks if annobin is enabled. @@ -17,9 +12,9 @@ Name: criu Version: 3.18 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space -License: GPLv2 +License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz @@ -31,26 +26,12 @@ Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759af # in RPM and DEB is different. Patch99: criu.pc.patch -%if 0%{?rhel} && 0%{?rhel} <= 7 -BuildRequires: perl -# RHEL has no asciidoc; take man-page from Fedora 26 -# zcat /usr/share/man/man8/criu.8.gz > criu.8 -Source1: criu.8 -Source2: crit.1 -Source3: criu-ns.1 - -# The patch aio-fix.patch is needed as RHEL7 -# doesn't do "nr_events *= 2" in ioctx_alloc(). -Patch100: aio-fix.patch -%endif - Source5: criu-tmpfiles.conf BuildRequires: gcc BuildRequires: systemd BuildRequires: libnet-devel BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel -%if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools BuildRequires: %{py_prefix}-wheel @@ -64,7 +45,6 @@ Recommends: tar BuildRequires: libbsd-devel BuildRequires: nftables-devel %endif -%endif BuildRequires: make # user-space and kernel changes are only available for x86_64, arm, @@ -77,7 +57,6 @@ criu is the user-space part of Checkpoint/Restore in User-space (CRIU), a project to implement checkpoint/restore functionality for Linux in user-space. -%if 0%{?fedora} || 0%{?rhel} > 7 %package devel Summary: Header files and libraries for %{name} Requires: %{name} = %{version}-%{release} @@ -92,18 +71,11 @@ Requires: %{name} = %{version}-%{release} %description libs This package contains the libraries for %{name} -%endif %package -n %{py_prefix}-%{name} %{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} -%if 0%{?rhel} && 0%{?rhel} <= 7 -Requires: protobuf-python -Requires: %{name} = %{version}-%{release} %{py_prefix}-ipaddr -%else Requires: %{py_prefix}-protobuf -Obsoletes: python2-criu < 3.10-1 -%endif %description -n %{py_prefix}-%{name} %{py_prefix}-%{name} contains Python bindings for %{name}. @@ -130,10 +102,6 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 0 -p1 %patch -P 99 -p1 -%if 0%{?rhel} && 0%{?rhel} <= 7 -%patch -P 100 -p1 -%endif - %build # This package calls LD directly without specifying the LTO plugins. Until # that is fixed, disable LTO. @@ -142,9 +110,7 @@ This script can help to workaround the so called "PID mismatch" problem. # %{?_smp_mflags} does not work # -fstack-protector breaks build CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} -%if 0%{?fedora} || 0%{?rhel} > 7 make docs V=1 -%endif %install @@ -152,45 +118,25 @@ sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar rm -f crit/pyproject.toml make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} -%if 0%{?fedora} || 0%{?rhel} > 7 -# only install documentation on Fedora as it requires asciidoc, -# which is not available on RHEL7 make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/amdgpu_plugin.1 -%else -install -p -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man8/%{name}.8 -install -p -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/crit.1 -install -p -m 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1 -rm -f compel.1 amdgpu_plugin.1 -%endif mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ -%if 0%{?rhel} && 0%{?rhel} <= 7 -# remove devel and libs packages -rm -rf $RPM_BUILD_ROOT%{_includedir}/criu -rm $RPM_BUILD_ROOT%{_libdir}/*.so* -rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig -rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} -%endif - # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files %{_sbindir}/%{name} %doc %{_mandir}/man8/criu.8* -%if 0%{?fedora} || 0%{?rhel} > 7 %{_libexecdir}/%{name} -%endif %dir /run/%{name} %{_tmpfilesdir}/%{name}.conf %doc README.md COPYING -%if 0%{?fedora} || 0%{?rhel} > 7 %files devel %{_includedir}/criu %{_libdir}/*.so @@ -198,15 +144,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files libs %{_libdir}/*.so.* -%endif %files -n %{py_prefix}-%{name} -%if 0%{?rhel} && 0%{?rhel} <= 7 -%{python2_sitelib}/pycriu/* -%{python2_sitelib}/*egg-info -%else %{python3_sitelib}/pycriu/* -%endif %files -n crit %{_bindir}/crit @@ -218,10 +158,14 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Jul 06 2023 Adrian Reber - 3.18-3 +- migrated to SPDX license +- remove RHEL 7 conditionals + * Tue Jun 13 2023 Python Maint - 3.18-2 - Rebuilt for Python 3.12 -* Tue Apr 25 2034 Adrian Reber - 3.18-1 +* Tue Apr 25 2023 Adrian Reber - 3.18-1 - Update to 3.18 - Apply patch from upstream to support newer CPUs From 43f41b62463c2e119db6f3c613429ac13bbc8b7b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 16:35:48 +0000 Subject: [PATCH 04/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index f0ebb52..1e42c5b 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.18 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -158,6 +158,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 3.18-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Thu Jul 06 2023 Adrian Reber - 3.18-3 - migrated to SPDX license - remove RHEL 7 conditionals From 23b38e9056e520e668ddd01506e210d0a630507d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 31 Jul 2023 13:41:29 -0400 Subject: [PATCH 05/53] Fix s390x build with kernel 6.5 Resolves: rhbz#2225745 --- criu.spec | 3 +++ kernel65-s390x.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 kernel65-s390x.patch diff --git a/criu.spec b/criu.spec index 1e42c5b..33bb54e 100644 --- a/criu.spec +++ b/criu.spec @@ -20,6 +20,8 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # Fix to work on CPUs with larger XSAVE area (Sapphire Rapids) Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759afb312340fa3827312f6.patch +# https://github.com/checkpoint-restore/criu/pull/2232 +Patch1: kernel65-s390x.patch # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name @@ -100,6 +102,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q %patch -P 0 -p1 +%patch -P 1 -p1 %patch -P 99 -p1 %build diff --git a/kernel65-s390x.patch b/kernel65-s390x.patch new file mode 100644 index 0000000..9aaad77 --- /dev/null +++ b/kernel65-s390x.patch @@ -0,0 +1,26 @@ +https://github.com/checkpoint-restore/criu/pull/2232 + +diff --git a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h +index 87283bc6b..6d55a015f 100644 +--- a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h ++++ b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include + #include "common/page.h" + +diff --git a/criu/arch/s390/include/asm/restorer.h b/criu/arch/s390/include/asm/restorer.h +index b8472afc8..1a6469837 100644 +--- a/criu/arch/s390/include/asm/restorer.h ++++ b/criu/arch/s390/include/asm/restorer.h +@@ -1,6 +1,7 @@ + #ifndef __CR_ASM_RESTORER_H__ + #define __CR_ASM_RESTORER_H__ + ++#include + #include + #include + From f6c7edf74c13ca3aee0edefab7b6e8577a172839 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 14:15:12 +0100 Subject: [PATCH 06/53] Update to 3.19 Signed-off-by: Adrian Reber --- .gitignore | 1 + criu.spec | 20 +++-- ...260c57576c636759afb312340fa3827312f6.patch | 74 ------------------- kernel65-s390x.patch | 26 ------- sources | 2 +- 5 files changed, 11 insertions(+), 112 deletions(-) delete mode 100644 d739260c57576c636759afb312340fa3827312f6.patch delete mode 100644 kernel65-s390x.patch diff --git a/.gitignore b/.gitignore index 5993df3..0d113cc 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ /criu-3.17.tar.gz /criu-3.17.1.tar.gz /criu-3.18.tar.gz +/criu-3.19.tar.gz diff --git a/criu.spec b/criu.spec index 33bb54e..f7383e2 100644 --- a/criu.spec +++ b/criu.spec @@ -11,18 +11,13 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.18 -Release: 4%{?dist} +Version: 3.19 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -# Fix to work on CPUs with larger XSAVE area (Sapphire Rapids) -Patch0: https://github.com/checkpoint-restore/criu/commit/d739260c57576c636759afb312340fa3827312f6.patch -# https://github.com/checkpoint-restore/criu/pull/2232 -Patch1: kernel65-s390x.patch - # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -101,8 +96,6 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q -%patch -P 0 -p1 -%patch -P 1 -p1 %patch -P 99 -p1 %build @@ -121,9 +114,10 @@ sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar rm -f crit/pyproject.toml make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/amdgpu_plugin.1 +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-amdgpu-plugin.1 mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf @@ -149,11 +143,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_libdir}/*.so.* %files -n %{py_prefix}-%{name} -%{python3_sitelib}/pycriu/* +%{python3_sitelib}/pycriu* %files -n crit %{_bindir}/crit %{python3_sitelib}/crit-%{version}.dist-info/ +%{python3_sitelib}/crit %doc %{_mandir}/man1/crit.1* %files -n criu-ns @@ -161,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Nov 28 2023 Adrian Reber - 3.19-1 +- Update to 3.19 + * Wed Jul 19 2023 Fedora Release Engineering - 3.18-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/d739260c57576c636759afb312340fa3827312f6.patch b/d739260c57576c636759afb312340fa3827312f6.patch deleted file mode 100644 index 7847bb5..0000000 --- a/d739260c57576c636759afb312340fa3827312f6.patch +++ /dev/null @@ -1,74 +0,0 @@ -From d739260c57576c636759afb312340fa3827312f6 Mon Sep 17 00:00:00 2001 -From: Adrian Reber -Date: Mon, 24 Apr 2023 09:28:19 +0200 -Subject: [PATCH] compel: support XSAVE on newer Intel CPUs - -Newer Intel CPUs (Sapphire Rapids) have a much larger xsave area than -before. Looking at older CPUs I see 2440 bytes. - - # cpuid -1 -l 0xd -s 0 - ... - bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) - -On newer CPUs (Sapphire Rapids) it grows to 11008 bytes. - - # cpuid -1 -l 0xd -s 0 - ... - bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) - -This increase the xsave area from one page to four pages. - -Without this patch the fpu03 test fails, with this patch it works again. - -Signed-off-by: Adrian Reber ---- - .../arch/x86/src/lib/include/uapi/asm/fpu.h | 28 +++++++++++++++++-- - 1 file changed, 26 insertions(+), 2 deletions(-) - -diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -index bd3b0cbd5c..8c83dd9ae4 100644 ---- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -+++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h -@@ -21,7 +21,28 @@ - #define XSTATE_YMM 0x4 - - #define FXSAVE_SIZE 512 --#define XSAVE_SIZE 4096 -+/* -+ * This used to be 4096 (one page). There is a comment below concerning -+ * this size: -+ * "One page should be enough for the whole xsave state ;-)" -+ * Which is kind of funny as it is no longer enough ;-) -+ * -+ * Older CPUs: -+ * # cpuid -1 -l 0xd -s 0 -+ * ... -+ * bytes required by XSAVE/XRSTOR area = 0x00000988 (2440) -+ * -+ * Newer CPUs (Sapphire Rapids): -+ * # cpuid -1 -l 0xd -s 0 -+ * ... -+ * bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008) -+ * -+ * So one page is no longer enough... But: -+ * -+ * Four pages should be enough for the whole xsave state ;-) -+ */ -+ -+#define XSAVE_SIZE 4*4096 - - #define XSAVE_HDR_SIZE 64 - #define XSAVE_HDR_OFFSET FXSAVE_SIZE -@@ -235,8 +256,11 @@ struct pkru_state { - * - * - * One page should be enough for the whole xsave state ;-) -+ * -+ * Of course it was not ;-) Now using four pages... -+ * - */ --#define EXTENDED_STATE_AREA_SIZE (4096 - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) -+#define EXTENDED_STATE_AREA_SIZE (XSAVE_SIZE - sizeof(struct i387_fxsave_struct) - sizeof(struct xsave_hdr_struct)) - - /* - * cpu requires it to be 64 byte aligned diff --git a/kernel65-s390x.patch b/kernel65-s390x.patch deleted file mode 100644 index 9aaad77..0000000 --- a/kernel65-s390x.patch +++ /dev/null @@ -1,26 +0,0 @@ -https://github.com/checkpoint-restore/criu/pull/2232 - -diff --git a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -index 87283bc6b..6d55a015f 100644 ---- a/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -+++ b/compel/arch/s390/src/lib/include/uapi/asm/infect-types.h -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include - #include "common/page.h" - -diff --git a/criu/arch/s390/include/asm/restorer.h b/criu/arch/s390/include/asm/restorer.h -index b8472afc8..1a6469837 100644 ---- a/criu/arch/s390/include/asm/restorer.h -+++ b/criu/arch/s390/include/asm/restorer.h -@@ -1,6 +1,7 @@ - #ifndef __CR_ASM_RESTORER_H__ - #define __CR_ASM_RESTORER_H__ - -+#include - #include - #include - diff --git a/sources b/sources index 045b206..bb80cdd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.18.tar.gz) = 3d15554ebd2d08c8904c23b0aba00d505891c14caa4790c2fd12ad6b20bf4058fd210f1d03fd63aacc5ad8bc47e341396b48abbeb474f1fd43c3023fd1ff9171 +SHA512 (criu-3.19.tar.gz) = d243818cdac51580c952a80e9164786a67ce5e294c0faa6dc700f5e8da8e36495f0b64f5c27b345ede7d6697ed7a69fa4e9a85cef451f32e3ffeb78564884571 From 1143b7ede1d22c91272da77022d2d79096a0f49f Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 15:15:37 +0100 Subject: [PATCH 07/53] Fix Python libraries Signed-off-by: Adrian Reber --- criu.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index f7383e2..903f916 100644 --- a/criu.spec +++ b/criu.spec @@ -110,8 +110,7 @@ make docs V=1 %install -sed -e "s,--upgrade --force-reinstall,--disable-pip-version-check --progress-bar off --verbose,g" -i lib/Makefile -rm -f crit/pyproject.toml +sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} From 49bf9133bf83873b4ba2218ea1d4fb22cead960c Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 15:28:04 +0100 Subject: [PATCH 08/53] python3-protobuf is now also required during build-time Signed-off-by: Adrian Reber --- criu.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/criu.spec b/criu.spec index 903f916..96b53cd 100644 --- a/criu.spec +++ b/criu.spec @@ -32,6 +32,7 @@ BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel l BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools BuildRequires: %{py_prefix}-wheel +BuildRequires: %{py_prefix}-protobuf BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel From e6dcdedc24310b44377ba4ddfebf4d1d98b16254 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 28 Nov 2023 17:07:58 +0100 Subject: [PATCH 09/53] Fix test setup Signed-off-by: Adrian Reber --- criu.spec | 5 ++++- tests/run-zdtm.sh | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 96b53cd..fc7c466 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Nov 28 2023 Adrian Reber - 3.19-2 +- Fix test setup + * Tue Nov 28 2023 Adrian Reber - 3.19-1 - Update to 3.19 diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 58a1143..56fc8ec 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -18,6 +18,9 @@ EXCLUDES=" \ -x zdtm/static/netns_sub \ -x zdtm/static/netns_sub_veth \ -x zdtm/static/file_locks01 \ + -x zdtm/static/mntns_link_remap \ + -x zdtm/static/unlink_fstat03 \ + -x zdtm/static/unlink_regular00 \ -x zdtm/static/cgroup02 " run_test() { From b9573a9dde28eb242d05d72e1ef0d21077d1b7f2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 16:22:09 +0000 Subject: [PATCH 10/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index fc7c466..069313d 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 3.19-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Tue Nov 28 2023 Adrian Reber - 3.19-2 - Fix test setup From 9c81549f7c39102b9c14f7e2890fe237413aadc4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 24 Jan 2024 08:25:54 +0000 Subject: [PATCH 11/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 069313d..124125c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jan 24 2024 Fedora Release Engineering - 3.19-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 3.19-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 050d3e5ab64f466429248ddcdc6a49cd76e3829f Mon Sep 17 00:00:00 2001 From: Python Maint Date: Sat, 8 Jun 2024 10:28:10 +0200 Subject: [PATCH 12/53] Rebuilt for Python 3.13 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 124125c..bded088 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -156,6 +156,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Sat Jun 08 2024 Python Maint - 3.19-5 +- Rebuilt for Python 3.13 + * Wed Jan 24 2024 Fedora Release Engineering - 3.19-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From dc9cdd23f3453af3ec7e77d0d8ab33cb06f2c32d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 18:57:41 +0100 Subject: [PATCH 13/53] test: fix run-zdtm.sh Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 56fc8ec..aed8136 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -40,7 +40,7 @@ python -V # this socket brakes CRIU's test cases rm -f /var/lib/sss/pipes/nss -cd source +cd "source/criu-$(crit --version)/" echo "Build CRIU" make From c9cb1e293f99e90ec55c50676a20ec4d465d0c45 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 18:59:24 +0100 Subject: [PATCH 14/53] test/run-zdtm: exit immediately on non-zero status Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index aed8136..9368312 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -x +set -xe uname -a From 5086e04ef3df865f31c516a196d790303c57ffb7 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 19:00:41 +0100 Subject: [PATCH 15/53] test/run-zdtm: drop compatibility with python2 Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 9368312..ee4cc97 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -24,7 +24,7 @@ EXCLUDES=" \ -x zdtm/static/cgroup02 " run_test() { - ./zdtm.py run --criu-bin /usr/sbin/criu ${EXCLUDES} \ + python3 ./zdtm.py run --criu-bin /usr/sbin/criu ${EXCLUDES} \ -a --ignore-taint --keep-going RESULT=$? @@ -33,10 +33,6 @@ run_test() { RESULT=42 -# F30, F29 do not provide python -> python3 symlink -test -e /usr/bin/python || ln -sf /usr/bin/python3 /usr/bin/python -python -V - # this socket brakes CRIU's test cases rm -f /var/lib/sss/pipes/nss From e7c93aa9e29eec657f5b6191a45f9cf816fe356e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 12 Jul 2024 19:02:08 +0100 Subject: [PATCH 16/53] test/run-zdtm: run make with parallel jobs Signed-off-by: Radostin Stoyanov --- tests/run-zdtm.sh | 2 +- tests/tests.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index ee4cc97..460d090 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -39,7 +39,7 @@ rm -f /var/lib/sss/pipes/nss cd "source/criu-$(crit --version)/" echo "Build CRIU" -make +make -j"$(nproc)" cd test diff --git a/tests/tests.yml b/tests/tests.yml index 6e498e2..995fd2d 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -16,6 +16,7 @@ - make - gcc - python3 + - coreutils - libnet-devel - protobuf-devel - protobuf-c-devel From 48cbddd4fb7a3b4e5c3c9632445aa9f5428bdf98 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 9 Jul 2024 12:18:37 +0100 Subject: [PATCH 17/53] Add package for amdgpu-plugin Signed-off-by: Radostin Stoyanov --- criu.spec | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index bded088..cd2f2e4 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -37,6 +37,7 @@ BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel +BuildRequires: libdrm-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar %if 0%{?fedora} @@ -70,6 +71,13 @@ Requires: %{name} = %{version}-%{release} %description libs This package contains the libraries for %{name} +%package amdgpu-plugin +Summary: AMD GPU plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description amdgpu-plugin +This package contains the AMD GPU plugin for %{name} + %package -n %{py_prefix}-%{name} %{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} @@ -106,7 +114,8 @@ This script can help to workaround the so called "PID mismatch" problem. # %{?_smp_mflags} does not work # -fstack-protector breaks build -CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} PLUGINDIR=%{_libdir}/criu +make V=1 WERROR=0 PREFIX=%{_prefix} PLUGINDIR=%{_libdir}/criu amdgpu_plugin make docs V=1 @@ -114,15 +123,18 @@ make docs V=1 sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-amdgpu-plugin.1 mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ +# Fix rpmlint W: unstripped-binary-or-object /usr/lib64/criu/amdgpu_plugin.so +chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/amdgpu_plugin.so + # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a @@ -142,6 +154,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %files libs %{_libdir}/*.so.* +%files amdgpu-plugin +%{_libdir}/%{name}/amdgpu_plugin.so +%doc %{_mandir}/man1/criu-amdgpu-plugin.1* + %files -n %{py_prefix}-%{name} %{python3_sitelib}/pycriu* @@ -156,6 +172,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Tue Jul 09 2024 Radostin Stoyanov - 3.19-6 +- Add package for amdgpu-plugin + * Sat Jun 08 2024 Python Maint - 3.19-5 - Rebuilt for Python 3.13 From 83547af2bd965532be883aaffac2891fdf9ea01b Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 9 Jul 2024 19:06:48 +0100 Subject: [PATCH 18/53] Apply docs-update-amdgpu-plugin-man-page patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 ++ docs-update-amdgpu-plugin-man-page.patch | 38 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 docs-update-amdgpu-plugin-man-page.patch diff --git a/criu.spec b/criu.spec index cd2f2e4..df677d2 100644 --- a/criu.spec +++ b/criu.spec @@ -22,6 +22,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # We use this patch because the protobuf-c package name # in RPM and DEB is different. Patch99: criu.pc.patch +Patch100: docs-update-amdgpu-plugin-man-page.patch Source5: criu-tmpfiles.conf @@ -106,6 +107,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q %patch -P 99 -p1 +%patch -P 100 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/docs-update-amdgpu-plugin-man-page.patch b/docs-update-amdgpu-plugin-man-page.patch new file mode 100644 index 0000000..35a7abc --- /dev/null +++ b/docs-update-amdgpu-plugin-man-page.patch @@ -0,0 +1,38 @@ +From eb4e68e5df4ce1ae4e362af012b1f464ecc63422 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 9 Jul 2024 12:22:25 +0100 +Subject: [PATCH] docs: update amdgpu-plugin man page + +This patch updates the dependencies section of the AMDGPU plugin man +page to reflect that the plugin has been merged upstream and to fix a +formatting issue. + +Signed-off-by: Radostin Stoyanov +--- + Documentation/criu-amdgpu-plugin.txt | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/Documentation/criu-amdgpu-plugin.txt b/Documentation/criu-amdgpu-plugin.txt +index 35321a915..68803f3db 100644 +--- a/Documentation/criu-amdgpu-plugin.txt ++++ b/Documentation/criu-amdgpu-plugin.txt +@@ -27,14 +27,10 @@ to criu to allow Checkpoint / Restore with ROCm. + + + Dependencies +-~~~~~~~~~~~~~~ ++------------ + *amdkfd support*:: + In order to snapshot the *VRAM* and other *GPU* device states, we require +- an updated version of amdkfd(amdgpu) driver. The kernel patches are under +- review currently. +- +-*criu 3.16*:: +- This work is rebased on latest criu release available at this time. ++ an updated version of amdkfd(amdgpu) driver. + + OPTIONS + ------- +-- +2.45.2 + From 3a4a2b89bc53d1a5f0ea090c6b89996b82deaa93 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 17:11:55 +0100 Subject: [PATCH 19/53] Apply plugins-amdgpu-don-t-print-error-for-no-such-process patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 ++ ...n-t-print-error-for-no-such-process-.patch | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 plugins-amdgpu-don-t-print-error-for-no-such-process-.patch diff --git a/criu.spec b/criu.spec index df677d2..3d1b519 100644 --- a/criu.spec +++ b/criu.spec @@ -23,6 +23,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # in RPM and DEB is different. Patch99: criu.pc.patch Patch100: docs-update-amdgpu-plugin-man-page.patch +Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch Source5: criu-tmpfiles.conf @@ -108,6 +109,7 @@ This script can help to workaround the so called "PID mismatch" problem. %setup -q %patch -P 99 -p1 %patch -P 100 -p1 +%patch -P 101 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch b/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch new file mode 100644 index 0000000..eaa03fa --- /dev/null +++ b/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch @@ -0,0 +1,35 @@ +From a9cbdad76fa6daf95ea38bd1d5f912d260a84aed Mon Sep 17 00:00:00 2001 +From: David Francis +Date: Tue, 30 Jan 2024 14:59:48 -0500 +Subject: [PATCH] plugin/amdgpu: Don't print error for "No such process" during + resume + +During the late stages of restore, each process being resumed gets +an ioctl call to KFD_CRIU_OP_RESUME. If the process has no kfd +process info, this call with fail with -ESRCH. This is normal +behaviour, so we shouldn't print an error message for it. + +Signed-off-by: David Francis +--- + plugins/amdgpu/amdgpu_plugin.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 32ff8f936..3675353a7 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -1999,7 +1999,10 @@ int amdgpu_plugin_resume_devices_late(int target_pid) + args.op = KFD_CRIU_OP_RESUME; + pr_info("Calling IOCTL to start notifiers and queues\n"); + if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { +- pr_perror("restore late ioctl failed"); ++ if (errno == ESRCH) ++ pr_info("Pid %d has no kfd process info\n", target_pid); ++ else ++ pr_perror("restore late ioctl failed"); + ret = -1; + } + +-- +2.45.1 + From 56dd1e4573eb2b1bb827831f832faee72e2b012a Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 17:13:18 +0100 Subject: [PATCH 20/53] Apply plugins-amdgpu-also-don-t-print-plugin-failed-in-criu patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 + ...so-don-t-print-plugin-failed-in-criu.patch | 54 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch diff --git a/criu.spec b/criu.spec index 3d1b519..e3e9daa 100644 --- a/criu.spec +++ b/criu.spec @@ -24,6 +24,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v Patch99: criu.pc.patch Patch100: docs-update-amdgpu-plugin-man-page.patch Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch +Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch Source5: criu-tmpfiles.conf @@ -110,6 +111,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 99 -p1 %patch -P 100 -p1 %patch -P 101 -p1 +%patch -P 102 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch b/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch new file mode 100644 index 0000000..232fd1d --- /dev/null +++ b/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch @@ -0,0 +1,54 @@ +From 639068ecab26096092d460d6bbed10bedb5da0c4 Mon Sep 17 00:00:00 2001 +From: Pavel Tikhomirov +Date: Mon, 5 Feb 2024 11:17:40 +0800 +Subject: [PATCH] plugin/amdgpu: Also don't print 'plugin failed' in criu + +We already don't treat it as error in the plugin itself, but after +returning -1 from RESUME_DEVICES_LATE hook we print debug message in +criu about failed plugin, let's return 0 instead. + +While on it let's replace ret to exit_code. + +Fixes: a9cbdad76 ("plugin/amdgpu: Don't print error for "No such process" during resume") +Signed-off-by: Pavel Tikhomirov +--- + plugins/amdgpu/amdgpu_plugin.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 3675353a7..23253632d 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -1985,7 +1985,7 @@ CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, amdgpu_plugin_update_vma + int amdgpu_plugin_resume_devices_late(int target_pid) + { + struct kfd_ioctl_criu_args args = { 0 }; +- int fd, ret = 0; ++ int fd, exit_code = 0; + + pr_info("Inside %s for target pid = %d\n", __func__, target_pid); + +@@ -1999,15 +1999,16 @@ int amdgpu_plugin_resume_devices_late(int target_pid) + args.op = KFD_CRIU_OP_RESUME; + pr_info("Calling IOCTL to start notifiers and queues\n"); + if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { +- if (errno == ESRCH) ++ if (errno == ESRCH) { + pr_info("Pid %d has no kfd process info\n", target_pid); +- else ++ } else { + pr_perror("restore late ioctl failed"); +- ret = -1; ++ exit_code = -1; ++ } + } + + close(fd); +- return ret; ++ return exit_code; + } + + CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, amdgpu_plugin_resume_devices_late) +-- +2.45.1 + From 11ad4992a4d524af6c1b332f3bcaa3220a21fbd3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:59:20 +0100 Subject: [PATCH 21/53] Apply plugins-amdgpu-refactor-code-in-preparation-to-suppor patch Signed-off-by: Radostin Stoyanov --- criu.spec | 4 + ...factor-code-in-preparation-to-suppor.patch | 1013 +++++++++++++++++ 2 files changed, 1017 insertions(+) create mode 100644 plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch diff --git a/criu.spec b/criu.spec index e3e9daa..2b17422 100644 --- a/criu.spec +++ b/criu.spec @@ -25,6 +25,8 @@ Patch99: criu.pc.patch Patch100: docs-update-amdgpu-plugin-man-page.patch Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch +Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch +Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch Source5: criu-tmpfiles.conf @@ -112,6 +114,8 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 100 -p1 %patch -P 101 -p1 %patch -P 102 -p1 +%patch -P 103 -p1 +%patch -P 104 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch b/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch new file mode 100644 index 0000000..c83be02 --- /dev/null +++ b/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch @@ -0,0 +1,1013 @@ +From 81f2c41df6ffee7e4962b1facb17c327676285cc Mon Sep 17 00:00:00 2001 +From: Ramesh Errabolu +Date: Fri, 10 Nov 2023 11:36:34 -0600 +Subject: [PATCH] amdgpu_plugin: Refactor code in preparation to support C&R + for DRM devices + +Add a new compilation unit to host symbols and methods that will be +needed to C&R DRM devices. Refactor code that indicates support for +C&R and checkpoints KFD and DRM devices + +Signed-off-by: Ramesh Errabolu +--- + plugins/amdgpu/Makefile | 2 +- + plugins/amdgpu/amdgpu_plugin.c | 245 ++++-------------------- + plugins/amdgpu/amdgpu_plugin_drm.c | 63 ++++++ + plugins/amdgpu/amdgpu_plugin_drm.h | 22 +++ + plugins/amdgpu/amdgpu_plugin_topology.c | 41 ++-- + plugins/amdgpu/amdgpu_plugin_topology.h | 2 + + plugins/amdgpu/amdgpu_plugin_util.c | 208 ++++++++++++++++++++ + plugins/amdgpu/amdgpu_plugin_util.h | 106 ++++++++++ + plugins/amdgpu/criu-amdgpu.proto | 18 +- + 9 files changed, 460 insertions(+), 247 deletions(-) + create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.c + create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.h + create mode 100755 plugins/amdgpu/amdgpu_plugin_util.c + create mode 100755 plugins/amdgpu/amdgpu_plugin_util.h + +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +index 64a923d38..5efa8fb0b 100644 +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -28,7 +28,7 @@ endif + criu-amdgpu.pb-c.c: criu-amdgpu.proto + protoc-c --proto_path=. --c_out=. criu-amdgpu.proto + +-amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_topology.c criu-amdgpu.pb-c.c ++amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c + $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC) + + amdgpu_plugin_clean: +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 23253632d..60e04f973 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -30,55 +30,14 @@ + #include "files.h" + + #include "common/list.h" ++#include "amdgpu_plugin_drm.h" ++#include "amdgpu_plugin_util.h" + #include "amdgpu_plugin_topology.h" + + #include "img-streamer.h" + #include "image.h" + #include "cr_options.h" + +-#define AMDGPU_KFD_DEVICE "/dev/kfd" +-#define PROCPIDMEM "/proc/%d/mem" +-#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" +-#define HSAKMT_SHM "/hsakmt_shared_mem" +-#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" +-#define HSAKMT_SEM "hsakmt_semaphore" +- +-#define KFD_IOCTL_MAJOR_VERSION 1 +-#define MIN_KFD_IOCTL_MINOR_VERSION 8 +- +-#define IMG_KFD_FILE "amdgpu-kfd-%d.img" +-#define IMG_RENDERD_FILE "amdgpu-renderD-%d.img" +-#define IMG_PAGES_FILE "amdgpu-pages-%d-%04x.img" +- +-#ifndef _GNU_SOURCE +-#define _GNU_SOURCE 1 +-#endif +- +-#ifdef LOG_PREFIX +-#undef LOG_PREFIX +-#endif +-#define LOG_PREFIX "amdgpu_plugin: " +- +-#ifdef DEBUG +-#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) +-#else +-#define plugin_log_msg(fmt, ...) \ +- { \ +- } +-#endif +- +-#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) +- +-#define SDMA_OPCODE_COPY 1 +-#define SDMA_COPY_SUB_OPCODE_LINEAR 0 +-#define SDMA_NOP 0 +-#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) +- +-enum sdma_op_type { +- SDMA_OP_VRAM_READ, +- SDMA_OP_VRAM_WRITE, +-}; +- + struct vma_metadata { + struct list_head list; + uint64_t old_pgoff; +@@ -89,143 +48,13 @@ struct vma_metadata { + }; + + /************************************ Global Variables ********************************************/ +-struct tp_system src_topology; +-struct tp_system dest_topology; +- +-struct device_maps checkpoint_maps; +-struct device_maps restore_maps; +- +-extern int fd_next; + + static LIST_HEAD(update_vma_info_list); + +-extern bool kfd_fw_version_check; +-extern bool kfd_sdma_fw_version_check; +-extern bool kfd_caches_count_check; +-extern bool kfd_num_gws_check; +-extern bool kfd_vram_size_check; +-extern bool kfd_numa_check; +-extern bool kfd_capability_check; +- + size_t kfd_max_buffer_size; + + /**************************************************************************************************/ + +-int write_fp(FILE *fp, const void *buf, const size_t buf_len) +-{ +- size_t len_write; +- +- len_write = fwrite(buf, 1, buf_len, fp); +- if (len_write != buf_len) { +- pr_perror("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); +- return -EIO; +- } +- return 0; +-} +- +-int read_fp(FILE *fp, void *buf, const size_t buf_len) +-{ +- size_t len_read; +- +- len_read = fread(buf, 1, buf_len, fp); +- if (len_read != buf_len) { +- pr_perror("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); +- return -EIO; +- } +- return 0; +-} +- +-/** +- * @brief Open an image file +- * +- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to +- * determine the file size when using criu_image_streamer when fseek and fstat are not available. +- * The FILE * returned is already at the location of the first actual contents. +- * +- * @param path The file path +- * @param write False for read, true for write +- * @param size Size of actual contents +- * @return FILE *if successful, NULL if failed +- */ +-FILE *open_img_file(char *path, bool write, size_t *size) +-{ +- FILE *fp = NULL; +- int fd, ret; +- +- if (opts.stream) +- fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); +- else +- fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); +- +- if (fd < 0) { +- pr_perror("%s: Failed to open for %s", path, write ? "write" : "read"); +- return NULL; +- } +- +- fp = fdopen(fd, write ? "w" : "r"); +- if (!fp) { +- pr_perror("%s: Failed get pointer for %s", path, write ? "write" : "read"); +- close(fd); +- return NULL; +- } +- +- if (write) +- ret = write_fp(fp, size, sizeof(*size)); +- else +- ret = read_fp(fp, size, sizeof(*size)); +- +- if (ret) { +- pr_perror("%s:Failed to access file size", path); +- fclose(fp); +- return NULL; +- } +- +- pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); +- return fp; +-} +- +-/** +- * @brief Write an image file +- * +- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to +- * determine the file size when using criu_image_streamer when fseek and fstat are not available. +- * +- * @param path The file path +- * @param buf pointer to data to be written +- * @param buf_len size of buf +- * @return 0 if successful. -errno on failure +- */ +-int write_img_file(char *path, const void *buf, const size_t buf_len) +-{ +- int ret; +- FILE *fp; +- size_t len = buf_len; +- +- fp = open_img_file(path, true, &len); +- if (!fp) +- return -errno; +- +- ret = write_fp(fp, buf, buf_len); +- fclose(fp); /* this will also close fd */ +- return ret; +-} +- +-int read_file(const char *file_path, void *buf, const size_t buf_len) +-{ +- int ret; +- FILE *fp; +- +- fp = fopen(file_path, "r"); +- if (!fp) { +- pr_perror("Cannot fopen %s", file_path); +- return -errno; +- } +- +- ret = read_fp(fp, buf, buf_len); +- fclose(fp); /* this will also close fd */ +- return ret; +-} +- + /* Call ioctl, restarting if it is interrupted */ + int kmtIoctl(int fd, unsigned long request, void *arg) + { +@@ -263,21 +92,21 @@ static void free_e(CriuKfd *e) + + static int allocate_device_entries(CriuKfd *e, int num_of_devices) + { +- e->device_entries = xmalloc(sizeof(DeviceEntry *) * num_of_devices); ++ e->device_entries = xmalloc(sizeof(KfdDeviceEntry *) * num_of_devices); + if (!e->device_entries) { + pr_err("Failed to allocate device_entries\n"); + return -ENOMEM; + } + + for (int i = 0; i < num_of_devices; i++) { +- DeviceEntry *entry = xzalloc(sizeof(*entry)); ++ KfdDeviceEntry *entry = xzalloc(sizeof(*entry)); + + if (!entry) { + pr_err("Failed to allocate entry\n"); + return -ENOMEM; + } + +- device_entry__init(entry); ++ kfd_device_entry__init(entry); + + e->device_entries[i] = entry; + e->n_device_entries++; +@@ -287,21 +116,21 @@ static int allocate_device_entries(CriuKfd *e, int num_of_devices) + + static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucket *bo_bucket_ptr) + { +- e->bo_entries = xmalloc(sizeof(BoEntry *) * num_bos); ++ e->bo_entries = xmalloc(sizeof(KfdBoEntry *) * num_bos); + if (!e->bo_entries) { + pr_err("Failed to allocate bo_info\n"); + return -ENOMEM; + } + + for (int i = 0; i < num_bos; i++) { +- BoEntry *entry = xzalloc(sizeof(*entry)); ++ KfdBoEntry *entry = xzalloc(sizeof(*entry)); + + if (!entry) { + pr_err("Failed to allocate botest\n"); + return -ENOMEM; + } + +- bo_entry__init(entry); ++ kfd_bo_entry__init(entry); + + e->bo_entries[i] = entry; + e->n_bo_entries++; +@@ -309,13 +138,13 @@ static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucke + return 0; + } + +-int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceEntry **deviceEntries) ++int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDeviceEntry **deviceEntries) + { + uint32_t devinfo_index = 0; + struct tp_node *node; + + list_for_each_entry(node, &sys->nodes, listm_system) { +- DeviceEntry *devinfo = deviceEntries[devinfo_index++]; ++ KfdDeviceEntry *devinfo = deviceEntries[devinfo_index++]; + + devinfo->node_id = node->id; + +@@ -383,11 +212,11 @@ int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceE + return 0; + } + +-int devinfo_to_topology(DeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) ++int devinfo_to_topology(KfdDeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) + { + for (int i = 0; i < num_devices; i++) { + struct tp_node *node; +- DeviceEntry *devinfo = devinfos[i]; ++ KfdDeviceEntry *devinfo = devinfos[i]; + + node = sys_add_node(sys, devinfo->node_id, devinfo->gpu_id); + if (!node) +@@ -549,7 +378,7 @@ struct thread_data { + uint32_t gpu_id; + pid_t pid; + struct kfd_criu_bo_bucket *bo_buckets; +- BoEntry **bo_entries; ++ KfdBoEntry **bo_entries; + int drm_fd; + int ret; + int id; /* File ID used by CRIU to identify KFD image for this process */ +@@ -557,8 +386,7 @@ struct thread_data { + + int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) + { +- struct stat st_kfd, st_dri_min; +- char img_path[128]; ++ struct stat st_kfd; + int ret = 0; + + pr_debug("Enter %s\n", __func__); +@@ -568,27 +396,18 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) + return ret; + } + +- snprintf(img_path, sizeof(img_path), "/dev/dri/renderD%d", DRM_FIRST_RENDER_NODE); +- +- ret = stat(img_path, &st_dri_min); +- if (ret == -1) { +- pr_perror("stat error for %s", img_path); +- return ret; +- } +- +- if (major(st_buf->st_rdev) == major(st_kfd.st_rdev) || ((major(st_buf->st_rdev) == major(st_dri_min.st_rdev)) && +- (minor(st_buf->st_rdev) >= minor(st_dri_min.st_rdev) && +- minor(st_buf->st_rdev) >= DRM_FIRST_RENDER_NODE))) { ++ /* If input device is KFD return device as supported */ ++ if (major(st_buf->st_rdev) == major(st_kfd.st_rdev)) { + pr_debug("Known non-regular mapping, kfd-renderD%d -> OK\n", minor(st_buf->st_rdev)); +- pr_debug("AMD KFD(maj) = %d, DRI(maj,min) = %d:%d VMA Device fd(maj,min) = %d:%d\n", +- major(st_kfd.st_rdev), major(st_dri_min.st_rdev), minor(st_dri_min.st_rdev), +- major(st_buf->st_rdev), minor(st_buf->st_rdev)); +- /* VMA belongs to kfd */ + return 0; + } + +- pr_perror("Can't handle the VMA mapping"); +- return -ENOTSUP; ++ /* Determine if input is a DRM device and therefore is supported */ ++ ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); ++ if (ret) ++ pr_perror("%s(), Can't handle VMAs of input device\n", __func__); ++ ++ return ret; + } + CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, amdgpu_plugin_handle_device_vma) + +@@ -655,8 +474,9 @@ void free_and_unmap(uint64_t size, amdgpu_bo_handle h_bo, amdgpu_va_handle h_va, + amdgpu_bo_free(h_bo); + } + +-int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, void *buffer, size_t buffer_size, +- amdgpu_device_handle h_dev, uint64_t max_copy_size, enum sdma_op_type type) ++static int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, ++ void *buffer, size_t buffer_size, amdgpu_device_handle h_dev, ++ uint64_t max_copy_size, enum sdma_op_type type) + { + uint64_t size, src_bo_size, dst_bo_size, buffer_bo_size, bytes_remain, buffer_space_remain; + uint64_t gpu_addr_src, gpu_addr_dst, gpu_addr_ib, copy_src, copy_dst, copy_size; +@@ -954,7 +774,7 @@ void *dump_bo_contents(void *_thread_data) + goto exit; + } + +- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); ++ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); + bo_contents_fp = open_img_file(img_path, true, &image_size); + if (!bo_contents_fp) { + pr_perror("Cannot fopen %s", img_path); +@@ -1027,7 +847,7 @@ void *restore_bo_contents(void *_thread_data) + max_copy_size = (gpu_info.family_id >= AMDGPU_FAMILY_AI) ? SDMA_LINEAR_COPY_MAX_SIZE : + SDMA_LINEAR_COPY_MAX_SIZE - 1; + +- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); ++ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); + bo_contents_fp = open_img_file(img_path, false, &image_size); + if (!bo_contents_fp) { + pr_perror("Cannot fopen %s", img_path); +@@ -1234,7 +1054,7 @@ static int save_bos(int id, int fd, struct kfd_ioctl_criu_args *args, struct kfd + + for (i = 0; i < e->num_of_bos; i++) { + struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; +- BoEntry *boinfo = e->bo_entries[i]; ++ KfdBoEntry *boinfo = e->bo_entries[i]; + + boinfo->gpu_id = bo_bucket->gpu_id; + boinfo->addr = bo_bucket->addr; +@@ -1391,7 +1211,7 @@ int amdgpu_plugin_dump_file(int fd, int id) + + criu_render_node__pack(&rd, buf); + +- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); ++ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); + ret = write_img_file(img_path, buf, len); + if (ret) { + xfree(buf); +@@ -1399,6 +1219,7 @@ int amdgpu_plugin_dump_file(int fd, int id) + } + + xfree(buf); ++ + /* Need to return success here so that criu can call plugins for renderD nodes */ + return ret; + } +@@ -1531,7 +1352,7 @@ static int restore_devices(struct kfd_ioctl_criu_args *args, CriuKfd *e) + + for (int entries_i = 0; entries_i < e->num_of_cpus + e->num_of_gpus; entries_i++) { + struct kfd_criu_device_bucket *device_bucket; +- DeviceEntry *devinfo = e->device_entries[entries_i]; ++ KfdDeviceEntry *devinfo = e->device_entries[entries_i]; + struct tp_node *tp_node; + + if (!devinfo->gpu_id) +@@ -1581,7 +1402,7 @@ static int restore_bos(struct kfd_ioctl_criu_args *args, CriuKfd *e) + + for (int i = 0; i < args->num_bos; i++) { + struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; +- BoEntry *bo_entry = e->bo_entries[i]; ++ KfdBoEntry *bo_entry = e->bo_entries[i]; + + bo_bucket->gpu_id = bo_entry->gpu_id; + bo_bucket->addr = bo_entry->addr; +@@ -1736,7 +1557,7 @@ int amdgpu_plugin_restore_file(int id) + * TODO: Currently, this code will only work if this function is called for /dev/kfd + * first as we assume restore_maps is already filled. Need to fix this later. + */ +- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); ++ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); + pr_info("Restoring RenderD %s\n", img_path); + + img_fp = open_img_file(img_path, false, &img_size); +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c +new file mode 100644 +index 000000000..a48dc68f0 +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_drm.c +@@ -0,0 +1,63 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "common/list.h" ++ ++#include "criu-amdgpu.pb-c.h" ++ ++#include ++#include ++ ++#include "xmalloc.h" ++#include "criu-log.h" ++#include "kfd_ioctl.h" ++#include "amdgpu_plugin_drm.h" ++#include "amdgpu_plugin_util.h" ++#include "amdgpu_plugin_topology.h" ++ ++ ++int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) ++{ ++ char path[PATH_MAX]; ++ struct stat drm; ++ int ret = 0; ++ ++ snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); ++ ret = stat(path, &drm); ++ if (ret == -1) { ++ pr_err("Error in getting stat for: %s", path); ++ return ret; ++ } ++ ++ if ((major(st->st_rdev) != major(drm.st_rdev)) || ++ (minor(st->st_rdev) < minor(drm.st_rdev)) || ++ (minor(st->st_rdev) > DRM_LAST_RENDER_NODE)) { ++ pr_err("Can't handle VMA mapping of input device\n"); ++ return -ENOTSUP; ++ } ++ ++ pr_debug("AMD DRI(maj,min) = %d:%d VMA Device FD(maj,min) = %d:%d\n", ++ major(drm.st_rdev), minor(drm.st_rdev), ++ major(st->st_rdev), minor(st->st_rdev)); ++ ++ return 0; ++} ++ ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h +new file mode 100644 +index 000000000..37009c8ba +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_drm.h +@@ -0,0 +1,22 @@ ++#ifndef __AMDGPU_PLUGIN_DRM_H__ ++#define __AMDGPU_PLUGIN_DRM_H__ ++ ++#include ++#include "common/list.h" ++ ++#include "xmalloc.h" ++#include "criu-log.h" ++#include "kfd_ioctl.h" ++#include "amdgpu_plugin_util.h" ++#include "amdgpu_plugin_topology.h" ++ ++ ++/** ++ * Determines if VMA's of input file descriptor belong to amdgpu's ++ * DRM device and are therefore supported ++ */ ++int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); ++ ++ ++#endif /* __AMDGPU_PLUGIN_DRM_H__ */ ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_topology.c b/plugins/amdgpu/amdgpu_plugin_topology.c +index ef79e5ef4..c5fa51fda 100644 +--- a/plugins/amdgpu/amdgpu_plugin_topology.c ++++ b/plugins/amdgpu/amdgpu_plugin_topology.c +@@ -16,35 +16,11 @@ + + #include "xmalloc.h" + #include "kfd_ioctl.h" ++#include "amdgpu_plugin_util.h" + #include "amdgpu_plugin_topology.h" + + #define TOPOLOGY_PATH "/sys/class/kfd/kfd/topology/nodes/" + +-#ifndef _GNU_SOURCE +-#define _GNU_SOURCE 1 +-#endif +- +-#ifdef COMPILE_TESTS +-#undef pr_err +-#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) +-#undef pr_info +-#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) +-#undef pr_debug +-#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) +- +-#undef pr_perror +-#define pr_perror(format, arg...) \ +- fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) +-#endif +- +-#ifdef DEBUG +-#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) +-#else +-#define plugin_log_msg(fmt, ...) \ +- { \ +- } +-#endif +- + /* User override options */ + /* Skip firmware version check */ + bool kfd_fw_version_check = true; +@@ -840,6 +816,9 @@ void topology_free(struct tp_system *sys) + list_del(&p2pgroup->listm_system); + xfree(p2pgroup); + } ++ ++ /* Update Topology as being freed */ ++ sys->parsed = false; + } + + /** +@@ -1461,3 +1440,15 @@ int set_restore_gpu_maps(struct tp_system *src_sys, struct tp_system *dest_sys, + + return ret; + } ++ ++int topology_gpu_count(struct tp_system *sys) ++{ ++ struct tp_node *node; ++ int count = 0; ++ ++ list_for_each_entry(node, &sys->nodes, listm_system) ++ if (NODE_IS_GPU(node)) ++ count++; ++ return count; ++} ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_topology.h b/plugins/amdgpu/amdgpu_plugin_topology.h +index 9d99cda1c..c890e3dda 100644 +--- a/plugins/amdgpu/amdgpu_plugin_topology.h ++++ b/plugins/amdgpu/amdgpu_plugin_topology.h +@@ -107,6 +107,8 @@ int topology_parse(struct tp_system *topology, const char *msg); + int topology_determine_iolinks(struct tp_system *sys); + void topology_print(const struct tp_system *sys, const char *msg); + ++int topology_gpu_count(struct tp_system *topology); ++ + struct id_map *maps_add_gpu_entry(struct device_maps *maps, const uint32_t src_id, const uint32_t dest_id); + + struct tp_node *sys_add_node(struct tp_system *sys, uint32_t id, uint32_t gpu_id); +diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c +new file mode 100755 +index 000000000..48ff70555 +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_util.c +@@ -0,0 +1,208 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "common/list.h" ++ ++#include ++#include ++ ++#include "criu-plugin.h" ++#include "plugin.h" ++#include "criu-amdgpu.pb-c.h" ++ ++#include "img-streamer.h" ++#include "image.h" ++#include "cr_options.h" ++ ++#include "xmalloc.h" ++#include "criu-log.h" ++#include "kfd_ioctl.h" ++#include "amdgpu_drm.h" ++#include "amdgpu_plugin_util.h" ++#include "amdgpu_plugin_topology.h" ++ ++/* Tracks number of device files that need to be checkpointed */ ++static int dev_file_cnt = 0; ++ ++/* Helper structures to encode device topology of SRC and DEST platforms */ ++struct tp_system src_topology; ++struct tp_system dest_topology; ++ ++/* Helper structures to encode device maps during Checkpoint and Restore operations */ ++struct device_maps checkpoint_maps; ++struct device_maps restore_maps; ++ ++bool checkpoint_is_complete() ++{ ++ return (dev_file_cnt == 0); ++} ++ ++void decrement_checkpoint_count() ++{ ++ dev_file_cnt--; ++} ++ ++void init_gpu_count(struct tp_system *topo) ++{ ++ if (dev_file_cnt != 0) ++ return; ++ ++ /* We add ONE to include checkpointing of KFD device */ ++ dev_file_cnt = 1 + topology_gpu_count(topo); ++} ++ ++int read_fp(FILE *fp, void *buf, const size_t buf_len) ++{ ++ size_t len_read; ++ ++ len_read = fread(buf, 1, buf_len, fp); ++ if (len_read != buf_len) { ++ pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); ++ return -EIO; ++ } ++ return 0; ++} ++ ++int write_fp(FILE *fp, const void *buf, const size_t buf_len) ++{ ++ size_t len_write; ++ ++ len_write = fwrite(buf, 1, buf_len, fp); ++ if (len_write != buf_len) { ++ pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); ++ return -EIO; ++ } ++ return 0; ++} ++ ++/** ++ * @brief Open an image file ++ * ++ * We store the size of the actual contents in the first 8-bytes of ++ * the file. This allows us to determine the file size when using ++ * criu_image_streamer when fseek and fstat are not available. The ++ * FILE * returned is already at the location of the first actual ++ * contents. ++ * ++ * @param path The file path ++ * @param write False for read, true for write ++ * @param size Size of actual contents ++ * @return FILE *if successful, NULL if failed ++ */ ++FILE *open_img_file(char *path, bool write, size_t *size) ++{ ++ FILE *fp = NULL; ++ int fd, ret; ++ ++ if (opts.stream) ++ fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); ++ else ++ fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); ++ ++ if (fd < 0) { ++ pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); ++ return NULL; ++ } ++ ++ fp = fdopen(fd, write ? "w" : "r"); ++ if (!fp) { ++ pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); ++ return NULL; ++ } ++ ++ if (write) ++ ret = write_fp(fp, size, sizeof(*size)); ++ else ++ ret = read_fp(fp, size, sizeof(*size)); ++ ++ if (ret) { ++ pr_err("%s:Failed to access file size", path); ++ fclose(fp); ++ return NULL; ++ } ++ ++ pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); ++ return fp; ++} ++ ++int read_file(const char *file_path, void *buf, const size_t buf_len) ++{ ++ int ret; ++ FILE *fp; ++ ++ fp = fopen(file_path, "r"); ++ if (!fp) { ++ pr_err("Cannot fopen %s", file_path); ++ return -errno; ++ } ++ ++ ret = read_fp(fp, buf, buf_len); ++ fclose(fp); /* this will also close fd */ ++ return ret; ++} ++ ++ ++/** ++ * @brief Write an image file ++ * ++ * We store the size of the actual contents in the first 8-bytes of the file. This allows us to ++ * determine the file size when using criu_image_streamer when fseek and fstat are not available. ++ * ++ * @param path The file path ++ * @param buf pointer to data to be written ++ * @param buf_len size of buf ++ * @return 0 if successful. -errno on failure ++ */ ++int write_img_file(char *path, const void *buf, const size_t buf_len) ++{ ++ int ret; ++ FILE *fp; ++ size_t len = buf_len; ++ ++ fp = open_img_file(path, true, &len); ++ if (!fp) ++ return -errno; ++ ++ ret = write_fp(fp, buf, buf_len); ++ fclose(fp); /* this will also close fd */ ++ return ret; ++} ++ ++void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) ++{ ++ struct kfd_criu_bo_bucket *bo; ++ ++ pr_info("\n"); ++ for (int idx = 0; idx < bo_cnt; idx++) { ++ bo = &bo_list[idx]; ++ pr_info("\n"); ++ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); ++ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); ++ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); ++ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); ++ pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); ++ pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); ++ pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); ++ pr_info("\n"); ++ } ++ pr_info("\n"); ++} ++ ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_util.h b/plugins/amdgpu/amdgpu_plugin_util.h +new file mode 100755 +index 000000000..aacca3a28 +--- /dev/null ++++ b/plugins/amdgpu/amdgpu_plugin_util.h +@@ -0,0 +1,106 @@ ++#ifndef __AMDGPU_PLUGIN_UTIL_H__ ++#define __AMDGPU_PLUGIN_UTIL_H__ ++ ++#ifndef _GNU_SOURCE ++#define _GNU_SOURCE 1 ++#endif ++ ++#ifdef COMPILE_TESTS ++#undef pr_err ++#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) ++#undef pr_info ++#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) ++#undef pr_debug ++#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) ++ ++#undef pr_perror ++#define pr_perror(format, arg...) \ ++ fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) ++#endif ++ ++#ifdef LOG_PREFIX ++#undef LOG_PREFIX ++#endif ++#define LOG_PREFIX "amdgpu_plugin: " ++ ++#ifdef DEBUG ++#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) ++#else ++#define plugin_log_msg(fmt, ...) \ ++ { \ ++ } ++#endif ++ ++ ++/* Path where KFD device is surfaced */ ++#define AMDGPU_KFD_DEVICE "/dev/kfd" ++ ++/* Path where DRM devices are surfaced */ ++#define AMDGPU_DRM_DEVICE "/dev/dri/renderD%d" ++ ++/* Minimum version of KFD IOCTL's that supports C&R */ ++#define KFD_IOCTL_MAJOR_VERSION 1 ++#define MIN_KFD_IOCTL_MINOR_VERSION 8 ++ ++/* Name of file having serialized data of KFD device */ ++#define IMG_KFD_FILE "amdgpu-kfd-%d.img" ++ ++/* Name of file having serialized data of KFD buffer objects (BOs) */ ++#define IMG_KFD_PAGES_FILE "amdgpu-pages-%d-%04x.img" ++ ++/* Name of file having serialized data of DRM device */ ++#define IMG_DRM_FILE "amdgpu-renderD-%d.img" ++ ++/* Name of file having serialized data of DRM device buffer objects (BOs) */ ++#define IMG_DRM_PAGES_FILE "amdgpu-drm-pages-%d-%04x.img" ++ ++/* Helper macros to Checkpoint and Restore a ROCm file */ ++#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" ++#define HSAKMT_SHM "/hsakmt_shared_mem" ++#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" ++#define HSAKMT_SEM "hsakmt_semaphore" ++ ++/* Help macros to build sDMA command packets */ ++#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) ++ ++#define SDMA_OPCODE_COPY 1 ++#define SDMA_COPY_SUB_OPCODE_LINEAR 0 ++#define SDMA_NOP 0 ++#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) ++ ++enum sdma_op_type { ++ SDMA_OP_VRAM_READ, ++ SDMA_OP_VRAM_WRITE, ++}; ++ ++/* Helper structures to encode device topology of SRC and DEST platforms */ ++extern struct tp_system src_topology; ++extern struct tp_system dest_topology; ++ ++/* Helper structures to encode device maps during Checkpoint and Restore operations */ ++extern struct device_maps checkpoint_maps; ++extern struct device_maps restore_maps; ++ ++extern int fd_next; ++ ++extern bool kfd_fw_version_check; ++extern bool kfd_sdma_fw_version_check; ++extern bool kfd_caches_count_check; ++extern bool kfd_num_gws_check; ++extern bool kfd_vram_size_check; ++extern bool kfd_numa_check; ++extern bool kfd_capability_check; ++ ++int read_fp(FILE *fp, void *buf, const size_t buf_len); ++int write_fp(FILE *fp, const void *buf, const size_t buf_len); ++int read_file(const char *file_path, void *buf, const size_t buf_len); ++int write_img_file(char *path, const void *buf, const size_t buf_len); ++FILE *open_img_file(char *path, bool write, size_t *size); ++ ++bool checkpoint_is_complete(); ++void decrement_checkpoint_count(); ++void init_gpu_count(struct tp_system *topology); ++ ++void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list); ++ ++#endif /* __AMDGPU_PLUGIN_UTIL_H__ */ +diff --git a/plugins/amdgpu/criu-amdgpu.proto b/plugins/amdgpu/criu-amdgpu.proto +index 81d00d3ff..078b67650 100644 +--- a/plugins/amdgpu/criu-amdgpu.proto ++++ b/plugins/amdgpu/criu-amdgpu.proto +@@ -5,7 +5,7 @@ message dev_iolink { + required uint32 node_to_id = 2; + } + +-message device_entry { ++message kfd_device_entry { + required uint32 node_id = 1; + required uint32 gpu_id = 2; + required uint32 cpu_cores_count = 3; +@@ -40,10 +40,10 @@ message device_entry { + repeated dev_iolink iolinks = 32; + } + +-message bo_entry { +- required uint64 addr = 1; +- required uint64 size = 2; +- required uint64 offset = 3; ++message kfd_bo_entry { ++ required uint64 addr = 1; ++ required uint64 size = 2; ++ required uint64 offset = 3; + required uint32 alloc_flags = 4; + required uint32 gpu_id = 5; + } +@@ -52,10 +52,10 @@ message criu_kfd { + required uint32 pid = 1; + required uint32 num_of_gpus = 2; + required uint32 num_of_cpus = 3; +- repeated device_entry device_entries = 4; +- required uint64 num_of_bos = 5; +- repeated bo_entry bo_entries = 6; +- required uint32 num_of_objects = 7; ++ repeated kfd_device_entry device_entries = 4; ++ required uint64 num_of_bos = 5; ++ repeated kfd_bo_entry bo_entries = 6; ++ required uint32 num_of_objects = 7; + required uint64 shared_mem_size = 8; + required uint32 shared_mem_magic = 9; + required bytes priv_data = 10; +-- +2.45.1 + From 789549861fac073e5bdc3798f9638aba4643937c Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 17:05:10 +0100 Subject: [PATCH 22/53] Apply plugins-amdgpu-refactor-code-used-to-implement-checkp patch Signed-off-by: Radostin Stoyanov --- ...factor-code-used-to-implement-checkp.patch | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 plugins-amdgpu-refactor-code-used-to-implement-checkp.patch diff --git a/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch b/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch new file mode 100644 index 0000000..213f609 --- /dev/null +++ b/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch @@ -0,0 +1,186 @@ +From 9d9ae2954d3f1758ea659ed8e614dd28e8a368dd Mon Sep 17 00:00:00 2001 +From: Ramesh Errabolu +Date: Fri, 10 Nov 2023 13:02:49 -0600 +Subject: [PATCH] amdgpu_plugin: Refactor code used to implement Checkpoint + +Refactor code used to Checkpoint DRM devices. Code is moved +into amdgpu_plugin_drm.c file which hosts various methods to +checkpoint and restore a workload. + +Signed-off-by: Ramesh Errabolu +--- + plugins/amdgpu/amdgpu_plugin.c | 62 ++++++++++++++---------------- + plugins/amdgpu/amdgpu_plugin_drm.c | 38 ++++++++++++++++++ + plugins/amdgpu/amdgpu_plugin_drm.h | 6 +++ + 3 files changed, 73 insertions(+), 33 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index 60e04f973..a579158d0 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -49,6 +49,13 @@ struct vma_metadata { + + /************************************ Global Variables ********************************************/ + ++/** ++ * FD of KFD device used to checkpoint. On a multi-process ++ * tree the order of checkpointing goes from parent to child ++ * and so on - so saving the FD will not be overwritten ++ */ ++static int kfd_checkpoint_fd; ++ + static LIST_HEAD(update_vma_info_list); + + size_t kfd_max_buffer_size; +@@ -990,6 +997,10 @@ static int unpause_process(int fd) + goto exit; + } + ++ // Reset the KFD FD ++ kfd_checkpoint_fd = -1; ++ sys_close_drm_render_devices(&src_topology); ++ + exit: + pr_info("Process unpaused %s (ret:%d)\n", ret ? "Failed" : "Ok", ret); + +@@ -1181,44 +1192,25 @@ int amdgpu_plugin_dump_file(int fd, int id) + return -1; + } + ++ /* Initialize number of device files that will be checkpointed */ ++ init_gpu_count(&src_topology); ++ + /* Check whether this plugin was called for kfd or render nodes */ + if (major(st.st_rdev) != major(st_kfd.st_rdev) || minor(st.st_rdev) != 0) { ++ + /* This is RenderD dumper plugin, for now just save renderD + * minor number to be used during restore. In later phases this + * needs to save more data for video decode etc. + */ +- +- CriuRenderNode rd = CRIU_RENDER_NODE__INIT; +- struct tp_node *tp_node; +- +- pr_info("Dumper called for /dev/dri/renderD%d, FD = %d, ID = %d\n", minor(st.st_rdev), fd, id); +- +- tp_node = sys_get_node_by_render_minor(&src_topology, minor(st.st_rdev)); +- if (!tp_node) { +- pr_err("Failed to find a device with minor number = %d\n", minor(st.st_rdev)); +- +- return -ENODEV; +- } +- +- rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); +- if (!rd.gpu_id) +- return -ENODEV; +- +- len = criu_render_node__get_packed_size(&rd); +- buf = xmalloc(len); +- if (!buf) +- return -ENOMEM; +- +- criu_render_node__pack(&rd, buf); +- +- snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); +- ret = write_img_file(img_path, buf, len); +- if (ret) { +- xfree(buf); ++ ret = amdgpu_plugin_drm_dump_file(fd, id, &st); ++ if (ret) + return ret; +- } + +- xfree(buf); ++ /* Invoke unpause process if needed */ ++ decrement_checkpoint_count(); ++ if (checkpoint_is_complete()) { ++ ret = unpause_process(kfd_checkpoint_fd); ++ } + + /* Need to return success here so that criu can call plugins for renderD nodes */ + return ret; +@@ -1315,11 +1307,15 @@ int amdgpu_plugin_dump_file(int fd, int id) + ret = write_img_file(img_path, buf, len); + + xfree(buf); ++ + exit: +- /* Restore all queues */ +- unpause_process(fd); ++ /* Restore all queues if conditions permit */ ++ kfd_checkpoint_fd = fd; ++ decrement_checkpoint_count(); ++ if (checkpoint_is_complete()) { ++ ret = unpause_process(fd); ++ } + +- sys_close_drm_render_devices(&src_topology); + xfree((void *)args.devices); + xfree((void *)args.bos); + xfree((void *)args.priv_data); +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c +index a48dc68f0..689d62072 100644 +--- a/plugins/amdgpu/amdgpu_plugin_drm.c ++++ b/plugins/amdgpu/amdgpu_plugin_drm.c +@@ -61,3 +61,41 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) + } + + ++int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) ++{ ++ CriuRenderNode rd = CRIU_RENDER_NODE__INIT; ++ struct tp_node *tp_node; ++ char path[PATH_MAX]; ++ unsigned char *buf; ++ int minor; ++ int len; ++ int ret; ++ ++ /* Get the topology node of the DRM device */ ++ minor = minor(drm->st_rdev); ++ tp_node = sys_get_node_by_render_minor(&src_topology, minor); ++ if (!tp_node) { ++ pr_err("Failed to find a device with minor number = %d\n", minor); ++ return -ENODEV; ++ } ++ ++ /* Get the GPU_ID of the DRM device */ ++ rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); ++ if (!rd.gpu_id) { ++ pr_err("Failed to find valid gpu_id for the device = %d\n", rd.gpu_id); ++ return -ENODEV; ++ } ++ ++ len = criu_render_node__get_packed_size(&rd); ++ buf = xmalloc(len); ++ if (!buf) ++ return -ENOMEM; ++ ++ criu_render_node__pack(&rd, buf); ++ ++ snprintf(path, sizeof(path), IMG_DRM_FILE, id); ++ ret = write_img_file(path, buf, len); ++ xfree(buf); ++ return ret; ++} ++ +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h +index 37009c8ba..6f0c1a9a6 100644 +--- a/plugins/amdgpu/amdgpu_plugin_drm.h ++++ b/plugins/amdgpu/amdgpu_plugin_drm.h +@@ -17,6 +17,12 @@ + */ + int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); + ++/** ++ * Serialize meta-data about a particular DRM device, its number of BOs, ++ * etc into a file. The serialized filename has in it the value ID that ++ * is passed in as a parameter ++ */ ++int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm); + + #endif /* __AMDGPU_PLUGIN_DRM_H__ */ + +-- +2.45.1 + From a3667e4ffa08516ba69c3f7739f6f38a5ea9938d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:54:06 +0100 Subject: [PATCH 23/53] Apply plugins-amdgpu-fix-lint-errors patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 + plugins-amdgpu-fix-lint-errors.patch | 134 +++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 plugins-amdgpu-fix-lint-errors.patch diff --git a/criu.spec b/criu.spec index 2b17422..3b0ab27 100644 --- a/criu.spec +++ b/criu.spec @@ -27,6 +27,7 @@ Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch +Patch105: plugins-amdgpu-fix-lint-errors.patch Source5: criu-tmpfiles.conf @@ -116,6 +117,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 102 -p1 %patch -P 103 -p1 %patch -P 104 -p1 +%patch -P 105 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-fix-lint-errors.patch b/plugins-amdgpu-fix-lint-errors.patch new file mode 100644 index 0000000..1cb40ab --- /dev/null +++ b/plugins-amdgpu-fix-lint-errors.patch @@ -0,0 +1,134 @@ +From 6d37f9a4df8727e5beb7a9f5e0dc5165bcc33cea Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Fri, 9 Feb 2024 14:14:10 +0000 +Subject: [PATCH] amdgpu_plugin: fix lint errors + +$ make lint + ... + # Do not append \n to pr_perror, pr_pwarn or fail + ! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>.*\\n"' + plugins/amdgpu/amdgpu_plugin.c: pr_perror("%s(), Can't handle VMAs of input device\n", __func__); + + ! git --no-pager grep -En '^\s*\.*);$' | grep -v '\\n' + plugins/amdgpu/amdgpu_plugin_drm.c:45: pr_err("Error in getting stat for: %s", path); + plugins/amdgpu/amdgpu_plugin_util.c:77: pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); + plugins/amdgpu/amdgpu_plugin_util.c:89: pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); + plugins/amdgpu/amdgpu_plugin_util.c:120: pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); + plugins/amdgpu/amdgpu_plugin_util.c:126: pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); + plugins/amdgpu/amdgpu_plugin_util.c:136: pr_err("%s:Failed to access file size", path); + plugins/amdgpu/amdgpu_plugin_util.c:152: pr_err("Cannot fopen %s", file_path); + + make: *** [Makefile:470: lint] Error 1 + +Signed-off-by: Radostin Stoyanov +--- + plugins/amdgpu/amdgpu_plugin.c | 2 +- + plugins/amdgpu/amdgpu_plugin_drm.c | 3 +-- + plugins/amdgpu/amdgpu_plugin_util.c | 16 +++++++--------- + 3 files changed, 9 insertions(+), 12 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index a579158d0..a41469a50 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -412,7 +412,7 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) + /* Determine if input is a DRM device and therefore is supported */ + ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); + if (ret) +- pr_perror("%s(), Can't handle VMAs of input device\n", __func__); ++ pr_perror("%s(), Can't handle VMAs of input device", __func__); + + return ret; + } +diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c +index 689d62072..d54cd937d 100644 +--- a/plugins/amdgpu/amdgpu_plugin_drm.c ++++ b/plugins/amdgpu/amdgpu_plugin_drm.c +@@ -42,7 +42,7 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) + snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); + ret = stat(path, &drm); + if (ret == -1) { +- pr_err("Error in getting stat for: %s", path); ++ pr_err("Error in getting stat for: %s\n", path); + return ret; + } + +@@ -98,4 +98,3 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) + xfree(buf); + return ret; + } +- +diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c +index 48ff70555..62e569fc8 100755 +--- a/plugins/amdgpu/amdgpu_plugin_util.c ++++ b/plugins/amdgpu/amdgpu_plugin_util.c +@@ -65,7 +65,7 @@ void init_gpu_count(struct tp_system *topo) + return; + + /* We add ONE to include checkpointing of KFD device */ +- dev_file_cnt = 1 + topology_gpu_count(topo); ++ dev_file_cnt = 1 + topology_gpu_count(topo); + } + + int read_fp(FILE *fp, void *buf, const size_t buf_len) +@@ -74,7 +74,7 @@ int read_fp(FILE *fp, void *buf, const size_t buf_len) + + len_read = fread(buf, 1, buf_len, fp); + if (len_read != buf_len) { +- pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); ++ pr_err("Unable to read file (read:%ld buf_len:%ld)\n", len_read, buf_len); + return -EIO; + } + return 0; +@@ -86,7 +86,7 @@ int write_fp(FILE *fp, const void *buf, const size_t buf_len) + + len_write = fwrite(buf, 1, buf_len, fp); + if (len_write != buf_len) { +- pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); ++ pr_err("Unable to write file (wrote:%ld buf_len:%ld)\n", len_write, buf_len); + return -EIO; + } + return 0; +@@ -117,13 +117,13 @@ FILE *open_img_file(char *path, bool write, size_t *size) + fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); + + if (fd < 0) { +- pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); ++ pr_err("%s: Failed to open for %s\n", path, write ? "write" : "read"); + return NULL; + } + + fp = fdopen(fd, write ? "w" : "r"); + if (!fp) { +- pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); ++ pr_err("%s: Failed get pointer for %s\n", path, write ? "write" : "read"); + return NULL; + } + +@@ -133,7 +133,7 @@ FILE *open_img_file(char *path, bool write, size_t *size) + ret = read_fp(fp, size, sizeof(*size)); + + if (ret) { +- pr_err("%s:Failed to access file size", path); ++ pr_err("%s:Failed to access file size\n", path); + fclose(fp); + return NULL; + } +@@ -149,7 +149,7 @@ int read_file(const char *file_path, void *buf, const size_t buf_len) + + fp = fopen(file_path, "r"); + if (!fp) { +- pr_err("Cannot fopen %s", file_path); ++ pr_err("Cannot fopen %s\n", file_path); + return -errno; + } + +@@ -204,5 +204,3 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) + } + pr_info("\n"); + } +- +- +-- +2.45.1 + From f57234b73af11ec037b171eaa27c98cf659d68ab Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:41:26 +0100 Subject: [PATCH 24/53] Apply plugins-amdgpu-fix-cross-compilation patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 ++ plugins-amdgpu-fix-cross-compilation.patch | 30 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 plugins-amdgpu-fix-cross-compilation.patch diff --git a/criu.spec b/criu.spec index 3b0ab27..36acc33 100644 --- a/criu.spec +++ b/criu.spec @@ -28,6 +28,7 @@ Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch Patch105: plugins-amdgpu-fix-lint-errors.patch +Patch106: plugins-amdgpu-fix-cross-compilation.patch Source5: criu-tmpfiles.conf @@ -118,6 +119,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 103 -p1 %patch -P 104 -p1 %patch -P 105 -p1 +%patch -P 106 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-fix-cross-compilation.patch b/plugins-amdgpu-fix-cross-compilation.patch new file mode 100644 index 0000000..4e2b130 --- /dev/null +++ b/plugins-amdgpu-fix-cross-compilation.patch @@ -0,0 +1,30 @@ +From 28331d51935eba559c0bcd55f27abdd4983901a2 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Tue, 9 Jul 2024 13:07:03 +0100 +Subject: [PATCH 1/3] plugins/amdgpu: fix cross-compilation + +To enable cross-compile we need to use the CC definition from +criu/scripts/nmk/scripts/tools.mk: + +CC := $(CROSS_COMPILE)$(HOSTCC) + +Signed-off-by: Radostin Stoyanov +--- + plugins/amdgpu/Makefile | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +index 5efa8fb0b..d9f0da1eb 100644 +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -15,7 +15,6 @@ DEPS_NOK := ; + __nmk_dir ?= ../../scripts/nmk/scripts/ + include $(__nmk_dir)msg.mk + +-CC := gcc + PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" + PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu + +-- +2.45.1 + From 6b6494641d59167c177ac6e82e457a862b8dd6e3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 11 Jul 2024 16:42:23 +0100 Subject: [PATCH 25/53] Apply plugins-amdgpu-fix-printf-format-specifiers patch Signed-off-by: Radostin Stoyanov --- criu.spec | 2 + ...-amdgpu-fix-printf-format-specifiers.patch | 119 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 plugins-amdgpu-fix-printf-format-specifiers.patch diff --git a/criu.spec b/criu.spec index 36acc33..f196ae7 100644 --- a/criu.spec +++ b/criu.spec @@ -29,6 +29,7 @@ Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch Patch105: plugins-amdgpu-fix-lint-errors.patch Patch106: plugins-amdgpu-fix-cross-compilation.patch +Patch107: plugins-amdgpu-fix-printf-format-specifiers.patch Source5: criu-tmpfiles.conf @@ -120,6 +121,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 104 -p1 %patch -P 105 -p1 %patch -P 106 -p1 +%patch -P 107 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until diff --git a/plugins-amdgpu-fix-printf-format-specifiers.patch b/plugins-amdgpu-fix-printf-format-specifiers.patch new file mode 100644 index 0000000..dd15ba3 --- /dev/null +++ b/plugins-amdgpu-fix-printf-format-specifiers.patch @@ -0,0 +1,119 @@ +From f216ddcc9d4266daff5d75fff0d5c84c6000f7c7 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Wed, 10 Jul 2024 04:36:18 +0100 +Subject: [PATCH 3/3] plugins/amdgpu: fix printf format specifiers + +Errors on aarch64: + + In file included from amdgpu_plugin_drm.h:10, + from amdgpu_plugin.c:33: + amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': + amdgpu_plugin_util.h:24:20: error: format '%lld' expects argument of type 'long long int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' + 1236 | pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, + | ^~~~~~~ + cc1: all warnings being treated as errors + +Errors on ppc64: + + In file included from amdgpu_plugin_drm.h:10, + from amdgpu_plugin.c:33: + amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': + amdgpu_plugin_util.h:24:20: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' + 1236 | pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", + | ^~~~~~~ + cc1: all warnings being treated as errors + In file included from amdgpu_plugin_util.c:38: + amdgpu_plugin_util.c: In function 'print_kfd_bo_stat': + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:196:17: note: in expansion of macro 'pr_info' + 196 | pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); + | ^~~~~~~ + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:197:17: note: in expansion of macro 'pr_info' + 197 | pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); + | ^~~~~~~ + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:198:17: note: in expansion of macro 'pr_info' + 198 | pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); + | ^~~~~~~ + amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] + 24 | #define LOG_PREFIX "amdgpu_plugin: " + | ^~~~~~~~~~~~~~~~~ + ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' + 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) + | ^~~~~~~~~~ + amdgpu_plugin_util.c:199:17: note: in expansion of macro 'pr_info' + 199 | pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); + | ^~~~~~~ + cc1: all warnings being treated as errors + +Signed-off-by: Radostin Stoyanov +--- + plugins/amdgpu/amdgpu_plugin.c | 4 ++-- + plugins/amdgpu/amdgpu_plugin_util.c | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c +index a41469a50..924bf6c76 100644 +--- a/plugins/amdgpu/amdgpu_plugin.c ++++ b/plugins/amdgpu/amdgpu_plugin.c +@@ -1233,8 +1233,8 @@ int amdgpu_plugin_dump_file(int fd, int id) + goto exit; + } + +- pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, +- args.priv_data_size); ++ pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", ++ args.num_devices, args.num_bos, args.num_objects, (unsigned long long)args.priv_data_size); + + e = xmalloc(sizeof(*e)); + if (!e) { +diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c +index 62e569fc8..2ed3a6b82 100755 +--- a/plugins/amdgpu/amdgpu_plugin_util.c ++++ b/plugins/amdgpu/amdgpu_plugin_util.c +@@ -193,10 +193,10 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) + for (int idx = 0; idx < bo_cnt; idx++) { + bo = &bo_list[idx]; + pr_info("\n"); +- pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); +- pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); +- pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); +- pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); ++ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, (unsigned long long)bo->addr); ++ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, (unsigned long long)bo->size); ++ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, (unsigned long long)bo->offset); ++ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, (unsigned long long)bo->restored_offset); + pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); + pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); + pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); +-- +2.45.1 + From 84c94b56e395d0a39c0ac13e26228f765a27a350 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 20:12:15 +0000 Subject: [PATCH 26/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index f196ae7..c7f095f 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 3.19 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 3.19-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Jul 09 2024 Radostin Stoyanov - 3.19-6 - Add package for amdgpu-plugin From 973d5b295de535e836275fc194fad9a1e86aa42e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 26 Sep 2024 06:50:52 +0100 Subject: [PATCH 27/53] Update to v4.0 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + ...onfig-set-CR_PLUGIN_DEFAULT-variable.patch | 49 + criu.spec | 41 +- docs-update-amdgpu-plugin-man-page.patch | 38 - ...so-don-t-print-plugin-failed-in-criu.patch | 54 - ...n-t-print-error-for-no-such-process-.patch | 35 - plugins-amdgpu-fix-cross-compilation.patch | 30 - plugins-amdgpu-fix-lint-errors.patch | 134 --- ...-amdgpu-fix-printf-format-specifiers.patch | 119 -- ...factor-code-in-preparation-to-suppor.patch | 1013 ----------------- ...factor-code-used-to-implement-checkp.patch | 186 --- sources | 2 +- 12 files changed, 72 insertions(+), 1630 deletions(-) create mode 100644 Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch delete mode 100644 docs-update-amdgpu-plugin-man-page.patch delete mode 100644 plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch delete mode 100644 plugins-amdgpu-don-t-print-error-for-no-such-process-.patch delete mode 100644 plugins-amdgpu-fix-cross-compilation.patch delete mode 100644 plugins-amdgpu-fix-lint-errors.patch delete mode 100644 plugins-amdgpu-fix-printf-format-specifiers.patch delete mode 100644 plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch delete mode 100644 plugins-amdgpu-refactor-code-used-to-implement-checkp.patch diff --git a/.gitignore b/.gitignore index 0d113cc..d704cea 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ /criu-3.17.1.tar.gz /criu-3.18.tar.gz /criu-3.19.tar.gz +/criu-4.0.tar.gz diff --git a/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch b/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch new file mode 100644 index 0000000..7f9584d --- /dev/null +++ b/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch @@ -0,0 +1,49 @@ +From bb35901e78216917ce8066fa805ce27f273d76a2 Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 26 Sep 2024 10:59:32 +0100 +Subject: [PATCH] Makefile.config: set CR_PLUGIN_DEFAULT variable + +By default, CRIU uses the path "/usr/lib/criu" to install and load +plugins at runtime. This path is defined by the `PLUGINDIR` variable +in Makefile.install and `CR_PLUGIN_DEFAULT` in `criu/include/plugin.h`. +However, some distribution packages might install the CRIU plugins at +"/usr/lib64/criu" instead. This patch updates the makefile to align +the path defined by `CR_PLUGIN_DEFAULT` with the value of `PLUGINDIR`. + +Signed-off-by: Radostin Stoyanov +--- + Makefile.config | 4 ++++ + plugins/amdgpu/Makefile | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Makefile.config b/Makefile.config +index 52c250b21..5ab689d41 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -59,6 +59,10 @@ endif + + export LIBS += $(LIBS_FEATURES) + ++ifneq ($(PLUGINDIR),) ++ FEATURE_DEFINES += -DCR_PLUGIN_DEFAULT="\"$(PLUGINDIR)\"" ++endif ++ + CONFIG_FILE = .config + + $(CONFIG_FILE): +diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile +index 7d3388b80..a20d1d163 100644 +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -15,7 +15,7 @@ DEPS_NOK := ; + __nmk_dir ?= ../../scripts/nmk/scripts/ + include $(__nmk_dir)msg.mk + +-PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" ++PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC + PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu + + ifeq ($(CONFIG_AMDGPU),y) +-- +2.46.1 + diff --git a/criu.spec b/criu.spec index c7f095f..2ec6857 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.19 -Release: 7%{?dist} +Version: 4.0 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -22,14 +22,8 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # We use this patch because the protobuf-c package name # in RPM and DEB is different. Patch99: criu.pc.patch -Patch100: docs-update-amdgpu-plugin-man-page.patch -Patch101: plugins-amdgpu-don-t-print-error-for-no-such-process-.patch -Patch102: plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch -Patch103: plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch -Patch104: plugins-amdgpu-refactor-code-used-to-implement-checkp.patch -Patch105: plugins-amdgpu-fix-lint-errors.patch -Patch106: plugins-amdgpu-fix-cross-compilation.patch -Patch107: plugins-amdgpu-fix-printf-format-specifiers.patch + +Patch100: Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch Source5: criu-tmpfiles.conf @@ -86,6 +80,13 @@ Requires: %{name} = %{version}-%{release} %description amdgpu-plugin This package contains the AMD GPU plugin for %{name} +%package cuda-plugin +Summary: CUDA plugin for %{name} +Requires: %{name} = %{version}-%{release} + +%description cuda-plugin +This package contains the CUDA plugin for %{name} + %package -n %{py_prefix}-%{name} %{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} @@ -114,14 +115,8 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q %patch -P 99 -p1 + %patch -P 100 -p1 -%patch -P 101 -p1 -%patch -P 102 -p1 -%patch -P 103 -p1 -%patch -P 104 -p1 -%patch -P 105 -p1 -%patch -P 106 -p1 -%patch -P 107 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until @@ -140,6 +135,7 @@ sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolat make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu +make install-cuda_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 @@ -148,9 +144,6 @@ mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ -# Fix rpmlint W: unstripped-binary-or-object /usr/lib64/criu/amdgpu_plugin.so -chmod 755 $RPM_BUILD_ROOT%{_libdir}/%{name}/amdgpu_plugin.so - # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a @@ -174,6 +167,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_libdir}/%{name}/amdgpu_plugin.so %doc %{_mandir}/man1/criu-amdgpu-plugin.1* +%files cuda-plugin +%{_libdir}/%{name}/cuda_plugin.so +%doc plugins/cuda/README.md + %files -n %{py_prefix}-%{name} %{python3_sitelib}/pycriu* @@ -188,6 +185,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc %{_mandir}/man1/criu-ns.1* %changelog +* Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 +- Update to 4.0 +- Add package for cuda-plugin + * Wed Jul 17 2024 Fedora Release Engineering - 3.19-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/docs-update-amdgpu-plugin-man-page.patch b/docs-update-amdgpu-plugin-man-page.patch deleted file mode 100644 index 35a7abc..0000000 --- a/docs-update-amdgpu-plugin-man-page.patch +++ /dev/null @@ -1,38 +0,0 @@ -From eb4e68e5df4ce1ae4e362af012b1f464ecc63422 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 9 Jul 2024 12:22:25 +0100 -Subject: [PATCH] docs: update amdgpu-plugin man page - -This patch updates the dependencies section of the AMDGPU plugin man -page to reflect that the plugin has been merged upstream and to fix a -formatting issue. - -Signed-off-by: Radostin Stoyanov ---- - Documentation/criu-amdgpu-plugin.txt | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/Documentation/criu-amdgpu-plugin.txt b/Documentation/criu-amdgpu-plugin.txt -index 35321a915..68803f3db 100644 ---- a/Documentation/criu-amdgpu-plugin.txt -+++ b/Documentation/criu-amdgpu-plugin.txt -@@ -27,14 +27,10 @@ to criu to allow Checkpoint / Restore with ROCm. - - - Dependencies --~~~~~~~~~~~~~~ -+------------ - *amdkfd support*:: - In order to snapshot the *VRAM* and other *GPU* device states, we require -- an updated version of amdkfd(amdgpu) driver. The kernel patches are under -- review currently. -- --*criu 3.16*:: -- This work is rebased on latest criu release available at this time. -+ an updated version of amdkfd(amdgpu) driver. - - OPTIONS - ------- --- -2.45.2 - diff --git a/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch b/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch deleted file mode 100644 index 232fd1d..0000000 --- a/plugins-amdgpu-also-don-t-print-plugin-failed-in-criu.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 639068ecab26096092d460d6bbed10bedb5da0c4 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Mon, 5 Feb 2024 11:17:40 +0800 -Subject: [PATCH] plugin/amdgpu: Also don't print 'plugin failed' in criu - -We already don't treat it as error in the plugin itself, but after -returning -1 from RESUME_DEVICES_LATE hook we print debug message in -criu about failed plugin, let's return 0 instead. - -While on it let's replace ret to exit_code. - -Fixes: a9cbdad76 ("plugin/amdgpu: Don't print error for "No such process" during resume") -Signed-off-by: Pavel Tikhomirov ---- - plugins/amdgpu/amdgpu_plugin.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 3675353a7..23253632d 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -1985,7 +1985,7 @@ CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__UPDATE_VMA_MAP, amdgpu_plugin_update_vma - int amdgpu_plugin_resume_devices_late(int target_pid) - { - struct kfd_ioctl_criu_args args = { 0 }; -- int fd, ret = 0; -+ int fd, exit_code = 0; - - pr_info("Inside %s for target pid = %d\n", __func__, target_pid); - -@@ -1999,15 +1999,16 @@ int amdgpu_plugin_resume_devices_late(int target_pid) - args.op = KFD_CRIU_OP_RESUME; - pr_info("Calling IOCTL to start notifiers and queues\n"); - if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { -- if (errno == ESRCH) -+ if (errno == ESRCH) { - pr_info("Pid %d has no kfd process info\n", target_pid); -- else -+ } else { - pr_perror("restore late ioctl failed"); -- ret = -1; -+ exit_code = -1; -+ } - } - - close(fd); -- return ret; -+ return exit_code; - } - - CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, amdgpu_plugin_resume_devices_late) --- -2.45.1 - diff --git a/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch b/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch deleted file mode 100644 index eaa03fa..0000000 --- a/plugins-amdgpu-don-t-print-error-for-no-such-process-.patch +++ /dev/null @@ -1,35 +0,0 @@ -From a9cbdad76fa6daf95ea38bd1d5f912d260a84aed Mon Sep 17 00:00:00 2001 -From: David Francis -Date: Tue, 30 Jan 2024 14:59:48 -0500 -Subject: [PATCH] plugin/amdgpu: Don't print error for "No such process" during - resume - -During the late stages of restore, each process being resumed gets -an ioctl call to KFD_CRIU_OP_RESUME. If the process has no kfd -process info, this call with fail with -ESRCH. This is normal -behaviour, so we shouldn't print an error message for it. - -Signed-off-by: David Francis ---- - plugins/amdgpu/amdgpu_plugin.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 32ff8f936..3675353a7 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -1999,7 +1999,10 @@ int amdgpu_plugin_resume_devices_late(int target_pid) - args.op = KFD_CRIU_OP_RESUME; - pr_info("Calling IOCTL to start notifiers and queues\n"); - if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { -- pr_perror("restore late ioctl failed"); -+ if (errno == ESRCH) -+ pr_info("Pid %d has no kfd process info\n", target_pid); -+ else -+ pr_perror("restore late ioctl failed"); - ret = -1; - } - --- -2.45.1 - diff --git a/plugins-amdgpu-fix-cross-compilation.patch b/plugins-amdgpu-fix-cross-compilation.patch deleted file mode 100644 index 4e2b130..0000000 --- a/plugins-amdgpu-fix-cross-compilation.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 28331d51935eba559c0bcd55f27abdd4983901a2 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Tue, 9 Jul 2024 13:07:03 +0100 -Subject: [PATCH 1/3] plugins/amdgpu: fix cross-compilation - -To enable cross-compile we need to use the CC definition from -criu/scripts/nmk/scripts/tools.mk: - -CC := $(CROSS_COMPILE)$(HOSTCC) - -Signed-off-by: Radostin Stoyanov ---- - plugins/amdgpu/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -index 5efa8fb0b..d9f0da1eb 100644 ---- a/plugins/amdgpu/Makefile -+++ b/plugins/amdgpu/Makefile -@@ -15,7 +15,6 @@ DEPS_NOK := ; - __nmk_dir ?= ../../scripts/nmk/scripts/ - include $(__nmk_dir)msg.mk - --CC := gcc - PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" - PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu - --- -2.45.1 - diff --git a/plugins-amdgpu-fix-lint-errors.patch b/plugins-amdgpu-fix-lint-errors.patch deleted file mode 100644 index 1cb40ab..0000000 --- a/plugins-amdgpu-fix-lint-errors.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 6d37f9a4df8727e5beb7a9f5e0dc5165bcc33cea Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Fri, 9 Feb 2024 14:14:10 +0000 -Subject: [PATCH] amdgpu_plugin: fix lint errors - -$ make lint - ... - # Do not append \n to pr_perror, pr_pwarn or fail - ! git --no-pager grep -E '^\s*\<(pr_perror|pr_pwarn|fail)\>.*\\n"' - plugins/amdgpu/amdgpu_plugin.c: pr_perror("%s(), Can't handle VMAs of input device\n", __func__); - - ! git --no-pager grep -En '^\s*\.*);$' | grep -v '\\n' - plugins/amdgpu/amdgpu_plugin_drm.c:45: pr_err("Error in getting stat for: %s", path); - plugins/amdgpu/amdgpu_plugin_util.c:77: pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); - plugins/amdgpu/amdgpu_plugin_util.c:89: pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); - plugins/amdgpu/amdgpu_plugin_util.c:120: pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); - plugins/amdgpu/amdgpu_plugin_util.c:126: pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); - plugins/amdgpu/amdgpu_plugin_util.c:136: pr_err("%s:Failed to access file size", path); - plugins/amdgpu/amdgpu_plugin_util.c:152: pr_err("Cannot fopen %s", file_path); - - make: *** [Makefile:470: lint] Error 1 - -Signed-off-by: Radostin Stoyanov ---- - plugins/amdgpu/amdgpu_plugin.c | 2 +- - plugins/amdgpu/amdgpu_plugin_drm.c | 3 +-- - plugins/amdgpu/amdgpu_plugin_util.c | 16 +++++++--------- - 3 files changed, 9 insertions(+), 12 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index a579158d0..a41469a50 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -412,7 +412,7 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) - /* Determine if input is a DRM device and therefore is supported */ - ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); - if (ret) -- pr_perror("%s(), Can't handle VMAs of input device\n", __func__); -+ pr_perror("%s(), Can't handle VMAs of input device", __func__); - - return ret; - } -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c -index 689d62072..d54cd937d 100644 ---- a/plugins/amdgpu/amdgpu_plugin_drm.c -+++ b/plugins/amdgpu/amdgpu_plugin_drm.c -@@ -42,7 +42,7 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) - snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); - ret = stat(path, &drm); - if (ret == -1) { -- pr_err("Error in getting stat for: %s", path); -+ pr_err("Error in getting stat for: %s\n", path); - return ret; - } - -@@ -98,4 +98,3 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) - xfree(buf); - return ret; - } -- -diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c -index 48ff70555..62e569fc8 100755 ---- a/plugins/amdgpu/amdgpu_plugin_util.c -+++ b/plugins/amdgpu/amdgpu_plugin_util.c -@@ -65,7 +65,7 @@ void init_gpu_count(struct tp_system *topo) - return; - - /* We add ONE to include checkpointing of KFD device */ -- dev_file_cnt = 1 + topology_gpu_count(topo); -+ dev_file_cnt = 1 + topology_gpu_count(topo); - } - - int read_fp(FILE *fp, void *buf, const size_t buf_len) -@@ -74,7 +74,7 @@ int read_fp(FILE *fp, void *buf, const size_t buf_len) - - len_read = fread(buf, 1, buf_len, fp); - if (len_read != buf_len) { -- pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); -+ pr_err("Unable to read file (read:%ld buf_len:%ld)\n", len_read, buf_len); - return -EIO; - } - return 0; -@@ -86,7 +86,7 @@ int write_fp(FILE *fp, const void *buf, const size_t buf_len) - - len_write = fwrite(buf, 1, buf_len, fp); - if (len_write != buf_len) { -- pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); -+ pr_err("Unable to write file (wrote:%ld buf_len:%ld)\n", len_write, buf_len); - return -EIO; - } - return 0; -@@ -117,13 +117,13 @@ FILE *open_img_file(char *path, bool write, size_t *size) - fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); - - if (fd < 0) { -- pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); -+ pr_err("%s: Failed to open for %s\n", path, write ? "write" : "read"); - return NULL; - } - - fp = fdopen(fd, write ? "w" : "r"); - if (!fp) { -- pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); -+ pr_err("%s: Failed get pointer for %s\n", path, write ? "write" : "read"); - return NULL; - } - -@@ -133,7 +133,7 @@ FILE *open_img_file(char *path, bool write, size_t *size) - ret = read_fp(fp, size, sizeof(*size)); - - if (ret) { -- pr_err("%s:Failed to access file size", path); -+ pr_err("%s:Failed to access file size\n", path); - fclose(fp); - return NULL; - } -@@ -149,7 +149,7 @@ int read_file(const char *file_path, void *buf, const size_t buf_len) - - fp = fopen(file_path, "r"); - if (!fp) { -- pr_err("Cannot fopen %s", file_path); -+ pr_err("Cannot fopen %s\n", file_path); - return -errno; - } - -@@ -204,5 +204,3 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) - } - pr_info("\n"); - } -- -- --- -2.45.1 - diff --git a/plugins-amdgpu-fix-printf-format-specifiers.patch b/plugins-amdgpu-fix-printf-format-specifiers.patch deleted file mode 100644 index dd15ba3..0000000 --- a/plugins-amdgpu-fix-printf-format-specifiers.patch +++ /dev/null @@ -1,119 +0,0 @@ -From f216ddcc9d4266daff5d75fff0d5c84c6000f7c7 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Wed, 10 Jul 2024 04:36:18 +0100 -Subject: [PATCH 3/3] plugins/amdgpu: fix printf format specifiers - -Errors on aarch64: - - In file included from amdgpu_plugin_drm.h:10, - from amdgpu_plugin.c:33: - amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': - amdgpu_plugin_util.h:24:20: error: format '%lld' expects argument of type 'long long int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' - 1236 | pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, - | ^~~~~~~ - cc1: all warnings being treated as errors - -Errors on ppc64: - - In file included from amdgpu_plugin_drm.h:10, - from amdgpu_plugin.c:33: - amdgpu_plugin.c: In function 'amdgpu_plugin_dump_file': - amdgpu_plugin_util.h:24:20: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin.c:1236:9: note: in expansion of macro 'pr_info' - 1236 | pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", - | ^~~~~~~ - cc1: all warnings being treated as errors - In file included from amdgpu_plugin_util.c:38: - amdgpu_plugin_util.c: In function 'print_kfd_bo_stat': - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:196:17: note: in expansion of macro 'pr_info' - 196 | pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); - | ^~~~~~~ - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:197:17: note: in expansion of macro 'pr_info' - 197 | pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); - | ^~~~~~~ - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:198:17: note: in expansion of macro 'pr_info' - 198 | pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); - | ^~~~~~~ - amdgpu_plugin_util.h:24:20: error: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type '__u64' {aka 'long unsigned int'} [-Werror=format=] - 24 | #define LOG_PREFIX "amdgpu_plugin: " - | ^~~~~~~~~~~~~~~~~ - ../../criu/include/log.h:47:52: note: in expansion of macro 'LOG_PREFIX' - 47 | #define pr_info(fmt, ...) print_on_level(LOG_INFO, LOG_PREFIX fmt, ##__VA_ARGS__) - | ^~~~~~~~~~ - amdgpu_plugin_util.c:199:17: note: in expansion of macro 'pr_info' - 199 | pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); - | ^~~~~~~ - cc1: all warnings being treated as errors - -Signed-off-by: Radostin Stoyanov ---- - plugins/amdgpu/amdgpu_plugin.c | 4 ++-- - plugins/amdgpu/amdgpu_plugin_util.c | 8 ++++---- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index a41469a50..924bf6c76 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -1233,8 +1233,8 @@ int amdgpu_plugin_dump_file(int fd, int id) - goto exit; - } - -- pr_info("devices:%d bos:%d objects:%d priv_data:%lld\n", args.num_devices, args.num_bos, args.num_objects, -- args.priv_data_size); -+ pr_info("devices:%u bos:%u objects:%u priv_data:%llu\n", -+ args.num_devices, args.num_bos, args.num_objects, (unsigned long long)args.priv_data_size); - - e = xmalloc(sizeof(*e)); - if (!e) { -diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c -index 62e569fc8..2ed3a6b82 100755 ---- a/plugins/amdgpu/amdgpu_plugin_util.c -+++ b/plugins/amdgpu/amdgpu_plugin_util.c -@@ -193,10 +193,10 @@ void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) - for (int idx = 0; idx < bo_cnt; idx++) { - bo = &bo_list[idx]; - pr_info("\n"); -- pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); -- pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); -- pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); -- pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); -+ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, (unsigned long long)bo->addr); -+ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, (unsigned long long)bo->size); -+ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, (unsigned long long)bo->offset); -+ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, (unsigned long long)bo->restored_offset); - pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); - pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); - pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); --- -2.45.1 - diff --git a/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch b/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch deleted file mode 100644 index c83be02..0000000 --- a/plugins-amdgpu-refactor-code-in-preparation-to-suppor.patch +++ /dev/null @@ -1,1013 +0,0 @@ -From 81f2c41df6ffee7e4962b1facb17c327676285cc Mon Sep 17 00:00:00 2001 -From: Ramesh Errabolu -Date: Fri, 10 Nov 2023 11:36:34 -0600 -Subject: [PATCH] amdgpu_plugin: Refactor code in preparation to support C&R - for DRM devices - -Add a new compilation unit to host symbols and methods that will be -needed to C&R DRM devices. Refactor code that indicates support for -C&R and checkpoints KFD and DRM devices - -Signed-off-by: Ramesh Errabolu ---- - plugins/amdgpu/Makefile | 2 +- - plugins/amdgpu/amdgpu_plugin.c | 245 ++++-------------------- - plugins/amdgpu/amdgpu_plugin_drm.c | 63 ++++++ - plugins/amdgpu/amdgpu_plugin_drm.h | 22 +++ - plugins/amdgpu/amdgpu_plugin_topology.c | 41 ++-- - plugins/amdgpu/amdgpu_plugin_topology.h | 2 + - plugins/amdgpu/amdgpu_plugin_util.c | 208 ++++++++++++++++++++ - plugins/amdgpu/amdgpu_plugin_util.h | 106 ++++++++++ - plugins/amdgpu/criu-amdgpu.proto | 18 +- - 9 files changed, 460 insertions(+), 247 deletions(-) - create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.c - create mode 100644 plugins/amdgpu/amdgpu_plugin_drm.h - create mode 100755 plugins/amdgpu/amdgpu_plugin_util.c - create mode 100755 plugins/amdgpu/amdgpu_plugin_util.h - -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -index 64a923d38..5efa8fb0b 100644 ---- a/plugins/amdgpu/Makefile -+++ b/plugins/amdgpu/Makefile -@@ -28,7 +28,7 @@ endif - criu-amdgpu.pb-c.c: criu-amdgpu.proto - protoc-c --proto_path=. --c_out=. criu-amdgpu.proto - --amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_topology.c criu-amdgpu.pb-c.c -+amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c - $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC) - - amdgpu_plugin_clean: -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 23253632d..60e04f973 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -30,55 +30,14 @@ - #include "files.h" - - #include "common/list.h" -+#include "amdgpu_plugin_drm.h" -+#include "amdgpu_plugin_util.h" - #include "amdgpu_plugin_topology.h" - - #include "img-streamer.h" - #include "image.h" - #include "cr_options.h" - --#define AMDGPU_KFD_DEVICE "/dev/kfd" --#define PROCPIDMEM "/proc/%d/mem" --#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" --#define HSAKMT_SHM "/hsakmt_shared_mem" --#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" --#define HSAKMT_SEM "hsakmt_semaphore" -- --#define KFD_IOCTL_MAJOR_VERSION 1 --#define MIN_KFD_IOCTL_MINOR_VERSION 8 -- --#define IMG_KFD_FILE "amdgpu-kfd-%d.img" --#define IMG_RENDERD_FILE "amdgpu-renderD-%d.img" --#define IMG_PAGES_FILE "amdgpu-pages-%d-%04x.img" -- --#ifndef _GNU_SOURCE --#define _GNU_SOURCE 1 --#endif -- --#ifdef LOG_PREFIX --#undef LOG_PREFIX --#endif --#define LOG_PREFIX "amdgpu_plugin: " -- --#ifdef DEBUG --#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) --#else --#define plugin_log_msg(fmt, ...) \ -- { \ -- } --#endif -- --#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) -- --#define SDMA_OPCODE_COPY 1 --#define SDMA_COPY_SUB_OPCODE_LINEAR 0 --#define SDMA_NOP 0 --#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) -- --enum sdma_op_type { -- SDMA_OP_VRAM_READ, -- SDMA_OP_VRAM_WRITE, --}; -- - struct vma_metadata { - struct list_head list; - uint64_t old_pgoff; -@@ -89,143 +48,13 @@ struct vma_metadata { - }; - - /************************************ Global Variables ********************************************/ --struct tp_system src_topology; --struct tp_system dest_topology; -- --struct device_maps checkpoint_maps; --struct device_maps restore_maps; -- --extern int fd_next; - - static LIST_HEAD(update_vma_info_list); - --extern bool kfd_fw_version_check; --extern bool kfd_sdma_fw_version_check; --extern bool kfd_caches_count_check; --extern bool kfd_num_gws_check; --extern bool kfd_vram_size_check; --extern bool kfd_numa_check; --extern bool kfd_capability_check; -- - size_t kfd_max_buffer_size; - - /**************************************************************************************************/ - --int write_fp(FILE *fp, const void *buf, const size_t buf_len) --{ -- size_t len_write; -- -- len_write = fwrite(buf, 1, buf_len, fp); -- if (len_write != buf_len) { -- pr_perror("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); -- return -EIO; -- } -- return 0; --} -- --int read_fp(FILE *fp, void *buf, const size_t buf_len) --{ -- size_t len_read; -- -- len_read = fread(buf, 1, buf_len, fp); -- if (len_read != buf_len) { -- pr_perror("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); -- return -EIO; -- } -- return 0; --} -- --/** -- * @brief Open an image file -- * -- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to -- * determine the file size when using criu_image_streamer when fseek and fstat are not available. -- * The FILE * returned is already at the location of the first actual contents. -- * -- * @param path The file path -- * @param write False for read, true for write -- * @param size Size of actual contents -- * @return FILE *if successful, NULL if failed -- */ --FILE *open_img_file(char *path, bool write, size_t *size) --{ -- FILE *fp = NULL; -- int fd, ret; -- -- if (opts.stream) -- fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); -- else -- fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); -- -- if (fd < 0) { -- pr_perror("%s: Failed to open for %s", path, write ? "write" : "read"); -- return NULL; -- } -- -- fp = fdopen(fd, write ? "w" : "r"); -- if (!fp) { -- pr_perror("%s: Failed get pointer for %s", path, write ? "write" : "read"); -- close(fd); -- return NULL; -- } -- -- if (write) -- ret = write_fp(fp, size, sizeof(*size)); -- else -- ret = read_fp(fp, size, sizeof(*size)); -- -- if (ret) { -- pr_perror("%s:Failed to access file size", path); -- fclose(fp); -- return NULL; -- } -- -- pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); -- return fp; --} -- --/** -- * @brief Write an image file -- * -- * We store the size of the actual contents in the first 8-bytes of the file. This allows us to -- * determine the file size when using criu_image_streamer when fseek and fstat are not available. -- * -- * @param path The file path -- * @param buf pointer to data to be written -- * @param buf_len size of buf -- * @return 0 if successful. -errno on failure -- */ --int write_img_file(char *path, const void *buf, const size_t buf_len) --{ -- int ret; -- FILE *fp; -- size_t len = buf_len; -- -- fp = open_img_file(path, true, &len); -- if (!fp) -- return -errno; -- -- ret = write_fp(fp, buf, buf_len); -- fclose(fp); /* this will also close fd */ -- return ret; --} -- --int read_file(const char *file_path, void *buf, const size_t buf_len) --{ -- int ret; -- FILE *fp; -- -- fp = fopen(file_path, "r"); -- if (!fp) { -- pr_perror("Cannot fopen %s", file_path); -- return -errno; -- } -- -- ret = read_fp(fp, buf, buf_len); -- fclose(fp); /* this will also close fd */ -- return ret; --} -- - /* Call ioctl, restarting if it is interrupted */ - int kmtIoctl(int fd, unsigned long request, void *arg) - { -@@ -263,21 +92,21 @@ static void free_e(CriuKfd *e) - - static int allocate_device_entries(CriuKfd *e, int num_of_devices) - { -- e->device_entries = xmalloc(sizeof(DeviceEntry *) * num_of_devices); -+ e->device_entries = xmalloc(sizeof(KfdDeviceEntry *) * num_of_devices); - if (!e->device_entries) { - pr_err("Failed to allocate device_entries\n"); - return -ENOMEM; - } - - for (int i = 0; i < num_of_devices; i++) { -- DeviceEntry *entry = xzalloc(sizeof(*entry)); -+ KfdDeviceEntry *entry = xzalloc(sizeof(*entry)); - - if (!entry) { - pr_err("Failed to allocate entry\n"); - return -ENOMEM; - } - -- device_entry__init(entry); -+ kfd_device_entry__init(entry); - - e->device_entries[i] = entry; - e->n_device_entries++; -@@ -287,21 +116,21 @@ static int allocate_device_entries(CriuKfd *e, int num_of_devices) - - static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucket *bo_bucket_ptr) - { -- e->bo_entries = xmalloc(sizeof(BoEntry *) * num_bos); -+ e->bo_entries = xmalloc(sizeof(KfdBoEntry *) * num_bos); - if (!e->bo_entries) { - pr_err("Failed to allocate bo_info\n"); - return -ENOMEM; - } - - for (int i = 0; i < num_bos; i++) { -- BoEntry *entry = xzalloc(sizeof(*entry)); -+ KfdBoEntry *entry = xzalloc(sizeof(*entry)); - - if (!entry) { - pr_err("Failed to allocate botest\n"); - return -ENOMEM; - } - -- bo_entry__init(entry); -+ kfd_bo_entry__init(entry); - - e->bo_entries[i] = entry; - e->n_bo_entries++; -@@ -309,13 +138,13 @@ static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucke - return 0; - } - --int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceEntry **deviceEntries) -+int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDeviceEntry **deviceEntries) - { - uint32_t devinfo_index = 0; - struct tp_node *node; - - list_for_each_entry(node, &sys->nodes, listm_system) { -- DeviceEntry *devinfo = deviceEntries[devinfo_index++]; -+ KfdDeviceEntry *devinfo = deviceEntries[devinfo_index++]; - - devinfo->node_id = node->id; - -@@ -383,11 +212,11 @@ int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, DeviceE - return 0; - } - --int devinfo_to_topology(DeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) -+int devinfo_to_topology(KfdDeviceEntry *devinfos[], uint32_t num_devices, struct tp_system *sys) - { - for (int i = 0; i < num_devices; i++) { - struct tp_node *node; -- DeviceEntry *devinfo = devinfos[i]; -+ KfdDeviceEntry *devinfo = devinfos[i]; - - node = sys_add_node(sys, devinfo->node_id, devinfo->gpu_id); - if (!node) -@@ -549,7 +378,7 @@ struct thread_data { - uint32_t gpu_id; - pid_t pid; - struct kfd_criu_bo_bucket *bo_buckets; -- BoEntry **bo_entries; -+ KfdBoEntry **bo_entries; - int drm_fd; - int ret; - int id; /* File ID used by CRIU to identify KFD image for this process */ -@@ -557,8 +386,7 @@ struct thread_data { - - int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) - { -- struct stat st_kfd, st_dri_min; -- char img_path[128]; -+ struct stat st_kfd; - int ret = 0; - - pr_debug("Enter %s\n", __func__); -@@ -568,27 +396,18 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) - return ret; - } - -- snprintf(img_path, sizeof(img_path), "/dev/dri/renderD%d", DRM_FIRST_RENDER_NODE); -- -- ret = stat(img_path, &st_dri_min); -- if (ret == -1) { -- pr_perror("stat error for %s", img_path); -- return ret; -- } -- -- if (major(st_buf->st_rdev) == major(st_kfd.st_rdev) || ((major(st_buf->st_rdev) == major(st_dri_min.st_rdev)) && -- (minor(st_buf->st_rdev) >= minor(st_dri_min.st_rdev) && -- minor(st_buf->st_rdev) >= DRM_FIRST_RENDER_NODE))) { -+ /* If input device is KFD return device as supported */ -+ if (major(st_buf->st_rdev) == major(st_kfd.st_rdev)) { - pr_debug("Known non-regular mapping, kfd-renderD%d -> OK\n", minor(st_buf->st_rdev)); -- pr_debug("AMD KFD(maj) = %d, DRI(maj,min) = %d:%d VMA Device fd(maj,min) = %d:%d\n", -- major(st_kfd.st_rdev), major(st_dri_min.st_rdev), minor(st_dri_min.st_rdev), -- major(st_buf->st_rdev), minor(st_buf->st_rdev)); -- /* VMA belongs to kfd */ - return 0; - } - -- pr_perror("Can't handle the VMA mapping"); -- return -ENOTSUP; -+ /* Determine if input is a DRM device and therefore is supported */ -+ ret = amdgpu_plugin_drm_handle_device_vma(fd, st_buf); -+ if (ret) -+ pr_perror("%s(), Can't handle VMAs of input device\n", __func__); -+ -+ return ret; - } - CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__HANDLE_DEVICE_VMA, amdgpu_plugin_handle_device_vma) - -@@ -655,8 +474,9 @@ void free_and_unmap(uint64_t size, amdgpu_bo_handle h_bo, amdgpu_va_handle h_va, - amdgpu_bo_free(h_bo); - } - --int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, void *buffer, size_t buffer_size, -- amdgpu_device_handle h_dev, uint64_t max_copy_size, enum sdma_op_type type) -+static int sdma_copy_bo(struct kfd_criu_bo_bucket bo_bucket, FILE *storage_fp, -+ void *buffer, size_t buffer_size, amdgpu_device_handle h_dev, -+ uint64_t max_copy_size, enum sdma_op_type type) - { - uint64_t size, src_bo_size, dst_bo_size, buffer_bo_size, bytes_remain, buffer_space_remain; - uint64_t gpu_addr_src, gpu_addr_dst, gpu_addr_ib, copy_src, copy_dst, copy_size; -@@ -954,7 +774,7 @@ void *dump_bo_contents(void *_thread_data) - goto exit; - } - -- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); -+ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); - bo_contents_fp = open_img_file(img_path, true, &image_size); - if (!bo_contents_fp) { - pr_perror("Cannot fopen %s", img_path); -@@ -1027,7 +847,7 @@ void *restore_bo_contents(void *_thread_data) - max_copy_size = (gpu_info.family_id >= AMDGPU_FAMILY_AI) ? SDMA_LINEAR_COPY_MAX_SIZE : - SDMA_LINEAR_COPY_MAX_SIZE - 1; - -- snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); -+ snprintf(img_path, sizeof(img_path), IMG_KFD_PAGES_FILE, thread_data->id, thread_data->gpu_id); - bo_contents_fp = open_img_file(img_path, false, &image_size); - if (!bo_contents_fp) { - pr_perror("Cannot fopen %s", img_path); -@@ -1234,7 +1054,7 @@ static int save_bos(int id, int fd, struct kfd_ioctl_criu_args *args, struct kfd - - for (i = 0; i < e->num_of_bos; i++) { - struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; -- BoEntry *boinfo = e->bo_entries[i]; -+ KfdBoEntry *boinfo = e->bo_entries[i]; - - boinfo->gpu_id = bo_bucket->gpu_id; - boinfo->addr = bo_bucket->addr; -@@ -1391,7 +1211,7 @@ int amdgpu_plugin_dump_file(int fd, int id) - - criu_render_node__pack(&rd, buf); - -- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); -+ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); - ret = write_img_file(img_path, buf, len); - if (ret) { - xfree(buf); -@@ -1399,6 +1219,7 @@ int amdgpu_plugin_dump_file(int fd, int id) - } - - xfree(buf); -+ - /* Need to return success here so that criu can call plugins for renderD nodes */ - return ret; - } -@@ -1531,7 +1352,7 @@ static int restore_devices(struct kfd_ioctl_criu_args *args, CriuKfd *e) - - for (int entries_i = 0; entries_i < e->num_of_cpus + e->num_of_gpus; entries_i++) { - struct kfd_criu_device_bucket *device_bucket; -- DeviceEntry *devinfo = e->device_entries[entries_i]; -+ KfdDeviceEntry *devinfo = e->device_entries[entries_i]; - struct tp_node *tp_node; - - if (!devinfo->gpu_id) -@@ -1581,7 +1402,7 @@ static int restore_bos(struct kfd_ioctl_criu_args *args, CriuKfd *e) - - for (int i = 0; i < args->num_bos; i++) { - struct kfd_criu_bo_bucket *bo_bucket = &bo_buckets[i]; -- BoEntry *bo_entry = e->bo_entries[i]; -+ KfdBoEntry *bo_entry = e->bo_entries[i]; - - bo_bucket->gpu_id = bo_entry->gpu_id; - bo_bucket->addr = bo_entry->addr; -@@ -1736,7 +1557,7 @@ int amdgpu_plugin_restore_file(int id) - * TODO: Currently, this code will only work if this function is called for /dev/kfd - * first as we assume restore_maps is already filled. Need to fix this later. - */ -- snprintf(img_path, sizeof(img_path), IMG_RENDERD_FILE, id); -+ snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); - pr_info("Restoring RenderD %s\n", img_path); - - img_fp = open_img_file(img_path, false, &img_size); -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c -new file mode 100644 -index 000000000..a48dc68f0 ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_drm.c -@@ -0,0 +1,63 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include "common/list.h" -+ -+#include "criu-amdgpu.pb-c.h" -+ -+#include -+#include -+ -+#include "xmalloc.h" -+#include "criu-log.h" -+#include "kfd_ioctl.h" -+#include "amdgpu_plugin_drm.h" -+#include "amdgpu_plugin_util.h" -+#include "amdgpu_plugin_topology.h" -+ -+ -+int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) -+{ -+ char path[PATH_MAX]; -+ struct stat drm; -+ int ret = 0; -+ -+ snprintf(path, sizeof(path), AMDGPU_DRM_DEVICE, DRM_FIRST_RENDER_NODE); -+ ret = stat(path, &drm); -+ if (ret == -1) { -+ pr_err("Error in getting stat for: %s", path); -+ return ret; -+ } -+ -+ if ((major(st->st_rdev) != major(drm.st_rdev)) || -+ (minor(st->st_rdev) < minor(drm.st_rdev)) || -+ (minor(st->st_rdev) > DRM_LAST_RENDER_NODE)) { -+ pr_err("Can't handle VMA mapping of input device\n"); -+ return -ENOTSUP; -+ } -+ -+ pr_debug("AMD DRI(maj,min) = %d:%d VMA Device FD(maj,min) = %d:%d\n", -+ major(drm.st_rdev), minor(drm.st_rdev), -+ major(st->st_rdev), minor(st->st_rdev)); -+ -+ return 0; -+} -+ -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h -new file mode 100644 -index 000000000..37009c8ba ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_drm.h -@@ -0,0 +1,22 @@ -+#ifndef __AMDGPU_PLUGIN_DRM_H__ -+#define __AMDGPU_PLUGIN_DRM_H__ -+ -+#include -+#include "common/list.h" -+ -+#include "xmalloc.h" -+#include "criu-log.h" -+#include "kfd_ioctl.h" -+#include "amdgpu_plugin_util.h" -+#include "amdgpu_plugin_topology.h" -+ -+ -+/** -+ * Determines if VMA's of input file descriptor belong to amdgpu's -+ * DRM device and are therefore supported -+ */ -+int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); -+ -+ -+#endif /* __AMDGPU_PLUGIN_DRM_H__ */ -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_topology.c b/plugins/amdgpu/amdgpu_plugin_topology.c -index ef79e5ef4..c5fa51fda 100644 ---- a/plugins/amdgpu/amdgpu_plugin_topology.c -+++ b/plugins/amdgpu/amdgpu_plugin_topology.c -@@ -16,35 +16,11 @@ - - #include "xmalloc.h" - #include "kfd_ioctl.h" -+#include "amdgpu_plugin_util.h" - #include "amdgpu_plugin_topology.h" - - #define TOPOLOGY_PATH "/sys/class/kfd/kfd/topology/nodes/" - --#ifndef _GNU_SOURCE --#define _GNU_SOURCE 1 --#endif -- --#ifdef COMPILE_TESTS --#undef pr_err --#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) --#undef pr_info --#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) --#undef pr_debug --#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) -- --#undef pr_perror --#define pr_perror(format, arg...) \ -- fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) --#endif -- --#ifdef DEBUG --#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) --#else --#define plugin_log_msg(fmt, ...) \ -- { \ -- } --#endif -- - /* User override options */ - /* Skip firmware version check */ - bool kfd_fw_version_check = true; -@@ -840,6 +816,9 @@ void topology_free(struct tp_system *sys) - list_del(&p2pgroup->listm_system); - xfree(p2pgroup); - } -+ -+ /* Update Topology as being freed */ -+ sys->parsed = false; - } - - /** -@@ -1461,3 +1440,15 @@ int set_restore_gpu_maps(struct tp_system *src_sys, struct tp_system *dest_sys, - - return ret; - } -+ -+int topology_gpu_count(struct tp_system *sys) -+{ -+ struct tp_node *node; -+ int count = 0; -+ -+ list_for_each_entry(node, &sys->nodes, listm_system) -+ if (NODE_IS_GPU(node)) -+ count++; -+ return count; -+} -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_topology.h b/plugins/amdgpu/amdgpu_plugin_topology.h -index 9d99cda1c..c890e3dda 100644 ---- a/plugins/amdgpu/amdgpu_plugin_topology.h -+++ b/plugins/amdgpu/amdgpu_plugin_topology.h -@@ -107,6 +107,8 @@ int topology_parse(struct tp_system *topology, const char *msg); - int topology_determine_iolinks(struct tp_system *sys); - void topology_print(const struct tp_system *sys, const char *msg); - -+int topology_gpu_count(struct tp_system *topology); -+ - struct id_map *maps_add_gpu_entry(struct device_maps *maps, const uint32_t src_id, const uint32_t dest_id); - - struct tp_node *sys_add_node(struct tp_system *sys, uint32_t id, uint32_t gpu_id); -diff --git a/plugins/amdgpu/amdgpu_plugin_util.c b/plugins/amdgpu/amdgpu_plugin_util.c -new file mode 100755 -index 000000000..48ff70555 ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_util.c -@@ -0,0 +1,208 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include "common/list.h" -+ -+#include -+#include -+ -+#include "criu-plugin.h" -+#include "plugin.h" -+#include "criu-amdgpu.pb-c.h" -+ -+#include "img-streamer.h" -+#include "image.h" -+#include "cr_options.h" -+ -+#include "xmalloc.h" -+#include "criu-log.h" -+#include "kfd_ioctl.h" -+#include "amdgpu_drm.h" -+#include "amdgpu_plugin_util.h" -+#include "amdgpu_plugin_topology.h" -+ -+/* Tracks number of device files that need to be checkpointed */ -+static int dev_file_cnt = 0; -+ -+/* Helper structures to encode device topology of SRC and DEST platforms */ -+struct tp_system src_topology; -+struct tp_system dest_topology; -+ -+/* Helper structures to encode device maps during Checkpoint and Restore operations */ -+struct device_maps checkpoint_maps; -+struct device_maps restore_maps; -+ -+bool checkpoint_is_complete() -+{ -+ return (dev_file_cnt == 0); -+} -+ -+void decrement_checkpoint_count() -+{ -+ dev_file_cnt--; -+} -+ -+void init_gpu_count(struct tp_system *topo) -+{ -+ if (dev_file_cnt != 0) -+ return; -+ -+ /* We add ONE to include checkpointing of KFD device */ -+ dev_file_cnt = 1 + topology_gpu_count(topo); -+} -+ -+int read_fp(FILE *fp, void *buf, const size_t buf_len) -+{ -+ size_t len_read; -+ -+ len_read = fread(buf, 1, buf_len, fp); -+ if (len_read != buf_len) { -+ pr_err("Unable to read file (read:%ld buf_len:%ld)", len_read, buf_len); -+ return -EIO; -+ } -+ return 0; -+} -+ -+int write_fp(FILE *fp, const void *buf, const size_t buf_len) -+{ -+ size_t len_write; -+ -+ len_write = fwrite(buf, 1, buf_len, fp); -+ if (len_write != buf_len) { -+ pr_err("Unable to write file (wrote:%ld buf_len:%ld)", len_write, buf_len); -+ return -EIO; -+ } -+ return 0; -+} -+ -+/** -+ * @brief Open an image file -+ * -+ * We store the size of the actual contents in the first 8-bytes of -+ * the file. This allows us to determine the file size when using -+ * criu_image_streamer when fseek and fstat are not available. The -+ * FILE * returned is already at the location of the first actual -+ * contents. -+ * -+ * @param path The file path -+ * @param write False for read, true for write -+ * @param size Size of actual contents -+ * @return FILE *if successful, NULL if failed -+ */ -+FILE *open_img_file(char *path, bool write, size_t *size) -+{ -+ FILE *fp = NULL; -+ int fd, ret; -+ -+ if (opts.stream) -+ fd = img_streamer_open(path, write ? O_DUMP : O_RSTR); -+ else -+ fd = openat(criu_get_image_dir(), path, write ? (O_WRONLY | O_CREAT) : O_RDONLY, 0600); -+ -+ if (fd < 0) { -+ pr_err("%s: Failed to open for %s", path, write ? "write" : "read"); -+ return NULL; -+ } -+ -+ fp = fdopen(fd, write ? "w" : "r"); -+ if (!fp) { -+ pr_err("%s: Failed get pointer for %s", path, write ? "write" : "read"); -+ return NULL; -+ } -+ -+ if (write) -+ ret = write_fp(fp, size, sizeof(*size)); -+ else -+ ret = read_fp(fp, size, sizeof(*size)); -+ -+ if (ret) { -+ pr_err("%s:Failed to access file size", path); -+ fclose(fp); -+ return NULL; -+ } -+ -+ pr_debug("%s:Opened file for %s with size:%ld\n", path, write ? "write" : "read", *size); -+ return fp; -+} -+ -+int read_file(const char *file_path, void *buf, const size_t buf_len) -+{ -+ int ret; -+ FILE *fp; -+ -+ fp = fopen(file_path, "r"); -+ if (!fp) { -+ pr_err("Cannot fopen %s", file_path); -+ return -errno; -+ } -+ -+ ret = read_fp(fp, buf, buf_len); -+ fclose(fp); /* this will also close fd */ -+ return ret; -+} -+ -+ -+/** -+ * @brief Write an image file -+ * -+ * We store the size of the actual contents in the first 8-bytes of the file. This allows us to -+ * determine the file size when using criu_image_streamer when fseek and fstat are not available. -+ * -+ * @param path The file path -+ * @param buf pointer to data to be written -+ * @param buf_len size of buf -+ * @return 0 if successful. -errno on failure -+ */ -+int write_img_file(char *path, const void *buf, const size_t buf_len) -+{ -+ int ret; -+ FILE *fp; -+ size_t len = buf_len; -+ -+ fp = open_img_file(path, true, &len); -+ if (!fp) -+ return -errno; -+ -+ ret = write_fp(fp, buf, buf_len); -+ fclose(fp); /* this will also close fd */ -+ return ret; -+} -+ -+void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list) -+{ -+ struct kfd_criu_bo_bucket *bo; -+ -+ pr_info("\n"); -+ for (int idx = 0; idx < bo_cnt; idx++) { -+ bo = &bo_list[idx]; -+ pr_info("\n"); -+ pr_info("%s(), %d. KFD BO Addr: %llx \n", __func__, idx, bo->addr); -+ pr_info("%s(), %d. KFD BO Size: %llx \n", __func__, idx, bo->size); -+ pr_info("%s(), %d. KFD BO Offset: %llx \n", __func__, idx, bo->offset); -+ pr_info("%s(), %d. KFD BO Restored Offset: %llx \n", __func__, idx, bo->restored_offset); -+ pr_info("%s(), %d. KFD BO Alloc Flags: %x \n", __func__, idx, bo->alloc_flags); -+ pr_info("%s(), %d. KFD BO Gpu ID: %x \n", __func__, idx, bo->gpu_id); -+ pr_info("%s(), %d. KFD BO Dmabuf FD: %x \n", __func__, idx, bo->dmabuf_fd); -+ pr_info("\n"); -+ } -+ pr_info("\n"); -+} -+ -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_util.h b/plugins/amdgpu/amdgpu_plugin_util.h -new file mode 100755 -index 000000000..aacca3a28 ---- /dev/null -+++ b/plugins/amdgpu/amdgpu_plugin_util.h -@@ -0,0 +1,106 @@ -+#ifndef __AMDGPU_PLUGIN_UTIL_H__ -+#define __AMDGPU_PLUGIN_UTIL_H__ -+ -+#ifndef _GNU_SOURCE -+#define _GNU_SOURCE 1 -+#endif -+ -+#ifdef COMPILE_TESTS -+#undef pr_err -+#define pr_err(format, arg...) fprintf(stdout, "%s:%d ERROR:" format, __FILE__, __LINE__, ##arg) -+#undef pr_info -+#define pr_info(format, arg...) fprintf(stdout, "%s:%d INFO:" format, __FILE__, __LINE__, ##arg) -+#undef pr_debug -+#define pr_debug(format, arg...) fprintf(stdout, "%s:%d DBG:" format, __FILE__, __LINE__, ##arg) -+ -+#undef pr_perror -+#define pr_perror(format, arg...) \ -+ fprintf(stdout, "%s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno)) -+#endif -+ -+#ifdef LOG_PREFIX -+#undef LOG_PREFIX -+#endif -+#define LOG_PREFIX "amdgpu_plugin: " -+ -+#ifdef DEBUG -+#define plugin_log_msg(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) -+#else -+#define plugin_log_msg(fmt, ...) \ -+ { \ -+ } -+#endif -+ -+ -+/* Path where KFD device is surfaced */ -+#define AMDGPU_KFD_DEVICE "/dev/kfd" -+ -+/* Path where DRM devices are surfaced */ -+#define AMDGPU_DRM_DEVICE "/dev/dri/renderD%d" -+ -+/* Minimum version of KFD IOCTL's that supports C&R */ -+#define KFD_IOCTL_MAJOR_VERSION 1 -+#define MIN_KFD_IOCTL_MINOR_VERSION 8 -+ -+/* Name of file having serialized data of KFD device */ -+#define IMG_KFD_FILE "amdgpu-kfd-%d.img" -+ -+/* Name of file having serialized data of KFD buffer objects (BOs) */ -+#define IMG_KFD_PAGES_FILE "amdgpu-pages-%d-%04x.img" -+ -+/* Name of file having serialized data of DRM device */ -+#define IMG_DRM_FILE "amdgpu-renderD-%d.img" -+ -+/* Name of file having serialized data of DRM device buffer objects (BOs) */ -+#define IMG_DRM_PAGES_FILE "amdgpu-drm-pages-%d-%04x.img" -+ -+/* Helper macros to Checkpoint and Restore a ROCm file */ -+#define HSAKMT_SHM_PATH "/dev/shm/hsakmt_shared_mem" -+#define HSAKMT_SHM "/hsakmt_shared_mem" -+#define HSAKMT_SEM_PATH "/dev/shm/sem.hsakmt_semaphore" -+#define HSAKMT_SEM "hsakmt_semaphore" -+ -+/* Help macros to build sDMA command packets */ -+#define SDMA_PACKET(op, sub_op, e) ((((e)&0xFFFF) << 16) | (((sub_op)&0xFF) << 8) | (((op)&0xFF) << 0)) -+ -+#define SDMA_OPCODE_COPY 1 -+#define SDMA_COPY_SUB_OPCODE_LINEAR 0 -+#define SDMA_NOP 0 -+#define SDMA_LINEAR_COPY_MAX_SIZE (1ULL << 21) -+ -+enum sdma_op_type { -+ SDMA_OP_VRAM_READ, -+ SDMA_OP_VRAM_WRITE, -+}; -+ -+/* Helper structures to encode device topology of SRC and DEST platforms */ -+extern struct tp_system src_topology; -+extern struct tp_system dest_topology; -+ -+/* Helper structures to encode device maps during Checkpoint and Restore operations */ -+extern struct device_maps checkpoint_maps; -+extern struct device_maps restore_maps; -+ -+extern int fd_next; -+ -+extern bool kfd_fw_version_check; -+extern bool kfd_sdma_fw_version_check; -+extern bool kfd_caches_count_check; -+extern bool kfd_num_gws_check; -+extern bool kfd_vram_size_check; -+extern bool kfd_numa_check; -+extern bool kfd_capability_check; -+ -+int read_fp(FILE *fp, void *buf, const size_t buf_len); -+int write_fp(FILE *fp, const void *buf, const size_t buf_len); -+int read_file(const char *file_path, void *buf, const size_t buf_len); -+int write_img_file(char *path, const void *buf, const size_t buf_len); -+FILE *open_img_file(char *path, bool write, size_t *size); -+ -+bool checkpoint_is_complete(); -+void decrement_checkpoint_count(); -+void init_gpu_count(struct tp_system *topology); -+ -+void print_kfd_bo_stat(int bo_cnt, struct kfd_criu_bo_bucket *bo_list); -+ -+#endif /* __AMDGPU_PLUGIN_UTIL_H__ */ -diff --git a/plugins/amdgpu/criu-amdgpu.proto b/plugins/amdgpu/criu-amdgpu.proto -index 81d00d3ff..078b67650 100644 ---- a/plugins/amdgpu/criu-amdgpu.proto -+++ b/plugins/amdgpu/criu-amdgpu.proto -@@ -5,7 +5,7 @@ message dev_iolink { - required uint32 node_to_id = 2; - } - --message device_entry { -+message kfd_device_entry { - required uint32 node_id = 1; - required uint32 gpu_id = 2; - required uint32 cpu_cores_count = 3; -@@ -40,10 +40,10 @@ message device_entry { - repeated dev_iolink iolinks = 32; - } - --message bo_entry { -- required uint64 addr = 1; -- required uint64 size = 2; -- required uint64 offset = 3; -+message kfd_bo_entry { -+ required uint64 addr = 1; -+ required uint64 size = 2; -+ required uint64 offset = 3; - required uint32 alloc_flags = 4; - required uint32 gpu_id = 5; - } -@@ -52,10 +52,10 @@ message criu_kfd { - required uint32 pid = 1; - required uint32 num_of_gpus = 2; - required uint32 num_of_cpus = 3; -- repeated device_entry device_entries = 4; -- required uint64 num_of_bos = 5; -- repeated bo_entry bo_entries = 6; -- required uint32 num_of_objects = 7; -+ repeated kfd_device_entry device_entries = 4; -+ required uint64 num_of_bos = 5; -+ repeated kfd_bo_entry bo_entries = 6; -+ required uint32 num_of_objects = 7; - required uint64 shared_mem_size = 8; - required uint32 shared_mem_magic = 9; - required bytes priv_data = 10; --- -2.45.1 - diff --git a/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch b/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch deleted file mode 100644 index 213f609..0000000 --- a/plugins-amdgpu-refactor-code-used-to-implement-checkp.patch +++ /dev/null @@ -1,186 +0,0 @@ -From 9d9ae2954d3f1758ea659ed8e614dd28e8a368dd Mon Sep 17 00:00:00 2001 -From: Ramesh Errabolu -Date: Fri, 10 Nov 2023 13:02:49 -0600 -Subject: [PATCH] amdgpu_plugin: Refactor code used to implement Checkpoint - -Refactor code used to Checkpoint DRM devices. Code is moved -into amdgpu_plugin_drm.c file which hosts various methods to -checkpoint and restore a workload. - -Signed-off-by: Ramesh Errabolu ---- - plugins/amdgpu/amdgpu_plugin.c | 62 ++++++++++++++---------------- - plugins/amdgpu/amdgpu_plugin_drm.c | 38 ++++++++++++++++++ - plugins/amdgpu/amdgpu_plugin_drm.h | 6 +++ - 3 files changed, 73 insertions(+), 33 deletions(-) - -diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c -index 60e04f973..a579158d0 100644 ---- a/plugins/amdgpu/amdgpu_plugin.c -+++ b/plugins/amdgpu/amdgpu_plugin.c -@@ -49,6 +49,13 @@ struct vma_metadata { - - /************************************ Global Variables ********************************************/ - -+/** -+ * FD of KFD device used to checkpoint. On a multi-process -+ * tree the order of checkpointing goes from parent to child -+ * and so on - so saving the FD will not be overwritten -+ */ -+static int kfd_checkpoint_fd; -+ - static LIST_HEAD(update_vma_info_list); - - size_t kfd_max_buffer_size; -@@ -990,6 +997,10 @@ static int unpause_process(int fd) - goto exit; - } - -+ // Reset the KFD FD -+ kfd_checkpoint_fd = -1; -+ sys_close_drm_render_devices(&src_topology); -+ - exit: - pr_info("Process unpaused %s (ret:%d)\n", ret ? "Failed" : "Ok", ret); - -@@ -1181,44 +1192,25 @@ int amdgpu_plugin_dump_file(int fd, int id) - return -1; - } - -+ /* Initialize number of device files that will be checkpointed */ -+ init_gpu_count(&src_topology); -+ - /* Check whether this plugin was called for kfd or render nodes */ - if (major(st.st_rdev) != major(st_kfd.st_rdev) || minor(st.st_rdev) != 0) { -+ - /* This is RenderD dumper plugin, for now just save renderD - * minor number to be used during restore. In later phases this - * needs to save more data for video decode etc. - */ -- -- CriuRenderNode rd = CRIU_RENDER_NODE__INIT; -- struct tp_node *tp_node; -- -- pr_info("Dumper called for /dev/dri/renderD%d, FD = %d, ID = %d\n", minor(st.st_rdev), fd, id); -- -- tp_node = sys_get_node_by_render_minor(&src_topology, minor(st.st_rdev)); -- if (!tp_node) { -- pr_err("Failed to find a device with minor number = %d\n", minor(st.st_rdev)); -- -- return -ENODEV; -- } -- -- rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); -- if (!rd.gpu_id) -- return -ENODEV; -- -- len = criu_render_node__get_packed_size(&rd); -- buf = xmalloc(len); -- if (!buf) -- return -ENOMEM; -- -- criu_render_node__pack(&rd, buf); -- -- snprintf(img_path, sizeof(img_path), IMG_DRM_FILE, id); -- ret = write_img_file(img_path, buf, len); -- if (ret) { -- xfree(buf); -+ ret = amdgpu_plugin_drm_dump_file(fd, id, &st); -+ if (ret) - return ret; -- } - -- xfree(buf); -+ /* Invoke unpause process if needed */ -+ decrement_checkpoint_count(); -+ if (checkpoint_is_complete()) { -+ ret = unpause_process(kfd_checkpoint_fd); -+ } - - /* Need to return success here so that criu can call plugins for renderD nodes */ - return ret; -@@ -1315,11 +1307,15 @@ int amdgpu_plugin_dump_file(int fd, int id) - ret = write_img_file(img_path, buf, len); - - xfree(buf); -+ - exit: -- /* Restore all queues */ -- unpause_process(fd); -+ /* Restore all queues if conditions permit */ -+ kfd_checkpoint_fd = fd; -+ decrement_checkpoint_count(); -+ if (checkpoint_is_complete()) { -+ ret = unpause_process(fd); -+ } - -- sys_close_drm_render_devices(&src_topology); - xfree((void *)args.devices); - xfree((void *)args.bos); - xfree((void *)args.priv_data); -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c -index a48dc68f0..689d62072 100644 ---- a/plugins/amdgpu/amdgpu_plugin_drm.c -+++ b/plugins/amdgpu/amdgpu_plugin_drm.c -@@ -61,3 +61,41 @@ int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *st) - } - - -+int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) -+{ -+ CriuRenderNode rd = CRIU_RENDER_NODE__INIT; -+ struct tp_node *tp_node; -+ char path[PATH_MAX]; -+ unsigned char *buf; -+ int minor; -+ int len; -+ int ret; -+ -+ /* Get the topology node of the DRM device */ -+ minor = minor(drm->st_rdev); -+ tp_node = sys_get_node_by_render_minor(&src_topology, minor); -+ if (!tp_node) { -+ pr_err("Failed to find a device with minor number = %d\n", minor); -+ return -ENODEV; -+ } -+ -+ /* Get the GPU_ID of the DRM device */ -+ rd.gpu_id = maps_get_dest_gpu(&checkpoint_maps, tp_node->gpu_id); -+ if (!rd.gpu_id) { -+ pr_err("Failed to find valid gpu_id for the device = %d\n", rd.gpu_id); -+ return -ENODEV; -+ } -+ -+ len = criu_render_node__get_packed_size(&rd); -+ buf = xmalloc(len); -+ if (!buf) -+ return -ENOMEM; -+ -+ criu_render_node__pack(&rd, buf); -+ -+ snprintf(path, sizeof(path), IMG_DRM_FILE, id); -+ ret = write_img_file(path, buf, len); -+ xfree(buf); -+ return ret; -+} -+ -diff --git a/plugins/amdgpu/amdgpu_plugin_drm.h b/plugins/amdgpu/amdgpu_plugin_drm.h -index 37009c8ba..6f0c1a9a6 100644 ---- a/plugins/amdgpu/amdgpu_plugin_drm.h -+++ b/plugins/amdgpu/amdgpu_plugin_drm.h -@@ -17,6 +17,12 @@ - */ - int amdgpu_plugin_drm_handle_device_vma(int fd, const struct stat *drm); - -+/** -+ * Serialize meta-data about a particular DRM device, its number of BOs, -+ * etc into a file. The serialized filename has in it the value ID that -+ * is passed in as a parameter -+ */ -+int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm); - - #endif /* __AMDGPU_PLUGIN_DRM_H__ */ - --- -2.45.1 - diff --git a/sources b/sources index bb80cdd..8b4fba8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-3.19.tar.gz) = d243818cdac51580c952a80e9164786a67ce5e294c0faa6dc700f5e8da8e36495f0b64f5c27b345ede7d6697ed7a69fa4e9a85cef451f32e3ffeb78564884571 +SHA512 (criu-4.0.tar.gz) = 38a3ae353385b1cc4e63f9b317af67bea88d67322e549cf87501873d59bdcc50e92f9c2ef85c736973c551520a91f579f80a010871d245b1a43a29f9fc69b1ab From 2feabdb937743ad034b10ba3314abcdc3dbab8ae Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 26 Sep 2024 12:43:05 +0100 Subject: [PATCH 28/53] spec: add tmpfiles_create This patch fixes the following warning: criu.x86_64: W: post-without-tmpfile-creation /usr/lib/tmpfiles.d/criu.conf Please use the %tmpfiles_create macro in %post for each of your tmpfiles.d files if you expect this file or directory to be available after package installation (and before reboot). Signed-off-by: Radostin Stoyanov --- criu.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/criu.spec b/criu.spec index 2ec6857..14f1995 100644 --- a/criu.spec +++ b/criu.spec @@ -184,6 +184,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_sbindir}/criu-ns %doc %{_mandir}/man1/criu-ns.1* +%post +%tmpfiles_create %{name}.conf + %changelog * Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 - Update to 4.0 From ec94fa8515afaeef695766249007689cc88a77b2 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Thu, 26 Sep 2024 13:15:26 +0100 Subject: [PATCH 29/53] spec: set PIPFLAGS to run pip without network Signed-off-by: Radostin Stoyanov --- criu.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 14f1995..10c8c87 100644 --- a/criu.spec +++ b/criu.spec @@ -133,10 +133,10 @@ make docs V=1 %install sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} -make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-cuda_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu -make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 @@ -191,6 +191,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a * Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 - Update to 4.0 - Add package for cuda-plugin +- Run pip install without internet access * Wed Jul 17 2024 Fedora Release Engineering - 3.19-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 4684ea74f8cede8a044064bab9f179f9d4e4e58e Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 17 Oct 2024 12:43:08 +0200 Subject: [PATCH 30/53] Recommends: iptables Signed-off-by: Adrian Reber --- criu.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 10c8c87..9228159 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -42,6 +42,8 @@ BuildRequires: gnutls-devel BuildRequires: libdrm-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar +# CRIU requires some version of iptables-restore for network locking +Recommends: iptables %if 0%{?fedora} BuildRequires: libbsd-devel BuildRequires: nftables-devel @@ -188,6 +190,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Thu Oct 17 2024 Adrian Reber - 4.0-2 +- Recommends: iptables + * Thu Sep 26 2024 Radostin Stoyanov - 4.0-1 - Update to 4.0 - Add package for cuda-plugin From f6e7edaf73e45ffad6f96708917721a9b2f4f492 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sun, 8 Dec 2024 09:06:12 +0000 Subject: [PATCH 31/53] Apply patch to handle vvar_vclock vma-s in rawhide https://bugzilla.redhat.com/show_bug.cgi?id=2328985 https://github.com/checkpoint-restore/criu/issues/2532 Signed-off-by: Radostin Stoyanov --- criu.spec | 7 +- vdso-handle-vvar_vclock-vma-s.patch | 181 ++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 vdso-handle-vvar_vclock-vma-s.patch diff --git a/criu.spec b/criu.spec index 9228159..93d2bff 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -24,6 +24,7 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v Patch99: criu.pc.patch Patch100: Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch +Patch101: vdso-handle-vvar_vclock-vma-s.patch Source5: criu-tmpfiles.conf @@ -119,6 +120,7 @@ This script can help to workaround the so called "PID mismatch" problem. %patch -P 99 -p1 %patch -P 100 -p1 +%patch -P 101 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until @@ -190,6 +192,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Sun Dec 08 2024 Radostin Stoyanov - 4.0-3 +- Apply patch to handle vvar_vclock vma-s in rawhide + * Thu Oct 17 2024 Adrian Reber - 4.0-2 - Recommends: iptables diff --git a/vdso-handle-vvar_vclock-vma-s.patch b/vdso-handle-vvar_vclock-vma-s.patch new file mode 100644 index 0000000..2dd939b --- /dev/null +++ b/vdso-handle-vvar_vclock-vma-s.patch @@ -0,0 +1,181 @@ +From 058572e91dea1d8ac9c345e69e08a58e8abfacbb Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Thu, 5 Dec 2024 22:17:38 +0000 +Subject: [PATCH] vdso: handle vvar_vclock vma-s + +The vvar_vclock was introduced by [1]. Basically, the old vvar vma has +been splited on two parts. In term of C/R, these two vma-s can be still +treated as one. + +[1] e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated mapping") + +Signed-off-by: Andrei Vagin +--- + criu/include/util-vdso.h | 1 + + criu/pie/parasite-vdso.c | 19 ++++++++++++++++++- + criu/proc_parse.c | 23 +++++++++++++++++++---- + criu/vdso.c | 28 +++++++++++++++++++++------- + 4 files changed, 59 insertions(+), 12 deletions(-) + +diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h +index c4386cf8e..9fd9a6de4 100644 +--- a/criu/include/util-vdso.h ++++ b/criu/include/util-vdso.h +@@ -30,6 +30,7 @@ struct vdso_symbol { + struct vdso_symtable { + unsigned long vdso_size; + unsigned long vvar_size; ++ unsigned long vvar_vclock_size; + struct vdso_symbol symbols[VDSO_SYMBOL_MAX]; + bool vdso_before_vvar; /* order of vdso/vvar pair */ + }; +diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c +index 355007fa9..f3ad3107f 100644 +--- a/criu/pie/parasite-vdso.c ++++ b/criu/pie/parasite-vdso.c +@@ -45,6 +45,7 @@ static int remap_one(char *who, unsigned long *from, unsigned long to, size_t si + static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) + { + unsigned long vvar_size = rt->sym.vvar_size; ++ unsigned long vvar_vclock_size = rt->sym.vvar_vclock_size; + unsigned long vdso_size = rt->sym.vdso_size; + int ret; + +@@ -54,8 +55,24 @@ static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) + + std_log_set_gettimeofday(NULL); /* stop using vdso for timings */ + +- if (vvar) ++ if (vvar) { ++ /* ++ * v6.13-rc1~172^2~9 splits the vvar vma in two parts vvar and ++ * vvar_clock. The last one is mapped right after the first ++ * one. ++ */ ++ if (vvar_vclock_size) { ++ unsigned long from; ++ ++ vvar_size -= vvar_vclock_size; ++ from = rt->vvar_start + vvar_size; ++ ++ ret = remap_one("rt-vvar", &from, vvar + vvar_size, vvar_vclock_size); ++ if (ret) ++ return ret; ++ } + ret = remap_one("rt-vvar", &rt->vvar_start, vvar, vvar_size); ++ } + + if (!ret) + vdso_update_gtod_addr(rt); +diff --git a/criu/proc_parse.c b/criu/proc_parse.c +index 95ebe3a41..6c4303e7d 100644 +--- a/criu/proc_parse.c ++++ b/criu/proc_parse.c +@@ -579,7 +579,8 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat + } else if (!strcmp(file_path, "[vdso]")) { + if (handle_vdso_vma(vma_area)) + goto err; +- } else if (!strcmp(file_path, "[vvar]")) { ++ } else if (!strcmp(file_path, "[vvar]") || ++ !strcmp(file_path, "[vvar_vclock]")) { + if (handle_vvar_vma(vma_area)) + goto err; + } else if (!strcmp(file_path, "[heap]")) { +@@ -771,7 +772,7 @@ static int task_size_check(pid_t pid, VmaEntry *entry) + + int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t dump_filemap) + { +- struct vma_area *vma_area = NULL; ++ struct vma_area *vma_area = NULL, *prev_vma_area = NULL; + unsigned long start, end, pgoff, prev_end = 0; + char r, w, x, s; + int ret = -1, vm_file_fd = -1; +@@ -813,8 +814,22 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t du + continue; + } + +- if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) +- goto err; ++ if (vma_area && vma_area_is(vma_area, VMA_AREA_VVAR) && ++ prev_vma_area && vma_area_is(prev_vma_area, VMA_AREA_VVAR)) { ++ if (prev_vma_area->e->end != vma_area->e->start) { ++ pr_err("two nonconsecutive vvar vma-s: " ++ "%" PRIx64 "-%" PRIx64 " %" PRIx64 "-%" PRIx64 "\n", ++ prev_vma_area->e->start, prev_vma_area->e->end, ++ vma_area->e->start, vma_area->e->end); ++ goto err; ++ } ++ /* Merge all vvar vma-s into one. */ ++ prev_vma_area->e->end = vma_area->e->end; ++ } else { ++ if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) ++ goto err; ++ prev_vma_area = vma_area; ++ } + + if (eof) + break; +diff --git a/criu/vdso.c b/criu/vdso.c +index 7de2fae78..d4d351131 100644 +--- a/criu/vdso.c ++++ b/criu/vdso.c +@@ -310,7 +310,7 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) + + while (1) { + unsigned long start, end; +- char *has_vdso, *has_vvar; ++ char *has_vdso, *has_vvar, *has_vvar_vclock; + + buf = breadline(&f); + if (buf == NULL) +@@ -318,13 +318,19 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) + if (IS_ERR(buf)) + goto err; + +- has_vdso = strstr(buf, "[vdso]"); +- if (!has_vdso) ++ has_vvar = NULL; ++ has_vvar_vclock = NULL; ++ do { ++ has_vdso = strstr(buf, "[vdso]"); ++ if (has_vdso) ++ break; + has_vvar = strstr(buf, "[vvar]"); +- else +- has_vvar = NULL; ++ if (has_vvar) ++ break; ++ has_vvar_vclock = strstr(buf, "[vvar_vclock]"); ++ } while (0); + +- if (!has_vdso && !has_vvar) ++ if (!has_vdso && !has_vvar && !has_vvar_vclock) + continue; + + if (sscanf(buf, "%lx-%lx", &start, &end) != 2) { +@@ -339,13 +345,21 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) + } + s->vdso_start = start; + s->sym.vdso_size = end - start; +- } else { ++ } else if (has_vvar) { + if (s->vvar_start != VVAR_BAD_ADDR) { + pr_err("Got second VVAR entry\n"); + goto err; + } + s->vvar_start = start; + s->sym.vvar_size = end - start; ++ } else { ++ if (s->vvar_start == VDSO_BAD_ADDR || ++ s->vvar_start + s->sym.vvar_size != start) { ++ pr_err("VVAR and VVAR_VCLOCK entries are not subsequent\n"); ++ goto err; ++ } ++ s->sym.vvar_vclock_size = end - start; ++ s->sym.vvar_size += s->sym.vvar_vclock_size; + } + } + +-- +2.47.0 + From 5fe5814843c7904ed507db08ede8e3a0e6682c8d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 14:52:14 +0000 Subject: [PATCH 32/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 93d2bff..4d19f2a 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -192,6 +192,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 4.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Sun Dec 08 2024 Radostin Stoyanov - 4.0-3 - Apply patch to handle vvar_vclock vma-s in rawhide From 0c47d09fe9e057f303d56c63b2ffc43cc4d724e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 27 Jan 2025 13:45:55 +0100 Subject: [PATCH 33/53] Fix build when sbindir != /usr/sbin ... (rhbz#2340011) --- criu.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 4d19f2a..ba00bdd 100644 --- a/criu.spec +++ b/criu.spec @@ -136,11 +136,11 @@ make docs V=1 %install sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile -make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} +make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} BINDIR=%{_bindir} SBINDIR=%{_sbindir} make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-amdgpu_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu make install-cuda_plugin DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PLUGINDIR=%{_libdir}/criu -make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} BINDIR=%{_bindir} SBINDIR=%{_sbindir} PYTHON=%{py_binary} PIPFLAGS="--no-build-isolation --no-index --no-deps --progress-bar off --upgrade --ignore-installed" make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 From f2a112e667f55fb1ef6c3b00e13e7d9cda3c4bff Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 7 Apr 2025 13:08:31 +0100 Subject: [PATCH 34/53] Update to 4.1 Signed-off-by: Radostin Stoyanov --- .gitignore | 1 + ...onfig-set-CR_PLUGIN_DEFAULT-variable.patch | 49 ----- criu.spec | 18 +- sources | 2 +- vdso-handle-vvar_vclock-vma-s.patch | 181 ------------------ 5 files changed, 9 insertions(+), 242 deletions(-) delete mode 100644 Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch delete mode 100644 vdso-handle-vvar_vclock-vma-s.patch diff --git a/.gitignore b/.gitignore index d704cea..7bd1f04 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ /criu-3.18.tar.gz /criu-3.19.tar.gz /criu-4.0.tar.gz +/criu-4.1.tar.gz diff --git a/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch b/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch deleted file mode 100644 index 7f9584d..0000000 --- a/Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch +++ /dev/null @@ -1,49 +0,0 @@ -From bb35901e78216917ce8066fa805ce27f273d76a2 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Thu, 26 Sep 2024 10:59:32 +0100 -Subject: [PATCH] Makefile.config: set CR_PLUGIN_DEFAULT variable - -By default, CRIU uses the path "/usr/lib/criu" to install and load -plugins at runtime. This path is defined by the `PLUGINDIR` variable -in Makefile.install and `CR_PLUGIN_DEFAULT` in `criu/include/plugin.h`. -However, some distribution packages might install the CRIU plugins at -"/usr/lib64/criu" instead. This patch updates the makefile to align -the path defined by `CR_PLUGIN_DEFAULT` with the value of `PLUGINDIR`. - -Signed-off-by: Radostin Stoyanov ---- - Makefile.config | 4 ++++ - plugins/amdgpu/Makefile | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/Makefile.config b/Makefile.config -index 52c250b21..5ab689d41 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -59,6 +59,10 @@ endif - - export LIBS += $(LIBS_FEATURES) - -+ifneq ($(PLUGINDIR),) -+ FEATURE_DEFINES += -DCR_PLUGIN_DEFAULT="\"$(PLUGINDIR)\"" -+endif -+ - CONFIG_FILE = .config - - $(CONFIG_FILE): -diff --git a/plugins/amdgpu/Makefile b/plugins/amdgpu/Makefile -index 7d3388b80..a20d1d163 100644 ---- a/plugins/amdgpu/Makefile -+++ b/plugins/amdgpu/Makefile -@@ -15,7 +15,7 @@ DEPS_NOK := ; - __nmk_dir ?= ../../scripts/nmk/scripts/ - include $(__nmk_dir)msg.mk - --PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" -+PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC - PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu - - ifeq ($(CONFIG_AMDGPU),y) --- -2.46.1 - diff --git a/criu.spec b/criu.spec index ba00bdd..26d8efb 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _auto_set_build_flags Name: criu -Version: 4.0 -Release: 4%{?dist} +Version: 4.1 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -23,9 +23,6 @@ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{v # in RPM and DEB is different. Patch99: criu.pc.patch -Patch100: Makefile.config-set-CR_PLUGIN_DEFAULT-variable.patch -Patch101: vdso-handle-vvar_vclock-vma-s.patch - Source5: criu-tmpfiles.conf BuildRequires: gcc @@ -41,10 +38,9 @@ BuildRequires: perl-interpreter BuildRequires: libselinux-devel BuildRequires: gnutls-devel BuildRequires: libdrm-devel +BuildRequires: libuuid-devel # Checkpointing containers with a tmpfs requires tar Recommends: tar -# CRIU requires some version of iptables-restore for network locking -Recommends: iptables %if 0%{?fedora} BuildRequires: libbsd-devel BuildRequires: nftables-devel @@ -119,9 +115,6 @@ This script can help to workaround the so called "PID mismatch" problem. %setup -q %patch -P 99 -p1 -%patch -P 100 -p1 -%patch -P 101 -p1 - %build # This package calls LD directly without specifying the LTO plugins. Until # that is fixed, disable LTO. @@ -129,7 +122,7 @@ This script can help to workaround the so called "PID mismatch" problem. # %{?_smp_mflags} does not work # -fstack-protector breaks build -CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} PLUGINDIR=%{_libdir}/criu +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} PLUGINDIR=%{_libdir}/criu NETWORK_LOCK_DEFAULT=NETWORK_LOCK_NFTABLES make V=1 WERROR=0 PREFIX=%{_prefix} PLUGINDIR=%{_libdir}/criu amdgpu_plugin make docs V=1 @@ -192,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Apr 07 2025 Radostin Stoyanov - 4.1-1 +- Update to 4.1 + * Thu Jan 16 2025 Fedora Release Engineering - 4.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/sources b/sources index 8b4fba8..79397e1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-4.0.tar.gz) = 38a3ae353385b1cc4e63f9b317af67bea88d67322e549cf87501873d59bdcc50e92f9c2ef85c736973c551520a91f579f80a010871d245b1a43a29f9fc69b1ab +SHA512 (criu-4.1.tar.gz) = 769001a7e527c129fe73509fd0c7d3fc3b9b1080dc69929032cb84f60f95256f5d145ed4b7ea11f090a7f468f2bb2a0ecf56475eb292966cad26d643f0e46816 diff --git a/vdso-handle-vvar_vclock-vma-s.patch b/vdso-handle-vvar_vclock-vma-s.patch deleted file mode 100644 index 2dd939b..0000000 --- a/vdso-handle-vvar_vclock-vma-s.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 058572e91dea1d8ac9c345e69e08a58e8abfacbb Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Thu, 5 Dec 2024 22:17:38 +0000 -Subject: [PATCH] vdso: handle vvar_vclock vma-s - -The vvar_vclock was introduced by [1]. Basically, the old vvar vma has -been splited on two parts. In term of C/R, these two vma-s can be still -treated as one. - -[1] e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated mapping") - -Signed-off-by: Andrei Vagin ---- - criu/include/util-vdso.h | 1 + - criu/pie/parasite-vdso.c | 19 ++++++++++++++++++- - criu/proc_parse.c | 23 +++++++++++++++++++---- - criu/vdso.c | 28 +++++++++++++++++++++------- - 4 files changed, 59 insertions(+), 12 deletions(-) - -diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h -index c4386cf8e..9fd9a6de4 100644 ---- a/criu/include/util-vdso.h -+++ b/criu/include/util-vdso.h -@@ -30,6 +30,7 @@ struct vdso_symbol { - struct vdso_symtable { - unsigned long vdso_size; - unsigned long vvar_size; -+ unsigned long vvar_vclock_size; - struct vdso_symbol symbols[VDSO_SYMBOL_MAX]; - bool vdso_before_vvar; /* order of vdso/vvar pair */ - }; -diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c -index 355007fa9..f3ad3107f 100644 ---- a/criu/pie/parasite-vdso.c -+++ b/criu/pie/parasite-vdso.c -@@ -45,6 +45,7 @@ static int remap_one(char *who, unsigned long *from, unsigned long to, size_t si - static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) - { - unsigned long vvar_size = rt->sym.vvar_size; -+ unsigned long vvar_vclock_size = rt->sym.vvar_vclock_size; - unsigned long vdso_size = rt->sym.vdso_size; - int ret; - -@@ -54,8 +55,24 @@ static int park_at(struct vdso_maps *rt, unsigned long vdso, unsigned long vvar) - - std_log_set_gettimeofday(NULL); /* stop using vdso for timings */ - -- if (vvar) -+ if (vvar) { -+ /* -+ * v6.13-rc1~172^2~9 splits the vvar vma in two parts vvar and -+ * vvar_clock. The last one is mapped right after the first -+ * one. -+ */ -+ if (vvar_vclock_size) { -+ unsigned long from; -+ -+ vvar_size -= vvar_vclock_size; -+ from = rt->vvar_start + vvar_size; -+ -+ ret = remap_one("rt-vvar", &from, vvar + vvar_size, vvar_vclock_size); -+ if (ret) -+ return ret; -+ } - ret = remap_one("rt-vvar", &rt->vvar_start, vvar, vvar_size); -+ } - - if (!ret) - vdso_update_gtod_addr(rt); -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 95ebe3a41..6c4303e7d 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -579,7 +579,8 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat - } else if (!strcmp(file_path, "[vdso]")) { - if (handle_vdso_vma(vma_area)) - goto err; -- } else if (!strcmp(file_path, "[vvar]")) { -+ } else if (!strcmp(file_path, "[vvar]") || -+ !strcmp(file_path, "[vvar_vclock]")) { - if (handle_vvar_vma(vma_area)) - goto err; - } else if (!strcmp(file_path, "[heap]")) { -@@ -771,7 +772,7 @@ static int task_size_check(pid_t pid, VmaEntry *entry) - - int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t dump_filemap) - { -- struct vma_area *vma_area = NULL; -+ struct vma_area *vma_area = NULL, *prev_vma_area = NULL; - unsigned long start, end, pgoff, prev_end = 0; - char r, w, x, s; - int ret = -1, vm_file_fd = -1; -@@ -813,8 +814,22 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, dump_filemap_t du - continue; - } - -- if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) -- goto err; -+ if (vma_area && vma_area_is(vma_area, VMA_AREA_VVAR) && -+ prev_vma_area && vma_area_is(prev_vma_area, VMA_AREA_VVAR)) { -+ if (prev_vma_area->e->end != vma_area->e->start) { -+ pr_err("two nonconsecutive vvar vma-s: " -+ "%" PRIx64 "-%" PRIx64 " %" PRIx64 "-%" PRIx64 "\n", -+ prev_vma_area->e->start, prev_vma_area->e->end, -+ vma_area->e->start, vma_area->e->end); -+ goto err; -+ } -+ /* Merge all vvar vma-s into one. */ -+ prev_vma_area->e->end = vma_area->e->end; -+ } else { -+ if (vma_area && vma_list_add(vma_area, vma_area_list, &prev_end, &vfi, &prev_vfi)) -+ goto err; -+ prev_vma_area = vma_area; -+ } - - if (eof) - break; -diff --git a/criu/vdso.c b/criu/vdso.c -index 7de2fae78..d4d351131 100644 ---- a/criu/vdso.c -+++ b/criu/vdso.c -@@ -310,7 +310,7 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) - - while (1) { - unsigned long start, end; -- char *has_vdso, *has_vvar; -+ char *has_vdso, *has_vvar, *has_vvar_vclock; - - buf = breadline(&f); - if (buf == NULL) -@@ -318,13 +318,19 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) - if (IS_ERR(buf)) - goto err; - -- has_vdso = strstr(buf, "[vdso]"); -- if (!has_vdso) -+ has_vvar = NULL; -+ has_vvar_vclock = NULL; -+ do { -+ has_vdso = strstr(buf, "[vdso]"); -+ if (has_vdso) -+ break; - has_vvar = strstr(buf, "[vvar]"); -- else -- has_vvar = NULL; -+ if (has_vvar) -+ break; -+ has_vvar_vclock = strstr(buf, "[vvar_vclock]"); -+ } while (0); - -- if (!has_vdso && !has_vvar) -+ if (!has_vdso && !has_vvar && !has_vvar_vclock) - continue; - - if (sscanf(buf, "%lx-%lx", &start, &end) != 2) { -@@ -339,13 +345,21 @@ static int vdso_parse_maps(pid_t pid, struct vdso_maps *s) - } - s->vdso_start = start; - s->sym.vdso_size = end - start; -- } else { -+ } else if (has_vvar) { - if (s->vvar_start != VVAR_BAD_ADDR) { - pr_err("Got second VVAR entry\n"); - goto err; - } - s->vvar_start = start; - s->sym.vvar_size = end - start; -+ } else { -+ if (s->vvar_start == VDSO_BAD_ADDR || -+ s->vvar_start + s->sym.vvar_size != start) { -+ pr_err("VVAR and VVAR_VCLOCK entries are not subsequent\n"); -+ goto err; -+ } -+ s->sym.vvar_vclock_size = end - start; -+ s->sym.vvar_size += s->sym.vvar_vclock_size; - } - } - --- -2.47.0 - From 323d01daa05d3d402d05114c21904b645ad755ba Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 21 Apr 2025 20:25:11 +0200 Subject: [PATCH 35/53] Apply upstream patch to fix a runc regression Signed-off-by: Adrian Reber --- 2653.patch | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++ criu.spec | 8 +++- 2 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 2653.patch diff --git a/2653.patch b/2653.patch new file mode 100644 index 0000000..bcb96fd --- /dev/null +++ b/2653.patch @@ -0,0 +1,134 @@ +From 22fdffbdde9476b27988b3ee0a4013a4453784c9 Mon Sep 17 00:00:00 2001 +From: Andrei Vagin +Date: Mon, 21 Apr 2025 06:33:41 +0000 +Subject: [PATCH] net: nftables: avoid restore failure if the CRIU nft table + already exist + +CRIU locks the network during restore in an "empty" network namespace. +However, "empty" in this context means CRIU isn't restoring the +namespace. This network namespace can be the same namespace where +processes have been dumped and so the network is already locked in it. + +Fixes #2650 + +Signed-off-by: Andrei Vagin +--- + criu/cr-restore.c | 2 +- + criu/include/net.h | 2 +- + criu/net.c | 30 +++++++++++++++++------------- + 3 files changed, 19 insertions(+), 15 deletions(-) + +diff --git a/criu/cr-restore.c b/criu/cr-restore.c +index 583b446e0b..30932f60a2 100644 +--- a/criu/cr-restore.c ++++ b/criu/cr-restore.c +@@ -2119,7 +2119,7 @@ static int restore_root_task(struct pstree_item *init) + * the '--empty-ns net' mode no iptables C/R is done and we + * need to return these rules by hands. + */ +- ret = network_lock_internal(); ++ ret = network_lock_internal(/* restore = */ true); + if (ret) + goto out_kill; + } +diff --git a/criu/include/net.h b/criu/include/net.h +index 5e8a848620..7c5ede21e1 100644 +--- a/criu/include/net.h ++++ b/criu/include/net.h +@@ -31,7 +31,7 @@ extern int collect_net_namespaces(bool for_dump); + + extern int network_lock(void); + extern void network_unlock(void); +-extern int network_lock_internal(void); ++extern int network_lock_internal(bool restore); + + extern struct ns_desc net_ns_desc; + +diff --git a/criu/net.c b/criu/net.c +index ee46f1c495..300df480b0 100644 +--- a/criu/net.c ++++ b/criu/net.c +@@ -3206,12 +3206,12 @@ static inline FILE *redirect_nftables_output(struct nft_ctx *nft) + } + #endif + +-static inline int nftables_lock_network_internal(void) ++static inline int nftables_lock_network_internal(bool restore) + { + #if defined(CONFIG_HAS_NFTABLES_LIB_API_0) || defined(CONFIG_HAS_NFTABLES_LIB_API_1) + cleanup_file FILE *fp = NULL; + struct nft_ctx *nft; +- int ret = 0; ++ int ret = 0, exit_code = -1; + char table[32]; + char buf[128]; + +@@ -3224,11 +3224,16 @@ static inline int nftables_lock_network_internal(void) + + fp = redirect_nftables_output(nft); + if (!fp) +- goto out; ++ goto err2; + + snprintf(buf, sizeof(buf), "create table %s", table); +- if (NFT_RUN_CMD(nft, buf)) ++ ret = NFT_RUN_CMD(nft, buf); ++ if (ret) { ++ /* The network has been locked on dump. */ ++ if (restore && errno == EEXIST) ++ return 0; + goto err2; ++ } + + snprintf(buf, sizeof(buf), "add chain %s output { type filter hook output priority 0; policy drop; }", table); + if (NFT_RUN_CMD(nft, buf)) +@@ -3246,17 +3251,16 @@ static inline int nftables_lock_network_internal(void) + if (NFT_RUN_CMD(nft, buf)) + goto err1; + +- goto out; +- ++ exit_code = 0; ++out: ++ nft_ctx_free(nft); ++ return exit_code; + err1: + snprintf(buf, sizeof(buf), "delete table %s", table); + NFT_RUN_CMD(nft, buf); + err2: +- ret = -1; + pr_err("Locking network failed using nftables\n"); +-out: +- nft_ctx_free(nft); +- return ret; ++ goto out; + #else + pr_err("CRIU was built without libnftables support\n"); + return -1; +@@ -3288,7 +3292,7 @@ static int iptables_network_lock_internal(void) + return ret; + } + +-int network_lock_internal(void) ++int network_lock_internal(bool restore) + { + int ret = 0, nsret; + +@@ -3301,7 +3305,7 @@ int network_lock_internal(void) + if (opts.network_lock_method == NETWORK_LOCK_IPTABLES) + ret = iptables_network_lock_internal(); + else if (opts.network_lock_method == NETWORK_LOCK_NFTABLES) +- ret = nftables_lock_network_internal(); ++ ret = nftables_lock_network_internal(restore); + + if (restore_ns(nsret, &net_ns_desc)) + ret = -1; +@@ -3427,7 +3431,7 @@ int network_lock(void) + if (run_scripts(ACT_NET_LOCK)) + return -1; + +- return network_lock_internal(); ++ return network_lock_internal(false); + } + + void network_unlock(void) diff --git a/criu.spec b/criu.spec index 26d8efb..fb0f551 100644 --- a/criu.spec +++ b/criu.spec @@ -12,12 +12,14 @@ Name: criu Version: 4.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz +Patch0: https://github.com/checkpoint-restore/criu/pull/2653.patch + # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -113,6 +115,7 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q +%patch -P 0 -p1 %patch -P 99 -p1 %build @@ -185,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Apr 21 2025 Adrian Reber - 4.1-2 +- Apply upstream patch to fix a runc regression + * Mon Apr 07 2025 Radostin Stoyanov - 4.1-1 - Update to 4.1 From 649d2f33e59e9942e049148cce54894693a7c506 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Sun, 20 Apr 2025 07:01:05 +0300 Subject: [PATCH 36/53] Enable for riscv64 Signed-off-by: David Abdurachmanov --- criu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index fb0f551..bf0627e 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -52,7 +52,7 @@ BuildRequires: make # user-space and kernel changes are only available for x86_64, arm, # ppc64le, aarch64 and s390x # https://bugzilla.redhat.com/show_bug.cgi?id=902875 -ExclusiveArch: x86_64 %{arm} ppc64le aarch64 s390x +ExclusiveArch: x86_64 %{arm} ppc64le aarch64 s390x riscv64 %description criu is the user-space part of Checkpoint/Restore in User-space @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Apr 23 2025 David Abdurachmanov - 4.1-3 +- Enable for riscv64 + * Mon Apr 21 2025 Adrian Reber - 4.1-2 - Apply upstream patch to fix a runc regression From 54afe54e10d7857efed9ea17f938230600c3aa7b Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 17 Jun 2025 21:09:14 +0200 Subject: [PATCH 37/53] Rebuilt for Python 3.14 --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index bf0627e..6917a4a 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Tue Jun 17 2025 Python Maint - 4.1-4 +- Rebuilt for Python 3.14 + * Wed Apr 23 2025 David Abdurachmanov - 4.1-3 - Enable for riscv64 From dd4a14f00a5b1c38c3e44600c499f3a7dea94f79 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 18:50:01 +0000 Subject: [PATCH 38/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 6917a4a..71cacd4 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 4.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Tue Jun 17 2025 Python Maint - 4.1-4 - Rebuilt for Python 3.14 From 88cce10fd3a90853ff054c84043c41e4b16d0216 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Wed, 30 Jul 2025 08:46:06 +0200 Subject: [PATCH 39/53] Update to 4.1.1 Signed-off-by: Adrian Reber --- .gitignore | 1 + criu.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7bd1f04..5e0f8c8 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ /criu-3.19.tar.gz /criu-4.0.tar.gz /criu-4.1.tar.gz +/criu-4.1.1.tar.gz diff --git a/criu.spec b/criu.spec index 71cacd4..b310da5 100644 --- a/criu.spec +++ b/criu.spec @@ -11,8 +11,8 @@ %undefine _auto_set_build_flags Name: criu -Version: 4.1 -Release: 5%{?dist} +Version: 4.1.1 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Jul 30 2025 Adrian Reber - 4.1.1-1 +- Update to 4.1.1 + * Wed Jul 23 2025 Fedora Release Engineering - 4.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index 79397e1..f653226 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-4.1.tar.gz) = 769001a7e527c129fe73509fd0c7d3fc3b9b1080dc69929032cb84f60f95256f5d145ed4b7ea11f090a7f468f2bb2a0ecf56475eb292966cad26d643f0e46816 +SHA512 (criu-4.1.1.tar.gz) = a73c35dbd4ec4d2ead0799c6f1af2f467610c538c3ab4a87f5586aa1d29a8268bbc6c222bb3026a32211b6899a4d39730d61fa453ce2adafa561d92f6c87e228 From 6733bdad08f7eef126fbe911bdefc0f6402af8b1 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 15 Aug 2025 12:43:17 +0200 Subject: [PATCH 40/53] Rebuilt for Python 3.14.0rc2 bytecode --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index b310da5..ab468c5 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Fri Aug 15 2025 Python Maint - 4.1.1-2 +- Rebuilt for Python 3.14.0rc2 bytecode + * Wed Jul 30 2025 Adrian Reber - 4.1.1-1 - Update to 4.1.1 From 678054d8fd9c4280fd093eccd46e2c7c7a7446c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 29 Jul 2025 23:04:08 +0200 Subject: [PATCH 41/53] Drop unused BuildRequires on python3-wheel See https://github.com/fedora-eln/eln/issues/284 --- criu.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index ab468c5..98e755c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -33,7 +33,7 @@ BuildRequires: libnet-devel BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel BuildRequires: %{py_prefix}-pip BuildRequires: %{py_prefix}-setuptools -BuildRequires: %{py_prefix}-wheel +BuildRequires: (%{py_prefix}-wheel if %{py_prefix}-setuptools < 71) BuildRequires: %{py_prefix}-protobuf BuildRequires: asciidoctor BuildRequires: perl-interpreter @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Wed Aug 27 2025 Miro Hrončok - 4.1.1-3 +- Drop unused BuildRequires on python3-wheel + * Fri Aug 15 2025 Python Maint - 4.1.1-2 - Rebuilt for Python 3.14.0rc2 bytecode From ad9dc1a142fcde0ce8cec66ce2432820c5965f69 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 12:12:32 +0200 Subject: [PATCH 42/53] Rebuilt for Python 3.14.0rc3 bytecode --- criu.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/criu.spec b/criu.spec index 98e755c..a40fa5c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -188,6 +188,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Fri Sep 19 2025 Python Maint - 4.1.1-4 +- Rebuilt for Python 3.14.0rc3 bytecode + * Wed Aug 27 2025 Miro Hrončok - 4.1.1-3 - Drop unused BuildRequires on python3-wheel From 5467ca58cd232a1f2cebcc28bd0da60f2386685d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 02:45:34 +0100 Subject: [PATCH 43/53] Update to 4.2 Signed-off-by: Adrian Reber --- .gitignore | 1 + 2653.patch | 134 ----------------------------------------------------- criu.spec | 10 ++-- sources | 2 +- 4 files changed, 7 insertions(+), 140 deletions(-) delete mode 100644 2653.patch diff --git a/.gitignore b/.gitignore index 5e0f8c8..e5c1b1b 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ /criu-4.0.tar.gz /criu-4.1.tar.gz /criu-4.1.1.tar.gz +/criu-4.2.tar.gz diff --git a/2653.patch b/2653.patch deleted file mode 100644 index bcb96fd..0000000 --- a/2653.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 22fdffbdde9476b27988b3ee0a4013a4453784c9 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Mon, 21 Apr 2025 06:33:41 +0000 -Subject: [PATCH] net: nftables: avoid restore failure if the CRIU nft table - already exist - -CRIU locks the network during restore in an "empty" network namespace. -However, "empty" in this context means CRIU isn't restoring the -namespace. This network namespace can be the same namespace where -processes have been dumped and so the network is already locked in it. - -Fixes #2650 - -Signed-off-by: Andrei Vagin ---- - criu/cr-restore.c | 2 +- - criu/include/net.h | 2 +- - criu/net.c | 30 +++++++++++++++++------------- - 3 files changed, 19 insertions(+), 15 deletions(-) - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 583b446e0b..30932f60a2 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -2119,7 +2119,7 @@ static int restore_root_task(struct pstree_item *init) - * the '--empty-ns net' mode no iptables C/R is done and we - * need to return these rules by hands. - */ -- ret = network_lock_internal(); -+ ret = network_lock_internal(/* restore = */ true); - if (ret) - goto out_kill; - } -diff --git a/criu/include/net.h b/criu/include/net.h -index 5e8a848620..7c5ede21e1 100644 ---- a/criu/include/net.h -+++ b/criu/include/net.h -@@ -31,7 +31,7 @@ extern int collect_net_namespaces(bool for_dump); - - extern int network_lock(void); - extern void network_unlock(void); --extern int network_lock_internal(void); -+extern int network_lock_internal(bool restore); - - extern struct ns_desc net_ns_desc; - -diff --git a/criu/net.c b/criu/net.c -index ee46f1c495..300df480b0 100644 ---- a/criu/net.c -+++ b/criu/net.c -@@ -3206,12 +3206,12 @@ static inline FILE *redirect_nftables_output(struct nft_ctx *nft) - } - #endif - --static inline int nftables_lock_network_internal(void) -+static inline int nftables_lock_network_internal(bool restore) - { - #if defined(CONFIG_HAS_NFTABLES_LIB_API_0) || defined(CONFIG_HAS_NFTABLES_LIB_API_1) - cleanup_file FILE *fp = NULL; - struct nft_ctx *nft; -- int ret = 0; -+ int ret = 0, exit_code = -1; - char table[32]; - char buf[128]; - -@@ -3224,11 +3224,16 @@ static inline int nftables_lock_network_internal(void) - - fp = redirect_nftables_output(nft); - if (!fp) -- goto out; -+ goto err2; - - snprintf(buf, sizeof(buf), "create table %s", table); -- if (NFT_RUN_CMD(nft, buf)) -+ ret = NFT_RUN_CMD(nft, buf); -+ if (ret) { -+ /* The network has been locked on dump. */ -+ if (restore && errno == EEXIST) -+ return 0; - goto err2; -+ } - - snprintf(buf, sizeof(buf), "add chain %s output { type filter hook output priority 0; policy drop; }", table); - if (NFT_RUN_CMD(nft, buf)) -@@ -3246,17 +3251,16 @@ static inline int nftables_lock_network_internal(void) - if (NFT_RUN_CMD(nft, buf)) - goto err1; - -- goto out; -- -+ exit_code = 0; -+out: -+ nft_ctx_free(nft); -+ return exit_code; - err1: - snprintf(buf, sizeof(buf), "delete table %s", table); - NFT_RUN_CMD(nft, buf); - err2: -- ret = -1; - pr_err("Locking network failed using nftables\n"); --out: -- nft_ctx_free(nft); -- return ret; -+ goto out; - #else - pr_err("CRIU was built without libnftables support\n"); - return -1; -@@ -3288,7 +3292,7 @@ static int iptables_network_lock_internal(void) - return ret; - } - --int network_lock_internal(void) -+int network_lock_internal(bool restore) - { - int ret = 0, nsret; - -@@ -3301,7 +3305,7 @@ int network_lock_internal(void) - if (opts.network_lock_method == NETWORK_LOCK_IPTABLES) - ret = iptables_network_lock_internal(); - else if (opts.network_lock_method == NETWORK_LOCK_NFTABLES) -- ret = nftables_lock_network_internal(); -+ ret = nftables_lock_network_internal(restore); - - if (restore_ns(nsret, &net_ns_desc)) - ret = -1; -@@ -3427,7 +3431,7 @@ int network_lock(void) - if (run_scripts(ACT_NET_LOCK)) - return -1; - -- return network_lock_internal(); -+ return network_lock_internal(false); - } - - void network_unlock(void) diff --git a/criu.spec b/criu.spec index a40fa5c..c20cbea 100644 --- a/criu.spec +++ b/criu.spec @@ -11,15 +11,13 @@ %undefine _auto_set_build_flags Name: criu -Version: 4.1.1 -Release: 4%{?dist} +Version: 4.2 +Release: 1%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -Patch0: https://github.com/checkpoint-restore/criu/pull/2653.patch - # Add protobuf-c as a dependency. # We use this patch because the protobuf-c package name # in RPM and DEB is different. @@ -115,7 +113,6 @@ This script can help to workaround the so called "PID mismatch" problem. %prep %setup -q -%patch -P 0 -p1 %patch -P 99 -p1 %build @@ -188,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Nov 17 2025 Adrian Reber - 4.2 +- Update to 4.2 + * Fri Sep 19 2025 Python Maint - 4.1.1-4 - Rebuilt for Python 3.14.0rc3 bytecode diff --git a/sources b/sources index f653226..8f69f50 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (criu-4.1.1.tar.gz) = a73c35dbd4ec4d2ead0799c6f1af2f467610c538c3ab4a87f5586aa1d29a8268bbc6c222bb3026a32211b6899a4d39730d61fa453ce2adafa561d92f6c87e228 +SHA512 (criu-4.2.tar.gz) = f7e0ac17d46dd560bb2439f617a0a3b3933eb86f4b8b9b16852d300e4ffc6a4851d72be9342dfd40792a53fca8b65d26fde4e1b1f02bcd04923a8b6f0e5c8a62 From b18123941d500c38b9d94a3e550f33fb67a53f1c Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 10:47:51 +0000 Subject: [PATCH 44/53] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 rpminspect.yaml diff --git a/criu.spec b/criu.spec index c20cbea..d67955f 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2 +* Mon Nov 17 2025 Adrian Reber - 4.2-2 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 0000000..6b8f937 --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,4 @@ +--- +annocheck: + jobs: + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection From c4e321b1d78897969078602af077abbbb8327420 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 14:50:33 +0100 Subject: [PATCH 45/53] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index d67955f..20dbedb 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2-2 +* Mon Nov 17 2025 Adrian Reber - 4.2-3 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml index 6b8f937..56018c6 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,4 @@ --- annocheck: jobs: - - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes From 0f4173bc94b03dcc3818ebf16308b1be3cf652b6 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 17:37:41 +0100 Subject: [PATCH 46/53] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index 20dbedb..9b80e5c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2-3 +* Mon Nov 17 2025 Adrian Reber - 4.2-4 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml index 56018c6..3430463 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,4 @@ --- annocheck: jobs: - - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes --skip-gaps From 368f367e6924e842f6d426eaefdc274b463b15a5 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 18:29:29 +0100 Subject: [PATCH 47/53] Update to 4.2 Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- rpminspect.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index 9b80e5c..ba4379c 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Adrian Reber - 4.2-4 +* Mon Nov 17 2025 Adrian Reber - 4.2-5 - Update to 4.2 * Fri Sep 19 2025 Python Maint - 4.1.1-4 diff --git a/rpminspect.yaml b/rpminspect.yaml index 3430463..93f2777 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,4 @@ --- annocheck: jobs: - - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes --skip-gaps + - hardened: --verbose --skip-dynamic-tags --skip-property-note --skip-bind-now --skip-pie --skip-cf-protection --skip-notes --skip-gaps --skip-optimization --skip-stack-clash --skip-stack-prot From 13061f0076c966f6893e2bb283ffd68b9d3b8d78 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 21:14:44 +0100 Subject: [PATCH 48/53] Convert STI tests to TMT (rhbz#2382879) Signed-off-by: Adrian Reber --- .fmf/version | 1 + criu.spec | 5 ++++- plans.fmf | 24 ++++++++++++++++++++++++ tests/{tests.yml => main.fmf} | 33 +++++++++++++-------------------- tests/run-zdtm.sh | 2 +- 5 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 .fmf/version create mode 100644 plans.fmf rename tests/{tests.yml => main.fmf} (54%) diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/criu.spec b/criu.spec index ba4379c..ed21c01 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,6 +185,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog +* Mon Nov 15 2025 Cristian Le - 4.2-6 +- Convert STI tests to TMT (rhbz#2382879) + * Mon Nov 17 2025 Adrian Reber - 4.2-5 - Update to 4.2 diff --git a/plans.fmf b/plans.fmf new file mode 100644 index 0000000..52b1751 --- /dev/null +++ b/plans.fmf @@ -0,0 +1,24 @@ +summary: Run all tests +discover: + how: fmf +prepare: + - name: Disable installing everything from srpm + how: install + exclude: ".*" + - name: Install the main package + how: install + package: + - criu +execute: + how: tmt + +/zdtm: + # Use the srpm sources + discover+: + dist-git-source: true + dist-git-merge: true + test: /tests/zdtm + +/podman: + discover+: + test: /tests/podman diff --git a/tests/tests.yml b/tests/main.fmf similarity index 54% rename from tests/tests.yml rename to tests/main.fmf index 995fd2d..2062bee 100644 --- a/tests/tests.yml +++ b/tests/main.fmf @@ -1,16 +1,7 @@ ---- -- hosts: localhost - roles: - - role: standard-test-source - tags: - - classic - - role: standard-test-basic - tags: - - classic - required_packages: - - podman - - curl - - jq +/zdtm: + summary: Test zdtm + test: ./run-zdtm.sh + require: - checkpolicy - policycoreutils - make @@ -28,10 +19,12 @@ - python3-pyyaml - python3-protobuf - python-unversioned-command - tests: - - zdtm: - dir: . - run: ./run-zdtm.sh - - podman: - dir: . - run: ./run-podman-checkpoint-restore.sh + - crit + - python3-criu +/podman: + summary: Test podman + test: ./run-podman-checkpoint-restore.sh + require: + - podman + - curl + - jq diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index 460d090..f825928 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -36,7 +36,7 @@ RESULT=42 # this socket brakes CRIU's test cases rm -f /var/lib/sss/pipes/nss -cd "source/criu-$(crit --version)/" +cd ../criu-$(crit --version) echo "Build CRIU" make -j"$(nproc)" From ac36de486b2b2514e6fe69a1a0981fdd408590e5 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 20:33:12 +0000 Subject: [PATCH 49/53] Test debugging Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- tests/main.fmf | 1 + tests/run-podman-checkpoint-restore.sh | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/criu.spec b/criu.spec index ed21c01..6e042fb 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 15 2025 Cristian Le - 4.2-6 +* Mon Nov 15 2025 Cristian Le - 4.2-7 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/tests/main.fmf b/tests/main.fmf index 2062bee..221ef70 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -15,6 +15,7 @@ - libnl3-devel - libcap-devel - libaio-devel + - libuuid-devel - nftables-devel - python3-pyyaml - python3-protobuf diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh index 845d0b4..0d846ae 100755 --- a/tests/run-podman-checkpoint-restore.sh +++ b/tests/run-podman-checkpoint-restore.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -eux +set -ux ls -la @@ -16,6 +16,8 @@ curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088 echo "Checkpoint container" podman --log-level debug container checkpoint -l +cat /var/lib/containers/storage/overlay-containers/*/userdata/dump.log + podman ps -a echo "Restore container" podman --log-level debug container restore -l From 841fd2c85a9af34e6c80b03ae6de322ea6474d62 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 21:35:38 +0100 Subject: [PATCH 50/53] Fix changelog date Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 6e042fb..34e04d6 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 15 2025 Cristian Le - 4.2-7 +* Mon Nov 17 2025 Cristian Le - 4.2-8 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 From 1b9075566654f51a6e920af7a66bee2df519dbdc Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 22:23:34 +0100 Subject: [PATCH 51/53] Increase test duration to 30 minutes From the default 5 minutes Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- tests/main.fmf | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/criu.spec b/criu.spec index 34e04d6..fd4208f 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Cristian Le - 4.2-8 +* Mon Nov 17 2025 Cristian Le - 4.2-9 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/tests/main.fmf b/tests/main.fmf index 221ef70..a743210 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -1,6 +1,7 @@ /zdtm: summary: Test zdtm test: ./run-zdtm.sh + duration: 30m require: - checkpolicy - policycoreutils From 737146110baffdc47cc4b5202119d078d3e6ec5d Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 22:56:10 +0100 Subject: [PATCH 52/53] Drop "Disable installing everything from srpm" This should fix that the newly build criu RPM is not installed in the test environment. Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- plans.fmf | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/criu.spec b/criu.spec index fd4208f..32bf7a8 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Cristian Le - 4.2-9 +* Mon Nov 17 2025 Cristian Le - 4.2-10 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/plans.fmf b/plans.fmf index 52b1751..946731e 100644 --- a/plans.fmf +++ b/plans.fmf @@ -2,9 +2,6 @@ summary: Run all tests discover: how: fmf prepare: - - name: Disable installing everything from srpm - how: install - exclude: ".*" - name: Install the main package how: install package: From a0a8f6a514976e539722aeb20d6c263686bebfed Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Mon, 17 Nov 2025 23:41:29 +0100 Subject: [PATCH 53/53] Hopefully finally changes to make the tests work Signed-off-by: Adrian Reber --- criu.spec | 4 ++-- tests/run-podman-checkpoint-restore.sh | 7 ++++--- tests/run-zdtm.sh | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/criu.spec b/criu.spec index 32bf7a8..ec8bb31 100644 --- a/criu.spec +++ b/criu.spec @@ -12,7 +12,7 @@ Name: criu Version: 4.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Tool for Checkpoint/Restore in User-space License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ @@ -185,7 +185,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %tmpfiles_create %{name}.conf %changelog -* Mon Nov 17 2025 Cristian Le - 4.2-10 +* Mon Nov 17 2025 Cristian Le - 4.2-11 - Convert STI tests to TMT (rhbz#2382879) * Mon Nov 17 2025 Adrian Reber - 4.2-5 diff --git a/tests/run-podman-checkpoint-restore.sh b/tests/run-podman-checkpoint-restore.sh index 0d846ae..6ed7ad6 100755 --- a/tests/run-podman-checkpoint-restore.sh +++ b/tests/run-podman-checkpoint-restore.sh @@ -1,8 +1,11 @@ #!/bin/bash -set -ux +set -eux ls -la +uname -a +rpm -qi criu || true +criu --version echo "Start container" podman --log-level debug run -d quay.io/adrianreber/counter @@ -16,8 +19,6 @@ curl `podman inspect -l | jq -r '.[0].NetworkSettings.IPAddress'`:8088 echo "Checkpoint container" podman --log-level debug container checkpoint -l -cat /var/lib/containers/storage/overlay-containers/*/userdata/dump.log - podman ps -a echo "Restore container" podman --log-level debug container restore -l diff --git a/tests/run-zdtm.sh b/tests/run-zdtm.sh index f825928..ab046e1 100755 --- a/tests/run-zdtm.sh +++ b/tests/run-zdtm.sh @@ -3,6 +3,8 @@ set -xe uname -a +rpm -qi criu || true +criu --version # These zdtm tests are skipped because they fail only in CI system EXCLUDES=" \ @@ -13,6 +15,19 @@ EXCLUDES=" \ -x zdtm/static/socket-tcp4v6-closed \ -x zdtm/static/maps01 \ -x zdtm/static/maps04 \ + -x zdtm/static/del_standalone_un \ + -x zdtm/static/del_standalone_un_seqpacket \ + -x zdtm/static/deleted_unix_sock \ + -x zdtm/static/fifo_upon_unix_socket00 \ + -x zdtm/static/sk-unix-dgram-ghost \ + -x zdtm/static/sk-unix01 \ + -x zdtm/static/sk-unix01-seqpacket \ + -x zdtm/static/socket-tcpbuf \ + -x zdtm/static/socket-tcpbuf6 \ + -x zdtm/static/sockets00 \ + -x zdtm/static/sockets00-seqpacket \ + -x zdtm/static/sockets03 \ + -x zdtm/static/sockets03-seqpacket \ -x zdtm/static/cgroup04 \ -x zdtm/static/cgroup_ifpriomap \ -x zdtm/static/netns_sub \ @@ -33,7 +48,7 @@ run_test() { RESULT=42 -# this socket brakes CRIU's test cases +# this socket breaks CRIU's test cases rm -f /var/lib/sss/pipes/nss cd ../criu-$(crit --version)