mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 00:58:31 +00:00
s390:zdtm: Add test for tasks > 4TB
If the kernel contains patch ee71d16d22 ("s390/mm: make TASK_SIZE
independent from the number of page table levels") we are able
to checkpoint tasks > 4TB.
Add a testcase to verify this.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
2ced0450b2
commit
27db1d9a04
3 changed files with 66 additions and 0 deletions
|
|
@ -171,6 +171,7 @@ TST_NOFILE := \
|
|||
macvlan \
|
||||
cr_veth \
|
||||
sock_peercred \
|
||||
s390x_mmap_high \
|
||||
# jobctl00 \
|
||||
|
||||
ifneq ($(SRCARCH),arm)
|
||||
|
|
|
|||
64
test/zdtm/static/s390x_mmap_high.c
Normal file
64
test/zdtm/static/s390x_mmap_high.c
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
#define TASK_SIZE_LEVEL_4 0x20000000000000UL /* 8 PB */
|
||||
#define MAP_SIZE 0x1000
|
||||
#define VAL 0x77
|
||||
|
||||
const char *test_doc = "Verify that tasks > 4TB can be checkpointed";
|
||||
const char *test_author = "Michael Holzheu <holzheu@linux.vnet.ibm.com>";
|
||||
|
||||
/*
|
||||
* Map memory at the very end of the 8 PB address space
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *addr = (void *) TASK_SIZE_LEVEL_4 - MAP_SIZE;
|
||||
char *buf;
|
||||
int i;
|
||||
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
/*
|
||||
* Skip test if kernel does not have the following fix:
|
||||
*
|
||||
* ee71d16d22 ("s390/mm: make TASK_SIZE independent from the number
|
||||
* of page table levels")
|
||||
*/
|
||||
if (munmap(addr, MAP_SIZE) == -1) {
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
skip("Detected kernel without 4 level TASK_SIZE fix");
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Map memory at the very end of the 8 PB address space */
|
||||
buf = mmap(addr, MAP_SIZE, PROT_WRITE | PROT_READ,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
|
||||
if (buf == MAP_FAILED) {
|
||||
pr_perror("Could not create mapping");
|
||||
exit(1);
|
||||
}
|
||||
/* Initialize buffer with data */
|
||||
memset(buf, VAL, MAP_SIZE);
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
/* Verify that we restored the data correctly */
|
||||
for (i = 0; i < MAP_SIZE; i++) {
|
||||
if (buf[i] == VAL)
|
||||
continue;
|
||||
fail("%d: %d != %d\n", i, buf[i], VAL);
|
||||
goto out;
|
||||
}
|
||||
pass();
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
1
test/zdtm/static/s390x_mmap_high.desc
Normal file
1
test/zdtm/static/s390x_mmap_high.desc
Normal file
|
|
@ -0,0 +1 @@
|
|||
{'arch': 's390x'}
|
||||
Loading…
Add table
Add a link
Reference in a new issue