Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The second (final) part of v4.0 #2481

Merged
merged 18 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/actuated-aarch64-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Actuated aarch64 test

on: [push, pull_request]

# Cancel any preceding run on the pull request.
concurrency:
group: actuated-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/criu-dev' }}

jobs:
build:
# Actuated runners are not available in all repositories.
if: ${{ github.repository == 'checkpoint-restore/criu' }}
# The memory size and the number of CPUs can be freely selected.
# 3GB and 4 CPUs seems to be enough according to the result from 'vmmeter'.
runs-on: actuated-arm64-4cpu-3gb
strategy:
matrix:
target: [GCC=1, CLANG=1]

steps:
# https://gist.github.com/alexellis/1f33e581c75e11e161fe613c46180771#file-metering-gha-md
# vmmeter start
- name: Prepare arkade
uses: alexellis/arkade-get@master
with:
crane: latest
print-summary: false

- name: Install vmmeter
run: |
crane export --platform linux/arm64 ghcr.io/openfaasltd/vmmeter:latest | sudo tar -xvf - -C /usr/local/bin

- name: Run vmmeter
uses: self-actuated/vmmeter-action@master
# vmmeter end

- uses: actions/checkout@v4
- name: Run Tests ${{ matrix.target }}
# Following tests are failing on the actuated VMs:
# ./change_mnt_context --pidfile=change_mnt_context.pid --outfile=change_mnt_context.out
# 45: ERR: change_mnt_context.c:23: mount (errno = 22 (Invalid argument))
#
# In combination with '--remote-lazy-pages' following error occurs:
# 138: FAIL: maps05.c:84: Data corrupted at page 1639 (errno = 11 (Resource temporarily unavailable))
run: |
# The 'sched_policy00' needs the following:
sudo sysctl -w kernel.sched_rt_runtime_us=-1
# etc/hosts entry is needed for netns_lock_iptables
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
sudo -E make -C scripts/ci local ${{ matrix.target }} RUN_TESTS=1 \
ZDTM_OPTS="-x zdtm/static/change_mnt_context -x zdtm/static/maps05"
5 changes: 5 additions & 0 deletions coredump/coredump
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
import platform
import argparse
import os
import sys
Expand Down Expand Up @@ -36,6 +37,10 @@ def main():

opts = vars(parser.parse_args())

if platform.machine() != 'x86_64':
print('ERROR: %s only supported on x86_64' % sys.argv[0])
sys.exit(1)

try:
coredump(opts)
except SystemExit as error:
Expand Down
4 changes: 2 additions & 2 deletions crit/crit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ def explore_rss(opts):
pvmi = -1
for pm in pms[1:]:
pstr = '\t%lx / %-8d' % (pm['vaddr'], pm['nr_pages'])
while vmas[vmi]['end'] <= pm['vaddr']:
while vmi < len(vmas) and vmas[vmi]['end'] <= pm['vaddr']:
vmi += 1

pme = pm['vaddr'] + (pm['nr_pages'] << 12)
vstr = ''
while vmas[vmi]['start'] < pme:
while vmi < len(vmas) and vmas[vmi]['start'] < pme:
vma = vmas[vmi]
if vmi == pvmi:
vstr += ' ~'
Expand Down
18 changes: 11 additions & 7 deletions criu/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "images/cgroup.pb-c.h"
#include "kerndat.h"
#include "linux/mount.h"
#include "syscall.h"

/*
* This structure describes set of controller groups
Expand Down Expand Up @@ -581,37 +580,42 @@ static int __new_open_cgroupfs(struct cg_ctl *cc)
int fsfd, fd;
char *name;

fsfd = sys_fsopen(fstype, 0);
fsfd = cr_fsopen(fstype, 0);
if (fsfd < 0) {
pr_perror("Unable to open the cgroup file system");
return -1;
}

if (strstartswith(cc->name, namestr)) {
if (sys_fsconfig(fsfd, FSCONFIG_SET_STRING, "name", cc->name + strlen(namestr), 0)) {
if (cr_fsconfig(fsfd, FSCONFIG_SET_STRING, "name", cc->name + strlen(namestr), 0)) {
fsfd_dump_messages(fsfd);
pr_perror("Unable to configure the cgroup (%s) file system", cc->name);
goto err;
}
} else if (cc->name[0] != 0) { /* cgroup v1 */
char *saveptr = NULL, *buf = strdupa(cc->name);
name = strtok_r(buf, ",", &saveptr);
while (name) {
if (sys_fsconfig(fsfd, FSCONFIG_SET_FLAG, name, NULL, 0)) {
if (cr_fsconfig(fsfd, FSCONFIG_SET_FLAG, name, NULL, 0)) {
fsfd_dump_messages(fsfd);
pr_perror("Unable to configure the cgroup (%s) file system", name);
goto err;
}
name = strtok_r(NULL, ",", &saveptr);
}
}

if (sys_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0)) {
if (cr_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0)) {
fsfd_dump_messages(fsfd);
pr_perror("Unable to create the cgroup (%s) file system", cc->name);
goto err;
}

fd = sys_fsmount(fsfd, 0, 0);
if (fd < 0)
fd = cr_fsmount(fsfd, 0, 0);
if (fd < 0) {
fsfd_dump_messages(fsfd);
pr_perror("Unable to mount the cgroup (%s) file system", cc->name);
}
close(fsfd);

return fd;
Expand Down
21 changes: 10 additions & 11 deletions criu/cr-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include "restorer.h"
#include "uffd.h"
#include "linux/aio_abi.h"
#include "syscall.h"
#include "mount-v2.h"

#include "images/inventory.pb-c.h"
Expand Down Expand Up @@ -1437,18 +1436,18 @@ static int ovl_mount(void)
{
int tmpfs, fsfd, ovl;

fsfd = sys_fsopen("tmpfs", 0);
fsfd = cr_fsopen("tmpfs", 0);
if (fsfd == -1) {
pr_perror("Unable to fsopen tmpfs");
return -1;
}

if (sys_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0) == -1) {
if (cr_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0) == -1) {
pr_perror("Unable to create tmpfs mount");
return -1;
}

tmpfs = sys_fsmount(fsfd, 0, 0);
tmpfs = cr_fsmount(fsfd, 0, 0);
if (tmpfs == -1) {
pr_perror("Unable to mount tmpfs");
return -1;
Expand All @@ -1475,23 +1474,23 @@ static int ovl_mount(void)
return -1;
}

fsfd = sys_fsopen("overlay", 0);
fsfd = cr_fsopen("overlay", 0);
if (fsfd == -1) {
pr_perror("Unable to fsopen overlayfs");
return -1;
}
if (sys_fsconfig(fsfd, FSCONFIG_SET_STRING, "source", "test", 0) == -1 ||
sys_fsconfig(fsfd, FSCONFIG_SET_STRING, "lowerdir", "/tmp/l", 0) == -1 ||
sys_fsconfig(fsfd, FSCONFIG_SET_STRING, "upperdir", "/tmp/u", 0) == -1 ||
sys_fsconfig(fsfd, FSCONFIG_SET_STRING, "workdir", "/tmp/w", 0) == -1) {
if (cr_fsconfig(fsfd, FSCONFIG_SET_STRING, "source", "test", 0) == -1 ||
cr_fsconfig(fsfd, FSCONFIG_SET_STRING, "lowerdir", "/tmp/l", 0) == -1 ||
cr_fsconfig(fsfd, FSCONFIG_SET_STRING, "upperdir", "/tmp/u", 0) == -1 ||
cr_fsconfig(fsfd, FSCONFIG_SET_STRING, "workdir", "/tmp/w", 0) == -1) {
pr_perror("Unable to configure overlayfs");
return -1;
}
if (sys_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0) == -1) {
if (cr_fsconfig(fsfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0) == -1) {
pr_perror("Unable to create overlayfs");
return -1;
}
ovl = sys_fsmount(fsfd, 0, 0);
ovl = cr_fsmount(fsfd, 0, 0);
if (ovl == -1) {
pr_perror("Unable to mount overlayfs");
return -1;
Expand Down
9 changes: 9 additions & 0 deletions criu/fault-injection.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include "criu-log.h"
#include "fault-injection.h"
#include "seize.h"

enum faults fi_strategy;

Expand All @@ -21,5 +22,13 @@ int fault_injection_init(void)
}

fi_strategy = start;

switch (fi_strategy) {
case FI_DISABLE_FREEZE_CGROUP:
dont_use_freeze_cgroup();
break;
default:
break;
};
return 0;
}
2 changes: 2 additions & 0 deletions criu/include/fault-injection.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ enum faults {
FI_CORRUPT_EXTREGS = 134,
FI_DONT_USE_PAGEMAP_SCAN = 135,
FI_DUMP_CRASH = 136,
FI_DISABLE_FREEZE_CGROUP = 137,
FI_PLUGIN_CUDA_FORCE_ENABLE = 138,
FI_MAX,
};

Expand Down
2 changes: 2 additions & 0 deletions criu/include/seize.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
#define __CR_SEIZE_H__

extern int collect_pstree(void);
struct pstree_item;
extern void pstree_switch_state(struct pstree_item *root_item, int st);
extern const char *get_real_freezer_state(void);
extern bool alarm_timeouted(void);

extern char *task_comm_info(pid_t pid, char *comm, size_t size);
extern char *__task_comm_info(pid_t pid);
extern void dont_use_freeze_cgroup(void);

#endif
17 changes: 0 additions & 17 deletions criu/include/syscall.h

This file was deleted.

5 changes: 5 additions & 0 deletions criu/include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ static inline void print_stack_trace(pid_t pid)

extern int mount_detached_fs(const char *fsname);

extern int cr_fsopen(const char *fsname, unsigned int flags);
extern int cr_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux);
extern int cr_fsmount(int fd, unsigned int flags, unsigned int attr_flags);
extern void fsfd_dump_messages(int fd);

extern char *get_legacy_iptables_bin(bool ipv6, bool restore);

extern int set_opts_cap_eff(void);
Expand Down
2 changes: 1 addition & 1 deletion criu/kerndat.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ static int kerndat_detect_stack_guard_gap(void)
* (see kernel commit 1be7107fbe18ee).
*
* Same time there was semi-complete
* patch released which hitted a number
* patch released which hit a number
* of repos (Ubuntu, Fedora) where instead
* of PAGE_SIZE the 1M gap is cut off.
*/
Expand Down
Loading
Loading