[Devel] [PATCH] ve: add ability to set offset for monotonic time
Cyrill Gorcunov
gorcunov at odin.com
Mon Nov 30 07:34:14 PST 2015
On Mon, Nov 30, 2015 at 07:16:08PM +0400, Andrew Vagin wrote:
> Monotonic time can't be changed by users, can't go back and it starts with
> zero when a kernel starts.
>
> When we migrate a container on another host, we need to save consistancy
> of monotonic time, so we have a per-ve offset.
>
> This patch adds the ability to set this offset. When a container is
> migrated, the value from ve.start_timespec on a source host should be
> written in the same file on a destination host.
>
> https://jira.sw.ru/browse/PSBM-41311?jql=text%20~%20%22of%20persia%22
>
> Cc: Cyrill Gorcunov <gorcunov at openvz.org>
> Signed-off-by: Andrew Vagin <avagin at openvz.org>
> ---
> include/linux/ve.h | 3 +++
> kernel/posix-timers.c | 41 +++++++++++++++++++++++++++++++++++++++++
> kernel/ve/ve.c | 36 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 80 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/ve.h b/include/linux/ve.h
> index 86b95c3..5f972aa 100644
> --- a/include/linux/ve.h
> +++ b/include/linux/ve.h
> @@ -222,6 +222,9 @@ extern struct tty_driver *vtty_console_driver(int *index);
> extern int vtty_open_master(envid_t veid, int idx);
> #endif /* CONFIG_TTY */
>
> +extern int get_ve_monotonic_time(struct ve_struct *ve, struct timespec *tp);
> +extern int set_ve_monotonic_time(struct ve_struct *ve, struct timespec *tp);
> +
> #else /* CONFIG_VE */
> +
> +int set_ve_monotonic_time(struct ve_struct *ve, struct timespec *tp)
> +{
> + struct timespec kernel_tp;
> + struct k_clock *kc = clockid_to_kclock(CLOCK_MONOTONIC);
> + int error;
> +
if (!ve_is_super(get_exec_env()))
return -EPERM;
I've a few questions:
- what about the rest of the clocks? Say CLOCK_BOOTTIME, CLOCK_MONOTONIC_RAW?
- who is responsible to save and restore of the offsets, criu or libvzctl,
or maybe p.haul?
Cyrill
More information about the Devel
mailing list