2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

criu/plugin: Add dedicated flag for plugins

Adding a dedicated flag for vma's that are handled by an external plugin
as previously used VMA_UNSUPP flag depends on vma not having
VMA_FILE_SHARED flag.

Signed-off-by: David Yat Sin <david.yatsin@amd.com>
This commit is contained in:
David Yat Sin
2021-09-30 16:46:06 -04:00
committed by Andrei Vagin
parent e04db02411
commit 63e127fc80
3 changed files with 17 additions and 21 deletions

View File

@@ -2334,7 +2334,7 @@ static int open_filemap(int pid, struct vma_area *vma)
flags = vma->e->fdflags;
/* update the new device file page offsets and file paths set during restore */
if (vma->e->status & VMA_UNSUPP) {
if (vma->e->status & VMA_EXT_PLUGIN) {
uint64_t new_pgoff;
int ret;

View File

@@ -85,6 +85,7 @@
#define VMA_AREA_AIORING (1 << 13)
#define VMA_AREA_MEMFD (1 << 14)
#define VMA_EXT_PLUGIN (1 << 27)
#define VMA_CLOSE (1 << 28)
#define VMA_NO_PROT_WRITE (1 << 29)
#define VMA_PREMMAPED (1 << 30)

View File

@@ -203,7 +203,6 @@ struct vma_file_info {
int dev_min;
unsigned long ino;
struct vma_area *vma;
bool has_device_plugin;
};
static inline int vfi_equal(struct vma_file_info *a, struct vma_file_info *b)
@@ -604,7 +603,7 @@ static int handle_vma(pid_t pid, struct vma_area *vma_area, const char *file_pat
pr_debug("Found devzero mapping, OK\n");
} else if (handle_vma_plugin(vm_file_fd, st_buf)) {
pr_info("Found device file mapping, plugin is available\n");
vfi->has_device_plugin = true;
vma_area->e->status |= VMA_EXT_PLUGIN;
} else {
/* non-regular mapping with no supporting plugin */
pr_err("Can't handle non-regular mapping on %d's map %" PRIx64 "\n", pid, vma_area->e->start);
@@ -690,24 +689,20 @@ err_bogus_mapfile:
static int vma_list_add(struct vma_area *vma_area, struct vm_area_list *vma_area_list, unsigned long *prev_end,
struct vma_file_info *vfi, struct vma_file_info *prev_vfi)
{
if (vma_area->e->status & VMA_UNSUPP) {
if (vfi->has_device_plugin) {
/* Unsupported VMAs that provide special plugins for
* backup can be treated as regular VMAs and criu
* should only save their metadata in the dump files.
* There can be several special backup plugins hooks
* that might run at different stages during checkpoint
* and restore.
*/
pr_debug("Device file mapping %016" PRIx64 "-%016" PRIx64 " "
"must be supported via device plugins\n",
vma_area->e->start, vma_area->e->end);
} else {
pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start,
vma_area->e->end);
return -1;
}
if (vma_area->e->status & VMA_EXT_PLUGIN) {
/* Unsupported VMAs that provide special plugins for
* backup can be treated as regular VMAs and criu
* should only save their metadata in the dump files.
* There can be several special backup plugins hooks
* that might run at different stages during checkpoint
* and restore.
*/
pr_debug("Device file mapping %016" PRIx64 "-%016" PRIx64 " supported via device plugins\n",
vma_area->e->start, vma_area->e->end);
} else if (vma_area->e->status & VMA_UNSUPP) {
pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start,
vma_area->e->end);
return -1;
}
/* Add a guard page only if here is enough space for it */