[CRIU] crtools error: "can't splice to pipe"

Cyrill Gorcunov gorcunov at gmail.com
Wed Apr 30 03:28:55 PDT 2014


On Tue, Apr 29, 2014 at 09:52:41PM +0400, Cyrill Gorcunov wrote:
> On Tue, Apr 29, 2014 at 01:38:57PM -0400, J F wrote:
> >      Btw, what JVM application you're trying to dump? I've openjdk installed
> >      so I could try to reproduce the problem you're facing locally instead
> >      of asking you to test the patches
> > 
> >    Cryrill,
> >    This is for a custom app using JVM and JNI for embedding into a c-code
> >    app.A 
> >    I'll see if I can get a "hello world" application that reproduces the
> >    problem to you.
> >    Is this just an edge case that wasn't accounted for by CRIU or do you
> >    foresee a fundamental problem that would prevent dump/restore from ever
> >    working? Do you anticipate a symmetric change to get "restore" working?A 
> 
> I suppose it's edge case and would like to understand why it's happening.
> Anyway, I'll prepare more debug-verbose patch tonight for you, just gimme
> some time.

Could you please try the patch attached? Need to figure out why access on
some pages are failing. The dump log will be big so don't get surprised.
-------------- next part --------------
diff --git a/pie/parasite.c b/pie/parasite.c
index 152186271361..4bd3f5dd0e5f 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -58,6 +58,23 @@ static int mprotect_vmas(struct parasite_dump_pages_args *args)
 	return ret;
 }
 
+static char ____data[PAGE_SIZE];
+
+static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
+{
+	int d0, d1, d2;
+	asm volatile("rep ; movsl		\n"
+		     "movl %4,%%ecx		\n"
+		     "andl $3,%%ecx		\n"
+		     "jz 1f			\n"
+		     "rep ; movsb		\n"
+		     "1:"
+		     : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+		     : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
+		     : "memory");
+	return to;
+}
+
 static int dump_pages(struct parasite_dump_pages_args *args)
 {
 	int p, ret;
@@ -68,6 +85,19 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 		return -1;
 
 	iovs = pargs_iovs(args);
+
+	{
+		struct iovec *v = &iovs[args->off];
+		size_t i, j;
+
+		for (i = 0, v = &iovs[args->off]; i < args->nr_segs; i++, v++) {
+			for (j = 0; j < v->iov_len; j += PAGE_SIZE) {
+				pr_msg("dump_pages %lx\n", (unsigned long)v->iov_base + j);
+				builtin_memcpy(____data, v->iov_base + j, PAGE_SIZE);
+			}
+		}
+	}
+
 	ret = sys_vmsplice(p, &iovs[args->off], args->nr_segs,
 				SPLICE_F_GIFT | SPLICE_F_NONBLOCK);
 	if (ret != PAGE_SIZE * args->nr_pages) {


More information about the CRIU mailing list