[CRIU] [PATCH 8/9] page-pipe: Print full layout of page-pipe in log (in debug loglevel)

Pavel Emelyanov xemul at parallels.com
Thu Apr 11 09:51:25 EDT 2013


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 include/page-pipe.h |  2 ++
 mem.c               |  2 ++
 page-pipe.c         | 28 ++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/include/page-pipe.h b/include/page-pipe.h
index fbba122..5ebb5be 100644
--- a/include/page-pipe.h
+++ b/include/page-pipe.h
@@ -28,4 +28,6 @@ struct page_pipe *create_page_pipe(unsigned int nr, struct iovec *);
 void destroy_page_pipe(struct page_pipe *p);
 int page_pipe_add_page(struct page_pipe *p, unsigned long addr);
 int page_pipe_add_hole(struct page_pipe *p, unsigned long addr);
+
+void debug_show_page_pipe(struct page_pipe *pp);
 #endif
diff --git a/mem.c b/mem.c
index 7ab0f60..6e7f2f3 100644
--- a/mem.c
+++ b/mem.c
@@ -315,6 +315,8 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
 			goto out_pp;
 	}
 
+	debug_show_page_pipe(pp);
+
 	args->off = 0;
 	list_for_each_entry(ppb, &pp->bufs, l) {
 		ret = parasite_send_fd(ctl, ppb->p[1]);
diff --git a/page-pipe.c b/page-pipe.c
index ab2eae7..7e1dbe8 100644
--- a/page-pipe.c
+++ b/page-pipe.c
@@ -172,3 +172,31 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr)
 out:
 	return 0;
 }
+
+void debug_show_page_pipe(struct page_pipe *pp)
+{
+	struct page_pipe_buf *ppb;
+	int i;
+	struct iovec *iov;
+
+	if (log_get_loglevel() < LOG_DEBUG)
+		return;
+
+	pr_debug("Page pipe:\n");
+	pr_debug("* %u pipes %u/%u iovs:\n",
+			pp->nr_pipes, pp->free_iov, pp->nr_iovs);
+	list_for_each_entry(ppb, &pp->bufs, l) {
+		pr_debug("\tbuf %u pages, %u iovs:\n",
+				ppb->pages_in, ppb->nr_segs);
+		for (i = 0; i < ppb->nr_segs; i++) {
+			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++) {
+		iov = &pp->holes[i];
+		pr_debug("\t%p %lu\n", iov->iov_base, iov->iov_len / PAGE_SIZE);
+	}
+}
-- 
1.7.11.7


More information about the CRIU mailing list