[CRIU] [PATCH] [POC] zdtm: check lazy-pages

Andrey Vagin avagin at openvz.org
Wed Jun 15 09:56:09 PDT 2016


On Wed, Jun 15, 2016 at 6:30 AM, Adrian Reber <areber at redhat.com> wrote:
> On Wed, Jun 15, 2016 at 03:47:21AM +0300, Andrey Vagin wrote:
>> From: Andrew Vagin <avagin at virtuozzo.com>
>>
>> [root at fc22-vm criu]# python test/zdtm.py run -t zdtm/static/unlink_fstat04 --lazy-pages
>> === Run 1/1 ================
>>
>> ===================== Run zdtm/static/unlink_fstat04 in h ======================
>> Makefile:299: target 'mnt_enablefs.pid' given more than once in the same rule
>> Start test
>> Test is SUID
>> Makefile:299: target 'mnt_enablefs.pid' given more than once in the same rule
>> ./unlink_fstat04 --pidfile=unlink_fstat04.pid --outfile=unlink_fstat04.out --dirname=unlink_fstat04.test
>> Run criu dump
>> Run criu lazy-pages
>> Run criu restore
>> Wait for zdtm/static/unlink_fstat04 to die for 0.100000
>> Removing dump/zdtm/static/unlink_fstat04/24
>> ===================== Test zdtm/static/unlink_fstat04 PASS =====================
>>
>> ===================== Run zdtm/static/unlink_fstat04 in ns =====================
>> Makefile:299: target 'mnt_enablefs.pid' given more than once in the same rule
>> Start test
>> Test is SUID
>> Makefile:299: target 'mnt_enablefs.pid' given more than once in the same rule
>> ./unlink_fstat04 --pidfile=unlink_fstat04.pid --outfile=unlink_fstat04.out --dirname=unlink_fstat04.test
>> Run criu dump
>> Run criu lazy-pages
>> Run criu restore
>> =[log]=> dump/zdtm/static/unlink_fstat04/54/1/restore.log
>> ------------------------ grep Error ------------------------
>> (00.183478)      1: Error (uffd.c:142): lazy-pages: connect to userfault.socket failed: No such file or directory
>> (00.183623)      4: Error (uffd.c:142): lazy-pages: connect to userfault.socket failed: No such file or directory
>> (00.191785) Error (cr-restore.c:992): 77 killed by signal 9: Killed
>> (00.191807) Error (cr-restore.c:1877): Restoring FAILED.
>> ------------------------ ERROR OVER ------------------------
>
> Thanks, Andrew. Writing tests sounds like a good idea. Looking at the
> output I am not entirely sure what the second message means? That it
> didn't work restoring in a namespace. Before running the tests with
> lazy-pages we would also need to make sure the kernel supports it.

Yes, it didn't work restoring in a mount namespace.

send_uffd() is called in a test mount namespace, where opts.addr isn't
available.

I think you don't need to create this socket for each process. You can
create it once before restoring namespaces.

>
>                 Adrian
>
>> Cc: Adrian Reber <areber at redhat.com>
>> Cc: Mike Rapoport <rppt at linux.vnet.ibm.com>
>> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
>> ---
>>  test/zdtm.py | 19 ++++++++++++++++++-
>>  1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/zdtm.py b/test/zdtm.py
>> index d24429a..98345a4 100755
>> --- a/test/zdtm.py
>> +++ b/test/zdtm.py
>> @@ -645,6 +645,7 @@ class criu_cli:
>>               self.__iter = 0
>>               self.__prev_dump_iter = None
>>               self.__page_server = (opts['page_server'] and True or False)
>> +             self.__lazy_pages = (opts['lazy_pages'] and True or False)
>>               self.__restore_sibling = (opts['sibling'] and True or False)
>>               self.__join_ns = (opts['join_ns'] and True or False)
>>               self.__unshare = (opts['unshare'] and True or False)
>> @@ -687,6 +688,8 @@ class criu_cli:
>>                       print "Forcing %s fault" % fault
>>                       env = dict(os.environ, CRIU_FAULT = fault)
>>               cr = subprocess.Popen(strace + [criu_bin, action] + args, env = env, preexec_fn = preexec)
>> +             if action == "lazy-pages":
>> +                     return cr
>>               return cr.wait()
>>
>>       def set_user_id(self):
>> @@ -721,6 +724,8 @@ class criu_cli:
>>               __ddir = self.__ddir()
>>
>>               ret = self.__criu(action, s_args, self.__fault, strace, preexec)
>> +             if action == "lazy-pages":
>> +                     return ret
>>               grep_errors(os.path.join(__ddir, log))
>>               if ret != 0:
>>                       if self.__fault and int(self.__fault) < 128:
>> @@ -801,8 +806,19 @@ class criu_cli:
>>               if os.getenv("GCOV"):
>>                       r_opts.append("--ext-mount-map")
>>                       r_opts.append("zdtm:%s" % criu_dir)
>> +
>> +             lazy_pages_p = None
>> +             if self.__lazy_pages:
>> +                     addr = "userfault.socket"
>> +                     self.lazy_pages_p = self.__criu_act("lazy-pages", opts = ["--address", addr])
>> +                     r_opts += ["--lazy-pages", "--address", addr]
>> +                     time.sleep(1)  # FIXME wait user fault fd socket
>> +
>>               self.__criu_act("restore", opts = r_opts + ["--restore-detached"])
>>
>> +             if lazy_pages_p and lazy_pages_p.wait():
>> +                     raise test_fail_exc("CRIU lazy-pages")
>> +
>>       @staticmethod
>>       def check(feature):
>>               return criu_cli.__criu("check", ["-v0", "--feature", feature]) == 0
>> @@ -1146,7 +1162,7 @@ class launcher:
>>
>>               nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', 'unshare',
>>                               'fault', 'keep_img', 'report', 'snaps', 'sat', 'script',
>> -                             'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup')
>> +                             'join_ns', 'dedup', 'sbs', 'freezecg', 'user', 'dry_run', 'noauto_dedup', 'lazy_pages')
>>               arg = repr((name, desc, flavor, {d: self.__opts[d] for d in nd}))
>>
>>               if self.__use_log:
>> @@ -1603,6 +1619,7 @@ rp.add_argument("-k", "--keep-img", help = "Whether or not to keep images after
>>               choices = ['always', 'never', 'failed'], default = 'failed')
>>  rp.add_argument("--report", help = "Generate summary report in directory")
>>  rp.add_argument("--keep-going", help = "Keep running tests in spite of failures", action = 'store_true')
>> +rp.add_argument("--lazy-pages", help = "restore pages on demand", action = 'store_true')
>>
>>  lp = sp.add_parser("list", help = "List tests")
>>  lp.set_defaults(action = list_tests)
>> --
>> 2.7.4
>>


More information about the CRIU mailing list