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

17 Commits

Author SHA1 Message Date
Cyrill Gorcunov
89c9ec7f2f arch, ppc64: Add missing atomic_dec_and_test helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-16 21:53:34 +03:00
Dmitry Safonov
c37583942c ppc64/aarch64: Dynamically define PAGE_SIZE
On ppc64/aarch64 Linux can be set to use Large pages, so the PAGE_SIZE
isn't build-time constant anymore. Define it through _SC_PAGESIZE.

There are different sizes for a page on ppc64:
: #if defined(CONFIG_PPC_256K_PAGES)
: #define PAGE_SHIFT              18
: #elif defined(CONFIG_PPC_64K_PAGES)
: #define PAGE_SHIFT              16
: #elif defined(CONFIG_PPC_16K_PAGES)
: #define PAGE_SHIFT              14
: #else
: #define PAGE_SHIFT              12
: #endif

And on aarch64 there are default sizes and possibly someone can set his
own PAGE_SHIFT:
: config ARM64_PAGE_SHIFT
:         int
:         default 16 if ARM64_64K_PAGES
:         default 14 if ARM64_16K_PAGES
:         default 12

On the downside - each time we need PAGE_SIZE, we're doing libc
function call on aarch64/ppc64.

Fixes: #415

Tested-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-15 03:03:01 +03:00
Dmitry Safonov
0f98ee4641 compel/criu: Add ARCH_HAS_LONG_PAGES to PIE binaries
For architectures like aarch64/ppc64 it's needed to propagate the size
of page inside PIEs. For the parasite page size will be defined during
seizing, and for restorer during early initialization.
Afterward we can use PAGE_SIZE in PIEs like we did before.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-15 03:03:01 +03:00
Michael Holzheu
a04dc883cb s390: Replace flogr instruction with __builtin_clzl()
The flogr instruction not supported by debian jessie (z900).
So replace it by the gcc built-in.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-09 18:51:41 +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
Dmitry Safonov
8c1d8b74d0 x86/asm: move user code selector values to common
I'll need them in parasite head and in exit.

travis-ci: success for Rectify 32-bit compatible C/R on x86
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kirill Tkhai
919df37c25 bits: Add test_and_set_bit()
Borrowed from Linux Kernel

v5: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:13 +03:00
Cyrill Gorcunov
b89ee40bc4 headers: Switch to common linkage.h
travis-ci: success for headers: Switch to common linkage.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-21 23:15:19 +03:00
Kirill Tkhai
97a4d49376 arm, aarm64: Add atomic_dec_return()
travis-ci: success for series starting with [1/2] ppc: Add atomic_dec_return()
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:05:59 +03:00
Kirill Tkhai
994d9d4ea6 ppc: Add atomic_dec_return()
Borrowed from Linux kernel.

travis-ci: success for series starting with [1/2] ppc: Add atomic_dec_return()
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:05:59 +03:00
Kir Kolyshkin
70e3b465e8 arm: rm -Wa from CFLAGS
Somehow clang doesn't always like -Wa flags, for example when making
dependencies (see commit 9303ed3 ("Makefiles: move -Wa,--noexecstack
out of CFLAGS"), which causes build break, scary error messages, and
even hair loss.

There are many ways to solve this. This patch employs the one
that is simple and clean.

The -Wa,-mimplicit-it=always flag was added by commit 79c4b74
("arm: fix compilation on ARMv7"). The reason is, ARM needs an IT
instruction before certain conditionals. Those IT instructions are
almost always automatically generated by assembler itself, but in some
cases a special assembler flag (like the one above) is needed.

As there is only one place in the code that need IT, it's easy to patch
it (add explicit IT) and remove the flag. Note that "IT" generates
no machine code per se, so there should not be any functional change
(although I haven't checked it).

For more info on IT, see http://tinyurl.com/z3ldsdr

Hope for a review from our ARM experts.

travis-ci: success for Fixes to compile on arm with clang
Cc: Christopher Covington <cov@codeaurora.org>
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:04:38 +03:00
Kir Kolyshkin
19f7f130ae ppc asm/bitops.h: fix for clang
clang-3.8 fails to compile inline asm having ldarx with 4 args.

Quoting [1]:
'''
Recent versions of the PowerPC architecture added a hint bit to the larx
instructions to differentiate between an atomic operation and a lock
operation:

> 0 Other programs might attempt to modify the word in storage addressed by EA
> even if the subsequent Store Conditional succeeds.
>
> 1 Other programs will not attempt to modify the word in storage addressed by
> EA until the program that has acquired the lock performs a subsequent
> store releasing the lock.
'''

I also found some more info about this in [2].

Anyway, we could either construct some preprocessor logic to omit this
argument for clang, or just drop it. This patch does the latter.

[1] https://patchwork.ozlabs.org/patch/45008/
[2] https://sourceware.org/ml/libc-alpha/2015-03/msg00085.html

travis-ci: success for PPC+clang compile fixes
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 01:32:55 +03:00
Cyrill Gorcunov
ab4a1bae1f common: Move page.h in
travis-ci: success for Common headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 00:13:04 +03:00
Cyrill Gorcunov
49883d681f common: Move in bit operation helpers
travis-ci: success for Common headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 00:13:04 +03:00
Cyrill Gorcunov
4485723f80 common: Move atomic.h in
Since in criu we can't choose proper
arch inside include statements (well,
it will simply require more ifdefs),
I generate include/common/asm symlink
to point proper architecture.

travis-ci: success for Common headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 00:13:04 +03:00
Cyrill Gorcunov
8fa72cf711 common: Move processor.h in
travis-ci: success for Common headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 00:13:04 +03:00
Cyrill Gorcunov
263061d923 common: Move cmpxchng.h in
travis-ci: success for Common headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 00:13:04 +03:00