mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
In AArch64, pages may be 4K or 64K depending on kernel configuration. The GNU C Library documentation suggests [1], "the correct interface to query about the page size is sysconf". Introduce one new architecture-specific function-like macro, page_size(), that on x86 and AArch32 remains a constant so as to minimally affect performance, but on AArch64 is sysconf(_SC_PAGESIZE) for correctness. 1. https://www.gnu.org/software/libc/manual/html_node/Query-Memory-Parameters.html To minimize churn, the PAGE_SIZE macro is left as a build-time estimation of what the run-time page size might be. This fixes the following errors for CRIU on AArch64 kernels with CONFIG_ARM64_64K_PAGES=y, allowing dump of `setsid sleep < /dev/null &> /dev/null` to succeed. Error (kerndat.c:48): Can't stat self map_files: No such file or directory Error (util.c:668): Can't read pme for pid 90: No such file or directory Error (parasite-syscall.c:1135): Can't open 89/map_files/0x3ffb7da0000-0x3ffb7dac000 on procfs: No such file or directory Signed-off-by: Christopher Covington <cov@codeaurora.org> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
31 lines
796 B
C
31 lines
796 B
C
#ifndef __CR_PAGEMAP_H__
|
|
#define __CR_PAGEMAP_H__
|
|
|
|
#include <sys/types.h>
|
|
#include "asm/page.h"
|
|
#include "asm/int.h"
|
|
|
|
#include "list.h"
|
|
|
|
struct vma_area;
|
|
|
|
#define PAGEMAP_PFN_OFF(addr) (PAGE_PFN(addr) * sizeof(u64))
|
|
|
|
typedef struct {
|
|
pid_t pid; /* which process it belongs */
|
|
unsigned long start; /* start of area */
|
|
unsigned long end; /* end of area */
|
|
struct list_head *vma_head; /* list head of VMAs we're serving */
|
|
u64 *map; /* local buffer */
|
|
size_t map_len; /* length of a buffer */
|
|
int fd; /* file to read PMs from */
|
|
} pmc_t;
|
|
|
|
#define PMC_INIT (pmc_t){ }
|
|
|
|
extern int pmc_init(pmc_t *pmc, pid_t pid, struct list_head *vma_head, size_t size);
|
|
extern u64 *pmc_get_map(pmc_t *pmc, struct vma_area *vma);
|
|
extern void pmc_fini(pmc_t *pmc);
|
|
|
|
#endif /* __CR_PAGEMAP_H__ */
|