vdso: Use gettimeofday() from vdso for timings

Submitted by Dmitry Safonov on July 25, 2019, 10:01 p.m.


Reviewer None
Submitted July 25, 2019, 10:01 p.m.
Last Updated July 26, 2019, 8:27 a.m.
Revision 1

Cover Letter

Historically, PIE uses syscalls for printing timings.
The idea was written a while ago here:

While at it, I've found that we print timings only in restorer blob, but
not in parasite. It may be intentional or just missed
std_log_set_start() call in parasite_init_daemon().
Anyway, I've decided to keep it as-is for now.

Also, adding support for timings from vdso in ia32 turned to be more
complex (see a comment in the last patch), so I decided to start from
native applications.

I've measured the gain on zdtm tests:
It seems that criu is really voluble on restoring mappings :)

Anyway, the gain is not as huge as I've expected (I thought we print
much more), but still removes 50-100 syscalls per most of zdtm tests.
And it doesn't bring much complexity as we already have all information
about vdso mappings and symbol tables in restorer.
So, remove syscalls for free and keep being the same informative.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>

Dmitry Safonov (8):
  compel/log: Use enum as parameter for std_log_set_loglevel()
  compel/std/uapi: Provide setter for gettimeofday()
  vdso/restorer: Try best to preserve vdso during restore
  vdso/restorer: Always track vdso/vvar positions in vdso_maps_rt
  restorer/parasite-vdso: Don't move vvar if failed to move vdso
  seccomp/restorer: Disable gtod from vdso in strict mode
  vdso: Add compatible property to vdso_maps
  restorer: Use gettimeofday() from rt-vdso for log timings

 compel/plugins/include/uapi/std/log.h |  16 ++-
 compel/plugins/std/log.c              |  18 ++-
 criu/arch/aarch64/include/asm/vdso.h  |   1 +
 criu/arch/arm/include/asm/vdso.h      |   1 +
 criu/arch/ppc64/include/asm/vdso.h    |   1 +
 criu/arch/s390/include/asm/vdso.h     |   3 +-
 criu/arch/x86/include/asm/vdso.h      |   3 +-
 criu/include/parasite-vdso.h          |   4 +-
 criu/include/util-vdso.h              |   1 +
 criu/pie/parasite-vdso.c              | 164 +++++++++++++++-----------
 criu/pie/restorer.c                   | 115 ++++++++++++++----
 criu/vdso.c                           |   6 +-
 12 files changed, 227 insertions(+), 106 deletions(-)