2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00
Commit Graph

3996 Commits

Author SHA1 Message Date
Andrey Vagin
e16f0976fc zdtm/maps007: remove spinlocks from the test
Use futex for synchronization instead of spinning on atomic variables.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:18:44 +04:00
Andrey Vagin
8ce7ef75ec zdtm/lock: add futex_add_and_wake and futex_wait_while_lt
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:18:43 +04:00
Andrey Vagin
1b16fa048c zdtm/maps007: limit delta betwen parent and child from both sides
Currenty a parent can go far away from child and we will need to wait
too long for checking results.

This pach limits delta to [MIN_DELTA, 2 * MIN_DELTA].

Thi patch should fix current errors for the CRIU-iter job in Jenkins.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:09:32 +04:00
Andrey Vagin
1a89dbb5da zdtm/lock: make futex_inc and futex_dec atomical
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:09:19 +04:00
Cyrill Gorcunov
204599aa65 headers: Use fs-magic.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:08:00 +04:00
Cyrill Gorcunov
6e95f544de headers: Add fs-magic.h
Not all distros provide magic numbers we might need
during build procedure, thus provide own definitions
in one known place.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:07:54 +04:00
Pavel Emelyanov
402101c345 criu: Version 1.2 release
This time we've made minimal required support for live-migration,
so that the p.haul project can work. Another big achievement is
better dump and restore performance.

Other than this -- a lot of bugfixes here and there, as usual.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v1.2
2014-02-26 16:50:39 +04:00
Cyrill Gorcunov
e15914fb08 fsnotify: Open handle with O_PATH, v2
Otherwise if the mark is set up on link we end
with -ELOOP error trying to open it. Thus, use
O_PATH pointing the kernel that we're not going
to read/write this descriptor.

Repored-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-25 23:38:35 +04:00
Andrey Vagin
6209ff4567 fsnotify: print correct error if open_by_handle_at failed
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-25 12:01:32 +04:00
Pavel Emelyanov
d98925d512 files-ext: Mark dump callback as static
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-24 17:30:42 +04:00
Cyrill Gorcunov
caa486703f docs: Add -W option description
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-22 13:32:26 +04:00
Cyrill Gorcunov
c86373c98f docs: Add pre-dump description
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-22 13:31:56 +04:00
Cyrill Gorcunov
98179fb5a8 docs: Add dedup command description
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-22 13:31:50 +04:00
Andrey Vagin
bcd36c6e26 mount: Don't use /proc/self to access mount points
If a process is in another pidns than /proc, the link /proc/self doesn't
work.

(00.061569) Error (mount.c:558): Can't bind-mount
46:/zdtm/live/static/tempfs.test to /tmp/cr-tmpfs.gBVwTb: No such file
or directory

But since we've switched to the mount namespace (with setns) we
can just go an open the path by its name.

Reported-by: Urgen Sherpa <urgen.sherpa@nepallink.net>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-22 12:38:44 +04:00
Cyrill Gorcunov
aaef7b7f87 Add ability to compile program with gprof output
To be able to profile CRIU with gprof support we need a special flag
passed to the compiler and linker. But same time we can't build parasite
code with prof support because it'll call for mcount() service routine
for which we don't have any stub yet (and even if we had there are
other tech details involved). Thus PIE code won't be profiled.

To compile with prof support make it as

  make DEBUG=1 GMON=1

The idea to run gprof then over criu sources. Once you've it
compiled with the flags mentioned above -- simply run it (test or whatever,
I've been running sh test/zdtm.st static.maps00).

Then run gprof ./criu gmon.out

Note the gmon.out file lays in directory where criu were running, thus
in case of sh test/zdtm.st static.maps00 the output file will be in test/
directory.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 23:44:37 +04:00
Tikhomirov Pavel
8a3939a277 rpc: Add the auto-dedup option
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 23:41:43 +04:00
Tikhomirov Pavel
acf62d7b95 deduplication: add --auto-dedup option description
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 23:39:31 +04:00
Cyrill Gorcunov
726977f615 page-pipe: Update format for PAGE_SIZE
| page-pipe.c:230:4: error: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘long unsigned int’ [-Werror=format]
 | page-pipe.c:237:3: error: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘long unsigned int’ [-Werror=format]

This is because PAGE_SIZE is defined as unsigned long (same
as kernel does).

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 23:28:35 +04:00
Cyrill Gorcunov
8bea49a74b pagemap-cache: Use page.h helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 16:29:41 +04:00
Cyrill Gorcunov
e252e37201 asm-generic: Introduce page.h
At the moment we are using 4K pages all the time,
so instead of copying code over all archs we're
supporting -- add asm-generic/page.h header.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 16:29:40 +04:00
Cyrill Gorcunov
3ad89009a2 bug: Include <stdbool.h>
We have #define BUG() BUG_ON(true) here, where 'true'
is defined in stdbool header, so to be able to include
bug.h on its own -- include needed header inplace.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 16:27:16 +04:00
Ruslan Kuprieiev
ab6c165b11 service: don't use name "opts" for CriuOpts
As we have global variable opts, it is bad to use
local var with the same name.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 16:24:35 +04:00
Ruslan Kuprieiev
6aaca7968a service: use send_criu_pre_dump_resp() in pre_dump_using_req()
Currently we have a bug, service sends resp of type PRE_DUMP
instead of DUMP. So lets introduce send_criu_pre_dump_resp() and
use it.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-21 16:12:23 +04:00
Tikhomirov Pavel
3fdfbe20dd page-xfer: bug, don't open page-read for shmem
it was error if come to that point from shmem.c
388L: err = open_page_xfer(&xfer, CR_FD_SHMEM_PAGEMAP, si->shmid);

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-19 20:11:15 +04:00
Andrey Vagin
b742c125fb mem: fix calculation of a page offset in generate_iovs
The offset should point on a next entry.

Cc: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-19 20:09:40 +04:00
Cyrill Gorcunov
7d091fe9c7 pagema-cache: Don't exceed task size on hight bound
If area is close to TASK_SIZE limit the high address
may exceed it returning error once we try to read
pagemap file. So limit the high address.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 19:44:49 +04:00
Andrey Vagin
db3371bea1 zdtm: add maps007 in the test list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 19:37:11 +04:00
Andrey Vagin
1934e1a963 posix-timer: take into account that sival_ptr can be NULL (v3)
ID: 0
signal: 26/          (null)
notify: signal/pid.5954
ClockID: 1

fscanf "%p" doesn't handle "(null)".

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

v2: make the original scanf be %d/%s and then additionally
    parse the obtained string
v3: don't use strstr

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 19:35:14 +04:00
Cyrill Gorcunov
ef98f96c06 pagemap-cache: Fix compilation on PI, v2
pagemap-cache.c: In function ‘pmc_init’:
pagemap-cache.c:35:20: error: comparison of distinct pointer types lacks a cast [-Werror]
pagemap-cache.c: In function ‘pmc_fill_cache’:
pagemap-cache.c:72:2: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c:72:2: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c:72:2: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘size_t’ [-Werror=format]
pagemap-cache.c:89:3: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c:89:3: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c💯4: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c💯4: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c: In function ‘pmc_get_map’:
pagemap-cache.c:136:3: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘uint64_t’ [-Werror=format]
pagemap-cache.c:136:3: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘uint64_t’ [-Werror=format]

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 19:34:11 +04:00
Cyrill Gorcunov
9ddcc5d0d1 config-base: Add F_SETPIPE_SZ/F_GETPIPE_SZ
These are needed to compile project on CentOS 6.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:53:09 +04:00
Cyrill Gorcunov
e98eeaa8b9 config-base: Beautify header
- drop empty line
 - end ending endif comment

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:53:07 +04:00
Cyrill Gorcunov
bbdc511741 mem: Use pagemap cache
This improve speed if we're dumping a big set of small vmas.

CentOS-6 container
------------------

Without cache

dump: {
	freezing_time: 1705
	frozen_time: 44885
	memdump_time: 9064
	memwrite_time: 15846
	pages_scanned: 246979
	pages_skipped_parent: 0
	pages_written: 2831
	irmap_resolve: 0
}

With cache

dump: {
	freezing_time: 898
	frozen_time: 40859
	memdump_time: 7254
	memwrite_time: 16375
	pages_scanned: 246979
	pages_skipped_parent: 0
	pages_written: 2831
	irmap_resolve: 0
}

1024 VMA, 40K each
------------------
Without cache

dump: {
	freezing_time: 170
	frozen_time: 30372
	memdump_time: 3895
	memwrite_time: 691
	pages_scanned: 13487
	pages_skipped_parent: 0
	pages_written: 61
	irmap_resolve: 0
}

With cache

dump: {
	freezing_time: 231
	frozen_time: 27646
	memdump_time: 768
	memwrite_time: 798
	pages_scanned: 13487
	pages_skipped_parent: 0
	pages_written: 61
	irmap_resolve: 0
}

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:49:17 +04:00
Cyrill Gorcunov
21e510dd0f pagemap-cache: Introduce engine
Pavel reported that in case if there a big number
of small vmas present in the dumpee we're reading
/proc/pid/pagemap too frequently.

To speedup this procedue we inroduce pagemap cache.

The interface is:
 - pmc_init/pmc_fini for cache initialization and freeing
 - pmc_get_map to retrieve specific PMEs array for VMA area

v2:
 - Move internal constants to pagemap-cache.c
 - Make PAGEMAP_LEN to accept virtual address/size
 - Don't adjust low bound in caching mode to save a couple of code bytes

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:49:08 +04:00
Christopher Covington
5997913d5c Force symlink creation
Otherwise the build can fail with the following message.

ln: .../libcriu.so.1: File exists
make: *** [install] Error 1

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:45:00 +04:00
Christopher Covington
5af7fd3695 Complete the conversion to SRCARCH
Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:44:59 +04:00
Ruslan Kuprieiev
bf288e27a2 install: install criu-service logrotate config
Thank Vladimir Davydov <vdavidov@parallels.com> for help and config.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:39:50 +04:00
Ruslan Kuprieiev
3d940b0f18 systemd: start criu-service with log at /var/log
Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-18 12:39:49 +04:00
Pavel Emelyanov
4b0d41c542 image: Don't unlink image we're dumping into
We want to write into empty image files, so we
unlink them before dumping into. Let's O_TRUNC
it instead.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-02-14 16:47:02 +04:00
Pavel Emelyanov
6efe3f5d10 vdso: Get pagemap entries with pread call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by:Andrew Vagin <avagin@parallels.com>
2014-02-14 16:46:41 +04:00
Pavel Emelyanov
95c2a4d641 proc_parse: Set bigger buffer for smaps FILE
We spend a lot of time reading the /proc/$pid/smaps file. The time
is spent in two places:

1 kernel puts too many info into it
2 fgets pulls info in 1024-bytes chunks, info about one vma is
  typically bigger (up to 3k bytes) thus we call read() ~3 times
  per one vma, which increases the amount of time spent in kernel
  to re-fill this info

Setting the internal buffer to PAGE_SIZE size reduces the amount of
read()-s on ~60% during basic container dump. Setting bigger buffer
doesn't work, as kernel's seq file engine feeds at most one page of
data per read syscall regardless of the buffer size.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-02-14 16:46:15 +04:00
Andrey Vagin
c6a3b1de27 mem: rename fill_pages into dump_pages
This function splices data from a process to criu,
so dump_pages describes the real meaning.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-14 16:44:58 +04:00
Andrey Vagin
bda9bd6cf9 shmem: use chunk mode for dumping shared memory
Before this patch, criu splices all data in pipes and then saves these
data in a image file. Here is a problem, becase creating pipes with big
buffers fails too often, because a kernel tries to allocate a big linear
chunks of memory. Now memory are dumped for a few iterations, where the
size of pipe buffers is restricted.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-14 16:44:28 +04:00
Andrey Vagin
18607116fa page-pipe: move tunable constants into config.h
PIPE_MAX_SIZE is calculated according with the kernel code.
PPB_IOV_BATCH has been taken from my mind.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-14 16:43:21 +04:00
Pavel Emelyanov
3a3f3c79e4 vdso: Don't search for VDSO page in file mappings
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-13 17:20:08 +04:00
Pavel Emelyanov
01e88d1c87 rpc: Add ability to specify veth pairs (--veth-pair option)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-12 00:33:02 +04:00
Pavel Emelyanov
72bf807cfb rpc: Report PID of restore task on setup-namespaces script
This is the first time restorer gets info back from CRIU
service. At that time it makes perfect sense to report
what PID we're working with.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-11 09:53:32 +04:00
Christopher Covington
2c90bb0ce5 Remove \u and \U GNU-isms from sed command
This allows building with busybox sed, for example.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-11 09:18:32 +04:00
Cyrill Gorcunov
ac03ca5599 auxv: Restore backward compatibility
In commit 459828b6 I suddenly broke backward
compatibility of auxv vector on 32bit machines.
Bring it back.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-11 09:18:07 +04:00
Pavel Emelyanov
66ab5e1ad8 util: Add "/bin" to PATH when spawning helpers
We call tar, ip, iptables, etc. when restoring container.
The problem is that these stuff is called from inside new
mount namespace after pivot_root(). But the execvp uses
PATH variable inherited from the host system, which may
not reflect real binaries layout.

Add "/bin" to path as temporary workaround.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-10 15:45:43 +04:00
Pavel Emelyanov
756229bb11 files: Create fake name for remapped file if original name is busy
When live-migrating a container on NFS the link-remap cannot
create original file on target machine, since the file name
is still visible -- source CT is alive. The proper fix would
be to move file aside, then create link, then move original
file back, but since NFS changes file name anyway, we just
do the same -- generate another name for link.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-10 15:45:21 +04:00