Commit af03e7d5 authored by Pavel Emelyanov's avatar Pavel Emelyanov

page-pipe: Print full layout of page-pipe in log (in debug loglevel)

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3307bfd8
...@@ -28,4 +28,6 @@ struct page_pipe *create_page_pipe(unsigned int nr, struct iovec *); ...@@ -28,4 +28,6 @@ struct page_pipe *create_page_pipe(unsigned int nr, struct iovec *);
void destroy_page_pipe(struct page_pipe *p); void destroy_page_pipe(struct page_pipe *p);
int page_pipe_add_page(struct page_pipe *p, unsigned long addr); int page_pipe_add_page(struct page_pipe *p, unsigned long addr);
int page_pipe_add_hole(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 #endif
...@@ -315,6 +315,8 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl, ...@@ -315,6 +315,8 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
goto out_pp; goto out_pp;
} }
debug_show_page_pipe(pp);
args->off = 0; args->off = 0;
list_for_each_entry(ppb, &pp->bufs, l) { list_for_each_entry(ppb, &pp->bufs, l) {
ret = parasite_send_fd(ctl, ppb->p[1]); ret = parasite_send_fd(ctl, ppb->p[1]);
......
...@@ -172,3 +172,31 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr) ...@@ -172,3 +172,31 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr)
out: out:
return 0; 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);
}
}
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