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>
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>
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>
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>
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>
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>
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>
| 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This allows building with busybox sed, for example.
Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
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>
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>