diff --git a/criu/include/page-pipe.h b/criu/include/page-pipe.h index 38c38968f..b8fdfdeb7 100644 --- a/criu/include/page-pipe.h +++ b/criu/include/page-pipe.h @@ -116,15 +116,8 @@ struct page_pipe { #define PP_CHUNK_MODE 0x1 /* Restrict the maximum buffer size of pipes and dump memory for a few iterations */ -#define PP_COMPAT 0x2 /* Use compatible iovs (struct compat_iovec) */ #define PP_OWN_IOVS 0x4 /* create_page_pipe allocated IOVs memory */ -/* XXX: move to arch-depended file, when non-x86 add support for compat mode */ -struct iovec_compat { - u32 iov_base; - u32 iov_len; -}; - struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, unsigned flags); extern void destroy_page_pipe(struct page_pipe *p); extern int page_pipe_add_page(struct page_pipe *p, unsigned long addr); diff --git a/criu/mem.c b/criu/mem.c index 26c370ac9..1c993b2fc 100644 --- a/criu/mem.c +++ b/criu/mem.c @@ -305,8 +305,6 @@ static int __parasite_dump_pages_seized(struct pstree_item *item, * use, i.e. on non-lazy non-predump. */ cpp_flags |= PP_CHUNK_MODE; - if (!compel_mode_native(ctl)) - cpp_flags |= PP_COMPAT; pp = create_page_pipe(vma_area_list->priv_size, pargs_iovs(args), cpp_flags); if (!pp) diff --git a/criu/page-pipe.c b/criu/page-pipe.c index bdf72fb24..c80f73236 100644 --- a/criu/page-pipe.c +++ b/criu/page-pipe.c @@ -81,15 +81,10 @@ static int ppb_resize_pipe(struct page_pipe_buf *ppb, unsigned long new_size) return 0; } -static inline void iov_init_compat(struct iovec_compat *iov, unsigned long addr) -{ - iov->iov_base = (u32)addr; - iov->iov_len = PAGE_SIZE; -} - static int page_pipe_grow(struct page_pipe *pp) { struct page_pipe_buf *ppb; + struct iovec *free_iov; pr_debug("Will grow page pipe (iov off is %u)\n", pp->free_iov); @@ -107,7 +102,8 @@ static int page_pipe_grow(struct page_pipe *pp) return -1; out: - ppb_init(ppb, 0, 0, &pp->iovs[pp->free_iov]); + free_iov = &pp->iovs[pp->free_iov]; + ppb_init(ppb, 0, 0, free_iov); return 0; } @@ -214,13 +210,7 @@ static inline int try_add_page_to(struct page_pipe *pp, struct page_pipe_buf *pp pr_debug("Add iov to page pipe (%u iovs, %u/%u total)\n", ppb->nr_segs, pp->free_iov, pp->nr_iovs); - if (pp->flags & PP_COMPAT) { - struct iovec_compat *iovs = (void *)ppb->iov; - - iov_init_compat(&iovs[ppb->nr_segs++], addr); - } else { - iov_init(&ppb->iov[ppb->nr_segs++], addr); - } + iov_init(&ppb->iov[ppb->nr_segs++], addr); pp->free_iov++; BUG_ON(pp->free_iov > pp->nr_iovs); out: @@ -268,13 +258,8 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr) iov_grow_page(&pp->holes[pp->free_hole - 1], addr)) goto out; - if (pp->flags & PP_COMPAT) { - struct iovec_compat *iovs = (void *)pp->holes; + iov_init(&pp->holes[pp->free_hole++], addr); - iov_init_compat(&iovs[pp->free_hole++], addr); - } else { - iov_init(&pp->holes[pp->free_hole++], addr); - } out: return 0; } @@ -284,7 +269,6 @@ void debug_show_page_pipe(struct page_pipe *pp) struct page_pipe_buf *ppb; int i; struct iovec *iov; - struct iovec_compat *iov_c; if (pr_quelled(LOG_DEBUG)) return; @@ -296,28 +280,15 @@ void debug_show_page_pipe(struct page_pipe *pp) pr_debug("\tbuf %u pages, %u iovs:\n", ppb->pages_in, ppb->nr_segs); for (i = 0; i < ppb->nr_segs; i++) { - if (pp->flags & PP_COMPAT) { - iov_c = (void *)ppb->iov; - pr_debug("\t\t%x %lu\n", iov_c[i].iov_base, - (unsigned long) iov_c[i].iov_len / PAGE_SIZE); - } else { - iov = &ppb->iov[i]; - pr_debug("\t\t%p %lu\n", iov->iov_base, - (unsigned long) iov->iov_len / PAGE_SIZE); - } + iov = &ppb->iov[i]; + pr_debug("\t\t%p %lu\n", iov->iov_base, + iov->iov_len / PAGE_SIZE); } } pr_debug("* %u holes:\n", pp->free_hole); for (i = 0; i < pp->free_hole; i++) { - if (pp->flags & PP_COMPAT) { - iov_c = (void *)pp->holes; - pr_debug("\t%x %lu\n", iov_c[i].iov_base, - (unsigned long) iov_c[i].iov_len / PAGE_SIZE); - } else { - iov = &pp->holes[i]; - pr_debug("\t%p %lu\n", iov->iov_base, - (unsigned long) iov->iov_len / PAGE_SIZE); - } + iov = &pp->holes[i]; + pr_debug("\t%p %lu\n", iov->iov_base, iov->iov_len / PAGE_SIZE); } } diff --git a/criu/page-xfer.c b/criu/page-xfer.c index 8ec0998a4..71aee0d6b 100644 --- a/criu/page-xfer.c +++ b/criu/page-xfer.c @@ -341,29 +341,13 @@ static int page_xfer_dump_hole(struct page_xfer *xfer, return 0; } -static struct iovec get_iov(struct iovec *iovs, unsigned int n, bool compat) -{ - if (likely(!compat)) { - return iovs[n]; - } else { - struct iovec ret; - struct iovec_compat *tmp = (struct iovec_compat*)(void *)iovs; - - tmp += n; - ret.iov_base = (void *)(uintptr_t)tmp->iov_base; - ret.iov_len = tmp->iov_len; - return ret; - } -} - static int dump_holes(struct page_xfer *xfer, struct page_pipe *pp, unsigned int *cur_hole, void *limit, unsigned long off) { int ret; for (; *cur_hole < pp->free_hole ; (*cur_hole)++) { - struct iovec hole = get_iov(pp->holes, *cur_hole, - pp->flags & PP_COMPAT); + struct iovec hole = pp->holes[*cur_hole]; if (limit && hole.iov_base >= limit) break; @@ -391,7 +375,7 @@ int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp, pr_debug("\tbuf %d/%d\n", ppb->pages_in, ppb->nr_segs); for (i = 0; i < ppb->nr_segs; i++) { - struct iovec iov = get_iov(ppb->iov, i, pp->flags & PP_COMPAT); + struct iovec iov = ppb->iov[i]; ret = dump_holes(xfer, pp, &cur_hole, iov.iov_base, off); if (ret)