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

Mike Rapoport mike.rapoport at gmail.com
Tue Jun 14 22:41:25 PDT 2016


On Wed, Jun 15, 2016 at 3:47 AM, Andrey Vagin <avagin at openvz.org> 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 ================
>
> 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>

Wow! That was fast! :)
I'd wait a bit with lazy-pages tests, though, at least until we have
clearer understanding of the roles of different components.

> ---
>  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
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu



-- 
Sincerely yours,
Mike.


More information about the CRIU mailing list