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

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 14 15:49:51 MSK 2020


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 at 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 at 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
    https://jira.sw.ru/browse/PSBM-41406
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
    Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>
    
    vdavydov@:
    This hunk was a part of
      diff-cpt-record-ct-boot-based-start-time-to-show-correct-uptime
    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 at virtuozzo.com>
---
 fs/proc/uptime.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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
 	get_monotonic_boottime(&uptime);
 #ifdef CONFIG_VE
 	if (!ve_is_super(get_exec_env())) {
+		offset = ns_to_timespec(get_exec_env()->real_start_time);
 		set_normalized_timespec(&uptime,
-			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);
 	}
 #endif
 	seq_printf(m, "%lu.%02lu %lu.%02lu\n",


More information about the Devel mailing list