2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

2592 Commits

Author SHA1 Message Date
Cyrill Gorcunov
2e20b48051 page-pipe: Don't forget to free page pipe buffer itself
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-18 22:26:04 +04:00
Cyrill Gorcunov
6f40cfb506 files-reg: Use pr_err instead of pr_perror if fd not found
Otherwise

 | (00.002843)      1: Error (files-reg.c:522): Can't find regfile for 0
 | : Success

which is inappropriate here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-18 22:25:32 +04:00
Andrey Vagin
5f5306eda9 crtools: remove declaration of rt_sigset_t
Actually rt_sigset_t and k_rtsigset_t are the same

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 19:11:25 +04:00
Andrey Vagin
c776580dc0 restore: find VMA for each restored page
Otherwise ppage_bitmap and page_bitmap will be updated for wrong VMA

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 18:24:27 +04:00
Pavel Emelyanov
cc3a3c475b dump: Fix one-page mapping dump
The iov array for 1-page mapping would be zero. Fix this silly mistake.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 18:23:19 +04:00
Pavel Emelyanov
39402af71a page-xfer: Simplify one page-pipe dumping
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 18:23:19 +04:00
Pavel Emelyanov
4074a87637 shmem: Rework dumping code to use page-pipe and -xfer engines
This makes it easier to merge with anon vmas dumping and makes use of
page server for shared memory.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 18:23:19 +04:00
Pavel Emelyanov
6c83c24242 shmem: Simplify error paths
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 18:23:19 +04:00
Pavel Emelyanov
94c6d77340 shmem: Split shmem dumping code into two
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 18:23:19 +04:00
Pavel Emelyanov
9486946b81 zdtm: Return x perms back
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-15 17:31:21 +04:00
Cyrill Gorcunov
f3e5fd7155 ids: Don't forget to setup task state in write_img_inventory
Need to have proper fake-item state to make this code work ok:

get_task_ids
if (item->state != TASK_DEAD) {
	ret = dump_task_kobj_ids(item);
	if (ret)
		goto err_free;

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 21:24:48 +04:00
Cyrill Gorcunov
4159cd5de6 cr-restore: Report the mem size if mmap failed
Without patch

 | Error (cr-restore.c:414): Unable to reserve memory: Invalid argument

with applied

 | Error (cr-restore.c:414): Unable to reserve memory (0 bytes): Invalid argument

more convenient for debugging.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 19:41:31 +04:00
Cyrill Gorcunov
8dd32ad018 image: Fixup error paths in check_img_inventory
- Free unpacked PB data
 - Close file descriptor

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 19:38:57 +04:00
Andrey Vagin
a4f4ca73a1 zdtm: check unshared descriptors for one end of a pipe
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 19:36:17 +04:00
Andrey Vagin
7dc741f4f8 app-emu/lxc: create /var/run/netns/
In Fedora /var/run is on tmpfs, so all directories should be
recreated each times.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 19:35:36 +04:00
Pavel Emelyanov
d36480ed05 mem: Raise the page images IDs base for page server
Currently shmem generates page images in parallel
with page server and IDs may intersect. Fix this by
making page server create larger IDs.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:28:38 +04:00
Pavel Emelyanov
36b96d1e8a zdtm: Test how page server works
When -p is used, launch page server in the same dir as
crtools dump is to get fill dump in it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:16:46 +04:00
Pavel Emelyanov
213faeae6d mem: Introduce page server
The page server is a process, that is about to get pages over
the network and put them into pagemap- + pages- images. Right
now what it does is simply get the data and puts it into the
image files. When we have dirty set tracking in the kernel the
page server will have to collect "page changes" and properly
integrate them into images.

Running crtools with page server is like this:

dst_node# crtools page-server --port <port> -D dump/ ...
src_node# crtools dump -t <pid> --page-server --address <dst_node> --port <port> -D dump/ ...

After this images from dst_node/dump/ and src_node/dump/ should
be put into one place and tasks can be restored out of it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:16:44 +04:00
Pavel Emelyanov
02fc86958e mem: Abstraction layer for putting pages into image
We'll send them over network soon, so prepare abstraction layer for
this. Shmem is not on this scheme yet.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:16:43 +04:00
Pavel Emelyanov
8801f59615 mem: Protobuf format for page dumps
Since now we drain pages out of parasite, we can invent any format for
page dumps. Let is be ... prorobuf one! :)

Another thing to keep in mind, is that we're about to use splices and
implement iterative migration, so it's better to have actual pages be
page-aligned in the image.

And -- backward compatibility. That said the new format is:

1. pagemap-... file which contains a header (currently with a ID of
   the image with pages, see below) and an array of <nr_pages:vaddr>
   pairs. The first value means "how many pages to take from the
   file with pages (see below)" and the second -- where in the task
   address space to put them. Simple.

2. pages-... file which containes only pages one by one (thus aligned
   as we want).

This patch breaks backward compatibility (old images with pages wil
be restored and then crash). Need to do it before v0.5 release.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-14 18:16:41 +04:00
Andrey Vagin
a59fd3533f zdtm: make datagen/datachk faster for big chunks
Generate random data only for buffers with sizes less than FAST_SIZE
If a size of buffer is more that FAST_SIZE, the first FAST_SIZE bytes
are filled by random generator and then this chunk is used as pattern
for all other chunks.

With out this patch:
$ time bash -x test/zdtm.sh static/maps04
real	0m16.777s
user	0m0.054s
sys	0m0.724s

With this patch:
$ time bash -x test/zdtm.sh static/maps04
real	0m1.865s
user	0m0.128s
sys	0m0.745s

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:34:02 +04:00
Cyrill Gorcunov
28f063ab9c zdtm: ipc_namespace: Bound min/max for mqueue/msg_max
Otherwise
 | 11:03:13.524: 19446: ERR: ipc_namespace.c:212: Can't write 0 into /proc/sys/fs/mqueue/msg_max (errno = 22 (Invalid argument))
 | 11:03:13.524: 19446: ERR: ipc_namespace.c:273: Failed to randomize ipc namespace tunables (errno = 22 (Invalid argument))
 | 11:03:13.524: 19446: ERR: ipc_namespace.c:336: Failed to randomize ipc ns before migration (errno = 22 (Invalid argument))
 | 11:03:13.527: 19445: ERR: test.c:298: Test exited with unexpectedly with code 1 (errno = 4 (Interrupted system call))

https://bugzilla.openvz.org/show_bug.cgi?id=2530

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:32:07 +04:00
Andrey Vagin
50a20dfbdc zdtm: fix race in test_waitsig for multithreaded tests
A signal can be handled by non-leader thread and sigsuspend
will not be woken up.

kill can send signals to a specified thread, so a futex is used for
synchronization.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:31:14 +04:00
Cyrill Gorcunov
38c699a754 arch: Add mssing \Newline to get_task_regs message and print pid as well
It's leftover from early times.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:30:25 +04:00
Cyrill Gorcunov
8a8c38b6a3 image: Move magic numbers to magic.h
This allows to reuse magic numbers outside of crtools code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:29:29 +04:00
Cyrill Gorcunov
8cbe560da3 image: Drop leftover macros
Unused

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-06 00:29:01 +04:00
Alexander Kartashov
80c1925dd9 arm: added the description of the syscall vmsplice
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-05 20:09:27 +04:00
Alexander Kartashov
3ad5e0c3fe arm: fixup the parasite arguments automatically
The ARM parasite head uses a pad of 228 bytes
to make the offset of the symbol __export_parasite_stack
representable in the ARM instruction set. This value
needs to be changed every time the value of the macro
PARASITE_STACK_SIZE changes.

This patch makes this manual interference redundant.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-05 20:09:21 +04:00
Pavel Emelyanov
fd0d380112 zdtm: Test HUGE mappings to dump/restore OK
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:13:42 +04:00
Pavel Emelyanov
cf01381cbd mem: Drain memory from parasite before dumping it into file
Currently we dump pages directly from parasite into image files. This
is bad for several reasons:

1. We cannot use any more-or-less custom format for pages easily, since
   parasite code cannot be linked with any libraries;
2. We will not be able to optimize migration with preliminary memory
   migration (a.k.a. iterative migration) with it -- if we send pages
   from parasite over network we are not able to let the task we dump
   continue running.

That said, what is done is -- pages from target task are put into a
page-pipe in one go, then (not in this patch) parasite can be released
and we can do with pages whatever we want. For now pages are just
spliced from pipe into image file.

Some numbers:
In order to drain 1Gb of memory from task we need 1.5M of shared map
in args (for iovecs) and 4 pipes (8 descriptors) each referencing 128Mb
of pages, which int turn requires 4 x 640K chunks of sequential kernel
memory (for pipe_buffer). Not that big I guess.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:13:11 +04:00
Pavel Emelyanov
960694e96f page-pipe: Introduce object to collect pages within
The page-pipe is an object, that can accumulate pages inside it. It
consists of list of page-pipe-bufs, which in turn has a pipa, an
array of iovecs that describe the pages' locations and some stats.

Users of it are supposed to vmsplice pages into pipes to accumulate
then for later use, and vmsplice them from pipes when required.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:12:58 +04:00
Pavel Emelyanov
21449cf73a parasite: Prepare to allocate args for page maps
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:12:46 +04:00
Pavel Emelyanov
4d0b24b52a vma: Keep track of lonest vma in list and sum of its lengths
I will have to push some sort of map of pages to dump into parasite.
For this, I need to have estimation of how much memory I'd need for
than in parasite args. These two values will help with it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:12:33 +04:00
Pavel Emelyanov
8fdc707084 vma: Helper, that checks whether vma is dumped via parasite
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:12:02 +04:00
Pavel Emelyanov
b71f9e80be vma: Introduce list-of-vmas object
Right now when we collect list of vmas we need to know the
number of elements in it. In the future I will need to know
more, so it makes sense to create a vmas-list object for it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:11:51 +04:00
Pavel Emelyanov
7a7506f615 fd: Dynamically allocate args for the array of fds to drain
Just make use of previous patch. The creds dumping args are tuned to
fit one page (minimal static args size).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:11:38 +04:00
Pavel Emelyanov
b8d0d5e779 parasite: Make parasite arguments variable size
Sometimes we don't know the exact amount of data we would want
to send to parasite via args area (e.g. -- while draining fds).

Fix this, by moving the args area behind the parasite blob and
mmap-ing it with the run-time calculated size.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-01 20:11:28 +04:00
Cyrill Gorcunov
8133ab41f3 parasite-syscall: Use pr_perror on prctl call failure
This prints more detailed error report.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-27 15:43:36 +04:00
Cyrill Gorcunov
6f5859ec84 parasite: Print unknown command number
Convenient for debugging

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-27 15:43:35 +04:00
Cyrill Gorcunov
300a200724 pie: Pass CR_NOGLIBC in pie/Makefile
PIE code can't use glibc helpers so instead of passing
CR_NOGLIBC macro in every source file pie code uses just
pass it in pie/Makefile.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-27 15:43:34 +04:00
Cyrill Gorcunov
bdf8c565d9 lock: Include bug.h instead of big util.h
This makes it suitable to use in PIE code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-27 15:43:33 +04:00
Cyrill Gorcunov
19cc8a5eb2 Move BUG_ONs to include/bug.h
We will need futexes to use in PIE code but futex.h
uses BUG_ON helper, so to diet inclusions move BUG_ONs
code to include/bug.h.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-27 15:43:31 +04:00
Cyrill Gorcunov
2badc1d3b0 make: arm -- Use syscalls-asm-y-asmflags instead of CFLAGS
CFLAGS can be overriden, we need own flags here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-23 00:37:06 +04:00
Cyrill Gorcunov
e02bc20b29 make: pie -- Add -fno-stack-protector
PIE code use own handmade stack so we need -fno-stack-protector
option to eliminate compilation warning if -fstack-protector
passed in command line CFLAGS.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-23 00:36:56 +04:00
Cyrill Gorcunov
efe0cbc1c9 make: pie -- Drop -fno-strict-aliasing option
It's already defined in general Makefile

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-23 00:36:45 +04:00
Cyrill Gorcunov
f7066d7dca make: Provide mandatory options in cflags-y variable
In case if CFLAGS is overriden from command line we don't
see our headers anymore. So provide mandatory options in
ccflags-y variable to fix that.

https://bugzilla.openvz.org/show_bug.cgi?id=2521

Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-23 00:36:36 +04:00
Cyrill Gorcunov
b8ebb4d260 check: Check for pipe return value in check_unaligned_vmsplice
| cr-check.c: In function ‘check_unaligned_vmsplice’:
| cr-check.c:372:2: error: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Werror=unused-result]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-22 15:56:50 +04:00
Cyrill Gorcunov
94ef03947a pstree: Add general core_entry_free helper
This facrots out common core members freeing into pstree.c
helper. Per-arch freeing helpers are now symmetrical to the
allocating ones.

This is a merge of two Cyrill's patches.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-22 15:41:27 +04:00
Cyrill Gorcunov
38e75bc883 arch: Sanitize headers inclusion in arch/x86/crtools.c
- For NT_X86_XSTATE we need a system elf.h
 - Drop duplicated parasite-syscall.h
 - Organize headers in the way
    - system headers
    - asm headers
    - regular headers
    - protobuf stuff

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-22 15:35:52 +04:00
Pavel Emelyanov
e3b4fb62cc criu: Version 0.4 release
This is the first release, that actually doesn't require a custom
kernel in order to make all the tool features to work. Just take
the v3.8 (with proper config) and that's it :)

Another coolness about this release is the ARM port. In this case,
however, one does require a custom kernel, since the kcmp system
call is not wired into the ARM table in the upstream kernel :(

What else? Quite a lot, actually:

* C/R ability of a LOT of new stuff
* Remote syscall execution
* Deprecation of --namespace option
* Build system rework
* Ability to collect gcov info

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v0.4
2013-02-20 14:58:57 +04:00