[rh8,3/5] ve/time: Fix VE uptime virtualization to use u64 start_time

Submitted by Konstantin Khorenko on Oct. 8, 2020, 3:22 p.m.

Details

Message ID 20201008152203.1173132-4-khorenko@virtuozzo.com
State New
Series "ve/time: first patchset for times virtualization in CT"
Headers show

Commit Message

Konstantin Khorenko Oct. 8, 2020, 3:22 p.m.
From: Cyrill Gorcunov <gorcunov@virtuozzo.com>

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
https://jira.sw.ru/browse/PSBM-41406

Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Reviewed-by: Vladimir Davydov <vdavydov@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@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
 	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",