[RHEL8,COMMIT] ve/time: Fix VE uptime virtualization to use u64 start_time

Submitted by Konstantin Khorenko on Oct. 14, 2020, 12:49 p.m.


Message ID 202010141249.09ECnpsD1528896@finist-co8.sw.ru
State New
Series "ve/time: first patchset for times virtualization in CT"
Headers show

Commit Message

Konstantin Khorenko Oct. 14, 2020, 12:49 p.m.
The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.12
commit 0dc3f0f110adc2356506e976b8d359744b0ba2f9
Author: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Date:   Thu Feb 11 13:02:13 2016 +0400

    ve/time: Fix VE uptime virtualization to use u64 start_time
    Fixes: a3c4d1d8f383 ("ve/time: Customize VE uptime")
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
    ve: Use @real_start_timespec in uptime_proc_show
    uptime_proc_show uses bootbased clocks so we should use
    @real_start_timespec here instead. Seems was a typo while
    converting from pcs6 code.
    In scope of
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>
    This hunk was a part of
    which was skipped during rebase to RH7 because it was considered cpt-related.
    (cherry picked from vz7 commit 55b9202e39282f2a21773fd1fd99317bc6e07ddd)
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
 fs/proc/uptime.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index 9a08b8a92c13..bc07d42ce9f5 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -38,7 +38,7 @@  FIXME:	to be reworked anyway in
 static int uptime_proc_show(struct seq_file *m, void *v)
-	struct timespec uptime;
+	struct timespec uptime, offset;
 	struct timespec64 idle;
 	if (ve_is_super(get_exec_env()))
@@ -58,9 +58,10 @@  FIXME:  to be reworked anyway in
 #ifdef CONFIG_VE
 	if (!ve_is_super(get_exec_env())) {
+		offset = ns_to_timespec(get_exec_env()->real_start_time);
-			uptime.tv_sec - get_exec_env()->start_timespec.tv_sec,
-			uptime.tv_nsec - get_exec_env()->start_timespec.tv_nsec);
+					 uptime.tv_sec - offset.tv_sec,
+					 uptime.tv_nsec - offset.tv_nsec);
 	seq_printf(m, "%lu.%02lu %lu.%02lu\n",