2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-27 20:37:57 +00:00

10 Commits

Author SHA1 Message Date
Cyrill Gorcunov
f3f4dda5f3 compel: cpu -- Add ability to clear features
Will need them to mask some of the features from
command line options.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-06-18 21:08:15 +03:00
Dmitry Safonov
70b67e3383 compel: Add ctx flags to get_task_regs()
get_task_regs() needs to know if it needs to use workaround
for a Skylake ptrace() bug. The next patch will introduce a
new flag for that.
I also thought about making 3 versions of get_task_regs() and
adding them to ictx->get_task_regs() depending on the flags..
But get_task_regs() is a private function and infect_ctx is
a uapi.. So, let's just pass context flags to get_task_regs().

Signed-off-by: Dmitry Safonov <dima@arista.com>
2018-02-13 10:14:42 +03:00
Andrei Vagin
c1b0a849e4 syscall: fix arguments for preadv()
It has two arguments "pos_l and "pos_h" instead of one "off". It is used
to handle 64-bit offsets on 32-bit kernels.

SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
                unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

https://github.com/checkpoint-restore/criu/issues/424
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-12-15 21:54:58 +03:00
Pavel Tikhomirov
35f7f5e360 pr_err: add \n where we miss them
Except for several false positives done by:
find -type f -name "*.c" -not -path "./test/*" -exec sed -i
's/\(\<pr_err.*[^\][^n]\)\("[,)]\)/\1\\n\2/g' {} \;

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-12-07 19:52:13 +03:00
Alice Frosi
16474786cb s390: Add runtime-instrumentation support
Dump and restore process with RI control block. Runtime instrumentation
allows to collect information about program execution as CPU data.

The RI control block is dumped and restored for all threads.

Ptrace kernel interface is provided by:
c122bc239b13 ("s390/ptrace: add runtime instrumention register get/set")

Signed-off-by: Alice Frosi <alice@linux.vnet.ibm.com>
Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:44 +03:00
Alice Frosi
a144210451 s390: Add guarded-storage support
Dump and restore tasks with GS control blocks. Guarded-storage is a new
s390 feature to improve garbage collecting languages like Java.

There are two control blocks in the CPU:

 - GS control block
 - GS broadcast control block

Both control blocks have to be dumped and restored for all threads.

Signed-off-by: Alice Frosi <alice@linux.vnet.ibm.com>
Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 08:40:44 +03:00
Alice Frosi
1ea1fdde45 compel: Save thread registers before executing parasite code
For dumping threads we execute parasite code before we collect the
floating point registers with get_task_regs().

The following describes the code path were this is done:

 dump_task_threads()
     for (i = 0; i < item->nr_threads; i++)
         dump_task_thread()
           parasite_dump_thread_seized()
             compel_prepare_thread()
                prepare_thread()

                   ### Get general purpose registers ###
                   ptrace_get_regs(ctx->regs)

             ### parasite code is executed in thread ###
             compel_run_in_thread(tctl, PARASITE_CMD_DUMP_THREAD)

             compel_get_thread_regs()

                 ### Get FP and VX registers ###
                 get_task_regs()

Since on s390 gcc uses floating point registers to cache general
purpose without the -msoft-float option the floating point
registers would have been clobbered after compel_run_in_thread().

With this patch we first save all thread registers with task_get_regs() and
then call the parasite code.

We introduce a new function arch_set_thread_regs() that restores the saved
registers for all threads. This is necessary for criu dump --leave-running,
--check-only, and error handling.

Pre-dump does not require to save the registers for the threads because
because only the main thread (task) is used for parsite code execution.

The above changes allow us to use all register sets in the parasite
code - therefore we can remove -msoft-float on s390.

Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Alice Frosi <alice@linux.vnet.ibm.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-08-15 14:52:15 +03:00
Adrian Reber
f07adae690 compel/s390: glibc renamed ucontext to ucontext_t
The upcoming glibc release renamed 'struct ucontext' to
'struct ucontext_t':

https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=251287734e89a52da3db682a8241eb6bccc050c9;hp=c86ed71d633c22d6f638576f7660c52a5f783d66

Instead of using 'struct ucontext' this patch changes it
to the typedef ucontext_t which already exists in older and
new versions of glibc.

Signed-off-by: Adrian Reber <areber@redhat.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:42 +03:00
Michael Holzheu
a5e2605e7a s390: Fix off-by-one error for task size detection
The entries in /proc/<pid>/maps look like the following:

  3fffffdf000-40000000000 rw-p 00000000 00:00 0

The upper address is the first address that is *not* included in the
address range.

Our function max_mapped_addr() should return the last valid address
for a process, but currently returns the first invalid address.

This can lead to the following error message on kernel that have
kernel commit ee71d16d22bb:

 Error (criu/proc_parse.c:694): Can't dump high memory region
 1ffffffffff000-20000000000000 of task 24 because kernel commit ee71d16d22bb
 is missing

Fix this and make max_mapped_addr() the last valid address (first invalid
address - 1).

Reported-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:42 +03:00
Michael Holzheu
7ce8f56be2 s390:compel/arch/s390: Add architecture support to compel tool and libraries
This patch only adds the support but does not enable it for building.

Reviewed-by: Alice Frosi <alice@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:41 +03:00