Commit 27db1d9a authored by Michael Holzheu's avatar Michael Holzheu Committed by Pavel Emelyanov

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: 's avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 2ced0450
......@@ -171,6 +171,7 @@ TST_NOFILE := \
macvlan \
cr_veth \
sock_peercred \
s390x_mmap_high \
# jobctl00 \
ifneq ($(SRCARCH),arm)
......
#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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment