2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00
Commit Graph

3256 Commits

Author SHA1 Message Date
Pavel Emelyanov
821621cdb7 files: Don't restore pos when file doesn't support one
It's not quite clean, but on dump non-seekable files dump 0xff...ff into
64-bit pos field of the image. Thus on restore we'd face an error in the
do_open_reg. In order not to have separate helper for non-seekable files
just skip the position restore for such.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 16:18:18 +04:00
Pavel Emelyanov
4869da1781 net: Read ns' sysfs file helper
Just a small helper, that reads string from ns' sysfs mount.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 16:14:37 +04:00
Pavel Emelyanov
8d2e0d5d14 net: Mount ns' sysfs before dump
Some information about network devices may hide in sysfs, thus
it's required to have one at hands while dumping the netns.

Create the detached mount for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 16:13:31 +04:00
Pavel Emelyanov
c7afbae598 net: Prepare to dump netdev entry with extentions
Some (most) network devices would like to have NetDeviceEntry with
more fields, than currently present (and enough for lo and veth).
Prepare for that by allowing them to define their own callback that
would fill the resor of the pb entry and call write_netdev_img().

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 16:08:46 +04:00
Yicheng Qin
7daefd9751 test/zdtm: add option -r to run test with specified name
The option can run test with specified name directly without check
or match.

It can be used to run experimental test that is not in TEST_LIST.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 17:33:10 +04:00
Pavel Emelyanov
60e6d38868 collect: Shorten common images collecting code
Now we have a set of cinfo-s, it's possible to collect all
this stuff in a plan for-loop.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:52:18 +04:00
Pavel Emelyanov
64e7d2435a collect: Reduce amount of args to collect_image call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:27:06 +04:00
Pavel Emelyanov
9917c4fe34 rst: Compact file-descs collects a bit
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 01:06:58 +04:00
Pavel Emelyanov
e03ab6b409 rst: Rework remaps collection on generic collect routine
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 00:55:26 +04:00
Pavel Emelyanov
0543f49c3e pb: Free image object of collection doesn't need it
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 00:55:24 +04:00
Andrey Vagin
ef3ca3a104 restore: do not kill processes if not-all of them have been created
If processes are restored without pidns, criu knows pidtheir -s from images,
but part of those task may have not yet forked, and thus the pids can not
exist or (!) be used by other processes.

To address that we abort stages RESTORE_NS and FORKING without killing tasks,
but with task_entries->start futex by writing STATE_FAIL into it and making
the tasks to check that. Since during RESTORE_NS and FORKING stages tasks can
only block on the mentioned futes, we can safely do it.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 15:17:30 +04:00
Andrey Vagin
0c5b606b48 zdtm: add a new test, where both sides of a tcp connection is dumped
Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:58:14 +04:00
Andrey Vagin
4329287717 zdtm: clean up test_fork
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:57:13 +04:00
Yicheng Qin
156b1b8195 test: create env.sh for environment setting
Currently, env.sh only contains the location of criu executable.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:52:34 +04:00
Yicheng Qin
f1684be8a4 test/tcp/run.sh: fix permission
Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-20 14:51:52 +04:00
Cyrill Gorcunov
71f7f7546c atomic: Use atomic_read instead of atomic_get
To switch to kernel's style.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:06 +04:00
Cyrill Gorcunov
56cb0f8baf arm: atomic -- Add atomic_read/atomic_set helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:05 +04:00
Cyrill Gorcunov
aea8a605f3 atomic -- Switch to linux kernel templates
Use same code as provided in kernel. In first place
we used own prototypes in case of simplicity (they
all were based on "lock xadd" instruction. There is
no more need for that and we can switch to well known
kernel's api.

Because kernel uses plain int type to carry atomic
counters I had to add explicit u32 type for futexes,
as well as a couple of fixes for new api usage.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:03 +04:00
Cyrill Gorcunov
19391c85b3 arm: atomic -- Use signed types for atomic_add_return/atomic_sub_return
Just like kernel does.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:02 +04:00
Cyrill Gorcunov
862e0fb2d3 x86: asm -- Add cmpxchg helpers
Will need it for atomic data conversion.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 19:37:01 +04:00
Cyrill Gorcunov
6d97dba747 sockets: inet -- Fix typo in message
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 18:57:21 +04:00
Andrey Vagin
f824d8c3e9 restore: remove restore_one_fake, which duplicates the code
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 18:55:26 +04:00
Pavel Emelyanov
33c70a244e zdtm: Simplify TEST_LIST formation
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 17:17:13 +04:00
Pavel Emelyanov
a9e10c6056 zdtm: Remove explicit namespaces specification on restore
Yet again -- namespaces are auto-detected now, no need in this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 17:15:59 +04:00
Pavel Emelyanov
aa7e079d8c zdtm: Remove per-namespace list
We have automatic namespaces detection, no need in this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-16 17:14:15 +04:00
Pavel Emelyanov
01f113ecd3 rst: Remove threads restore serialization
This thing was introduced by 01f8f8f4 to help not mixing
per-thread error messages in log files. Now messages are
not mixed by other means, so this thing is useless.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-12 09:17:02 +04:00
Pavel Emelyanov
0a6da43db9 rst: Check core near the place read it from image
Doing it several steps further is less clean.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-12 09:04:56 +04:00
Pavel Emelyanov
e0b8f91493 rst: Make clean error path for root task restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-12 06:33:21 +04:00
Pavel Emelyanov
44a85ee08d rst: Switch-and-wait creds restore stage with existing helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-12 06:23:11 +04:00
Pavel Emelyanov
e5534e8e3a rstore: Invert switch_restore_stage logic
Currentl it waits for previous stage to complete and starts the
next one. Now it starts the next one and waits for it to complete.
The latter way fits better into both -- the code and the head.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-12 06:17:04 +04:00
Pavel Emelyanov
9b45833b81 stats: Account total time to restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 21:25:42 +04:00
Pavel Emelyanov
2df39a4b47 stats: Account for time to fork tasks on restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 21:22:40 +04:00
Pavel Emelyanov
c65f068489 stats: Add timing stats for restore
This will only work if timiings are reported by a single
task. Collecting them from several tasks is to be done.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 21:15:58 +04:00
Pavel Emelyanov
ebd826c97b rst: Reuse vma_list.priv_size for premapped area size calculation
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:46:00 +04:00
Pavel Emelyanov
4c8e1c9927 rst: Close vmas image earlier
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:42:55 +04:00
Pavel Emelyanov
e93566c791 rst: Write comment about why we need two calls to restore_pgid
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:23:18 +04:00
Pavel Emelyanov
4c83c432d6 rst: Minor formatting fix
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:16:24 +04:00
Pavel Emelyanov
ede980c077 restore: Move kids (and session) restore into a helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:15:43 +04:00
Pavel Emelyanov
26aa61a344 rst: Rename read_vmas into prepare_vmas
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:10:44 +04:00
Pavel Emelyanov
8ff15e5c41 util: Make set_proc_mountpoint static
And rename it to better reflect what it does.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:02:33 +04:00
Pavel Emelyanov
e2a0258de3 util: Use open_detahc_mount helper for proc service fd creation
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 20:00:28 +04:00
Pavel Emelyanov
cdce5d216d util: Make set_proc_fd report success/error only
Returning the new proc fd value is useless.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 19:51:02 +04:00
Andrey Vagin
3e6f1ae82d zdtm: exit with the zero code if everything is ok
Cc: Yicheng Qin <yichengq@google.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 14:47:20 +04:00
Yicheng Qin
05745ceed4 test/zdtm: add option -n for batch test
In batch-test mode, the script skips failed individual tests
instead of exiting. This ensures that all zdtm tests can be run
in one pass, which provides better overview of test result.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 13:43:07 +04:00
Yicheng Qin
a7a787a402 test: adjust the output for tests
Adjust the format of information printed.
Print out more necessary debug information.
Display error message in STDERR and make it more readable.

Signed-off-by: Yicheng Qin <yichengq@google.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 13:43:06 +04:00
Andrey Vagin
1f9da83048 mm: do check on shared pages only if a vma is inherited (v2)
v2: restore page contents directly into memory
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-14 11:18:48 +04:00
Pavel Emelyanov
330c137c92 arm: Add atomic_add
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-13 20:05:43 +04:00
Pavel Emelyanov
e99576f655 rst: Collect stats about checked-vs-cowed pages
On restore we compare pages' contents with memcmp to check which
of them can remain shared. Report this info in restore stats.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:36:24 +04:00
Pavel Emelyanov
729ea690ed stats: Introduce protobuf message for restore stats
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:27:58 +04:00
Pavel Emelyanov
9bb545011c stats: Introduce counters for restore
These are atomic_add-s on shmalloc-ed stats.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-11 13:24:13 +04:00