[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190425161416.26600-7-dima@arista.com>
Date: Thu, 25 Apr 2019 17:13:55 +0100
From: Dmitry Safonov <dima@...sta.com>
To: linux-kernel@...r.kernel.org
Cc: Andrei Vagin <avagin@...il.com>, Dmitry Safonov <dima@...sta.com>,
Adrian Reber <adrian@...as.de>,
Andrei Vagin <avagin@...nvz.org>,
Andy Lutomirski <luto@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Christian Brauner <christian.brauner@...ntu.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Dmitry Safonov <0x7f454c46@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Jeff Dike <jdike@...toit.com>, Oleg Nesterov <oleg@...hat.com>,
Pavel Emelyanov <xemul@...tuozzo.com>,
Shuah Khan <shuah@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Vincenzo Frascino <vincenzo.frascino@....com>,
containers@...ts.linux-foundation.org, criu@...nvz.org,
linux-api@...r.kernel.org, x86@...nel.org
Subject: [PATCHv3 06/27] posix-timers/timens: Take into account clock offsets
From: Andrei Vagin <avagin@...il.com>
Wire timer_settime() syscall into time namespace virtualization.
Signed-off-by: Andrei Vagin <avagin@...nvz.org>
Signed-off-by: Dmitry Safonov <dima@...sta.com>
---
kernel/time/alarmtimer.c | 3 +++
kernel/time/posix-timers.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 31f99361342e..23f5c39c8d23 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -26,6 +26,7 @@
#include <linux/freezer.h>
#include <linux/compat.h>
#include <linux/module.h>
+#include <linux/time_namespace.h>
#include "posix-timers.h"
@@ -621,6 +622,8 @@ static void alarm_timer_arm(struct k_itimer *timr, ktime_t expires,
if (!absolute)
expires = ktime_add_safe(expires, base->gettime());
+ else
+ expires = timens_ktime_to_host(base->base_clockid, expires);
if (sigev_none)
alarm->node.expires = expires;
else
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index a723e63d55fd..7922731f98cd 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -803,6 +803,8 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires,
if (!absolute)
expires = ktime_add_safe(expires, timer->base->get_time());
+ else
+ expires = timens_ktime_to_host(timer->base->clockid, expires);
hrtimer_set_expires(timer, expires);
if (!sigev_none)
--
2.21.0
Powered by blists - more mailing lists