All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64
@ 2021-06-01  9:43 Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 1/9] y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall Florian Bezdeka
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

Hi!

This is the next set of changes needed for solving the y2038 problem.
Most patches were provided by Song. I reviewed them and fixed some error
handling problems as well as test failures on some architectures. Some
of the tests were rebased on top of the current next branch.

With this series applied the wip/dovetail and florian/y2038 [1] branches 
are merge-able without conflicts.

Best regards,
Florian

[1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/tree/florian/y2038

Florian Bezdeka (1):
  y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall

chensong (8):
  y2038: cobalt/posix/clock: Adding clock_gettime64
  y2038: cobalt/posix/clock: Adding clock_settime64
  y2038: lib/cobalt/clock: dispatch clock_gettime
  y2038: lib/cobalt/clock: dispatch clock_settime
  y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64
  y2038: cobalt/posix/clock: Adding clock_nanosleep64
  y2038: lib/cobalt/clock: dispatch clock_nanosleep
  y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64

 include/cobalt/kernel/time.h           |  11 ++
 include/cobalt/uapi/syscall.h          |   3 +
 kernel/cobalt/posix/clock.c            |  70 +++++++++++-
 kernel/cobalt/posix/clock.h            |  22 ++++
 kernel/cobalt/posix/syscall32.c        |  23 ++++
 kernel/cobalt/posix/syscall32.h        |  14 +++
 kernel/cobalt/time.c                   |  11 ++
 lib/cobalt/clock.c                     |  22 +++-
 testsuite/smokey/y2038/syscall-tests.c | 151 +++++++++++++++++++++++++
 9 files changed, 324 insertions(+), 3 deletions(-)

-- 
2.31.1



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/9] y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 2/9] y2038: cobalt/posix/clock: Adding clock_gettime64 Florian Bezdeka
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

There were two places invoking the sc_cobalt_clock_gettime syscalls
and both places would be updated while introducing y2038 support. To
keep y2038 compatibility as simple as possible the code has been moved
into a simple helper function.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/clock.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index a0673d1fc..3f87278ce 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -149,6 +149,11 @@ static int __do_clock_host_realtime(struct timespec *ts)
 	return 0;
 }
 
+static int __do_clock_gettime(clockid_t clock_id, struct timespec *tp)
+{
+	return -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+}
+
 static int gettime_via_tsc(clockid_t clock_id, struct timespec *tp)
 {
 	unsigned long rem;
@@ -172,7 +177,7 @@ static int gettime_via_tsc(clockid_t clock_id, struct timespec *tp)
 		tp->tv_nsec = rem;
 		return 0;
 	default:
-		ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+		ret = __do_clock_gettime(clock_id, tp);
 	}
 
 	if (ret) {
@@ -197,7 +202,7 @@ static int gettime_via_vdso(clockid_t clock_id, struct timespec *tp)
 		ret = __cobalt_vdso_gettime(clock_id, tp);
 		break;
 	default:
-		ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+		ret = __do_clock_gettime(clock_id, tp);
 	}
 
 	if (ret) {
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/9] y2038: cobalt/posix/clock: Adding clock_gettime64
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 1/9] y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 3/9] y2038: cobalt/posix/clock: Adding clock_settime64 Florian Bezdeka
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

Add a syscall specific for clock_gettime with 64bit
time_t.

Signed-off-by: chensong <chensong@tj.kylinos.cn>
[Florian: Removed unnecessary include in syscall32.c]
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/cobalt/kernel/time.h    | 11 +++++++++++
 include/cobalt/uapi/syscall.h   |  1 +
 kernel/cobalt/posix/clock.c     | 23 ++++++++++++++++++++++-
 kernel/cobalt/posix/clock.h     |  6 ++++++
 kernel/cobalt/posix/syscall32.c |  7 +++++++
 kernel/cobalt/posix/syscall32.h |  4 ++++
 kernel/cobalt/time.c            | 11 +++++++++++
 7 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/include/cobalt/kernel/time.h b/include/cobalt/kernel/time.h
index 9c6fc3ca2..e48022f87 100644
--- a/include/cobalt/kernel/time.h
+++ b/include/cobalt/kernel/time.h
@@ -17,4 +17,15 @@
 int cobalt_get_timespec64(struct timespec64 *ts,
 			  const struct __kernel_timespec __user *uts);
 
+/**
+ * Covert struct timespec64 to struct __kernel_timespec
+ * and copy to userspace
+ *
+ * @param ts The source, provided by kernel
+ * @param uts The destination, will be filled
+ * @return 0 on success, -EFAULT otherwise
+ */
+int cobalt_put_timespec64(const struct timespec64 *ts,
+			   struct __kernel_timespec __user *uts);
+
 #endif //_COBALT_KERNEL_TIME_H
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 8895d2bff..985996339 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -123,6 +123,7 @@
 #define sc_cobalt_clock_adjtime			100
 #define sc_cobalt_thread_setschedprio		101
 #define sc_cobalt_sem_timedwait64		102
+#define sc_cobalt_clock_gettime64		103
 
 #define __NR_COBALT_SYSCALLS			128 /* Power of 2 */
 
diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 23a45bba9..34faf23bb 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -23,6 +23,7 @@
 #include "thread.h"
 #include "clock.h"
 #include <trace/events/cobalt-posix.h>
+#include <cobalt/kernel/time.h>
 
 static struct xnclock *external_clocks[COBALT_MAX_EXTCLOCKS];
 
@@ -134,11 +135,31 @@ COBALT_SYSCALL(clock_gettime, current,
 	if (cobalt_put_u_timespec(u_ts, &ts))
 		return -EFAULT;
 
-	trace_cobalt_clock_gettime(clock_id, &ts);
+	return 0;
+}
+
+int __cobalt_clock_gettime64(clockid_t clock_id,
+			struct __kernel_timespec __user *u_ts)
+{
+	struct timespec64 ts;
+	int ret;
+
+	ret = __cobalt_clock_gettime(clock_id, &ts);
+	if (ret)
+		return ret;
+
+	if (cobalt_put_timespec64(&ts, u_ts))
+		return -EFAULT;
 
 	return 0;
 }
 
+COBALT_SYSCALL(clock_gettime64, current,
+	       (clockid_t clock_id, struct __kernel_timespec __user *u_ts))
+{
+	return __cobalt_clock_gettime64(clock_id, u_ts);
+}
+
 int __cobalt_clock_settime(clockid_t clock_id, const struct timespec64 *ts)
 {
 	int _ret, ret = 0;
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index e69e76e1b..639f03093 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -100,6 +100,9 @@ int __cobalt_clock_getres(clockid_t clock_id,
 int __cobalt_clock_gettime(clockid_t clock_id,
 			   struct timespec64 *ts);
 
+int __cobalt_clock_gettime64(clockid_t clock_id,
+			struct __kernel_timespec __user *u_ts);
+
 int __cobalt_clock_settime(clockid_t clock_id,
 			   const struct timespec64 *ts);
 
@@ -116,6 +119,9 @@ COBALT_SYSCALL_DECL(clock_getres,
 COBALT_SYSCALL_DECL(clock_gettime,
 		    (clockid_t clock_id, struct __user_old_timespec __user *u_ts));
 
+COBALT_SYSCALL_DECL(clock_gettime64,
+		    (clockid_t clock_id, struct __kernel_timespec __user *u_ts));
+
 COBALT_SYSCALL_DECL(clock_settime,
 		    (clockid_t clock_id, const struct __user_old_timespec __user *u_ts));
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 8bc74e997..138779011 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -170,6 +170,13 @@ COBALT_SYSCALL32emu(clock_gettime, current,
 	return sys32_put_timespec(u_ts, &ts);
 }
 
+COBALT_SYSCALL32emu(clock_gettime64, current,
+		    (clockid_t clock_id,
+		     struct __kernel_timespec __user *u_ts))
+{
+	return __cobalt_clock_gettime64(clock_id, u_ts);
+}
+
 COBALT_SYSCALL32emu(clock_settime, current,
 		    (clockid_t clock_id,
 		     const struct old_timespec32 __user *u_ts))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index d380c2d8e..a6e3aff65 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -59,6 +59,10 @@ COBALT_SYSCALL32emu_DECL(clock_gettime,
 			 (clockid_t clock_id,
 			  struct old_timespec32 __user *u_ts));
 
+COBALT_SYSCALL32emu_DECL(clock_gettime64,
+			 (clockid_t clock_id,
+			  struct __kernel_timespec __user *u_ts));
+
 COBALT_SYSCALL32emu_DECL(clock_settime,
 			 (clockid_t clock_id,
 			  const struct old_timespec32 __user *u_ts));
diff --git a/kernel/cobalt/time.c b/kernel/cobalt/time.c
index c66e07478..cb152fc7a 100644
--- a/kernel/cobalt/time.c
+++ b/kernel/cobalt/time.c
@@ -25,3 +25,14 @@ int cobalt_get_timespec64(struct timespec64 *ts,
 
 	return 0;
 }
+
+int cobalt_put_timespec64(const struct timespec64 *ts,
+		   struct __kernel_timespec __user *uts)
+{
+	struct __kernel_timespec kts = {
+		.tv_sec = ts->tv_sec,
+		.tv_nsec = ts->tv_nsec
+	};
+
+	return cobalt_copy_to_user(uts, &kts, sizeof(kts)) ? -EFAULT : 0;
+}
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/9] y2038: cobalt/posix/clock: Adding clock_settime64
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 1/9] y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 2/9] y2038: cobalt/posix/clock: Adding clock_gettime64 Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 4/9] y2038: lib/cobalt/clock: dispatch clock_gettime Florian Bezdeka
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

Adding a new syscall clock_settime64 which is y2038 safe

Signed-off-by: chensong <chensong@tj.kylinos.cn>
[Florian: Reword commit msg]
Reviewed-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/cobalt/uapi/syscall.h   |  1 +
 kernel/cobalt/posix/clock.c     | 17 +++++++++++++++++
 kernel/cobalt/posix/clock.h     |  7 +++++++
 kernel/cobalt/posix/syscall32.c |  7 +++++++
 kernel/cobalt/posix/syscall32.h |  4 ++++
 5 files changed, 36 insertions(+)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 985996339..438af30ad 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -124,6 +124,7 @@
 #define sc_cobalt_thread_setschedprio		101
 #define sc_cobalt_sem_timedwait64		102
 #define sc_cobalt_clock_gettime64		103
+#define sc_cobalt_clock_settime64		104
 
 #define __NR_COBALT_SYSCALLS			128 /* Power of 2 */
 
diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 34faf23bb..a30ed6c4b 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -219,6 +219,23 @@ COBALT_SYSCALL(clock_settime, current,
 	return __cobalt_clock_settime(clock_id, &ts);
 }
 
+int __cobalt_clock_settime64(clockid_t clock_id,
+			const struct __kernel_timespec __user *u_ts)
+{
+	struct timespec64 ts64;
+
+	if (cobalt_get_timespec64(&ts64, u_ts))
+		return -EFAULT;
+
+	return __cobalt_clock_settime(clock_id, &ts64);
+}
+
+COBALT_SYSCALL(clock_settime64, current,
+	       (clockid_t clock_id, const struct __kernel_timespec __user *u_ts))
+{
+	return __cobalt_clock_settime64(clock_id, u_ts);
+}
+
 COBALT_SYSCALL(clock_adjtime, current,
 	       (clockid_t clock_id, struct __user_old_timex __user *u_tx))
 {
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index 639f03093..74c71c826 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -106,6 +106,9 @@ int __cobalt_clock_gettime64(clockid_t clock_id,
 int __cobalt_clock_settime(clockid_t clock_id,
 			   const struct timespec64 *ts);
 
+int __cobalt_clock_settime64(clockid_t clock_id,
+			const struct __kernel_timespec __user *u_ts);
+
 int __cobalt_clock_adjtime(clockid_t clock_id,
 			   struct __kernel_timex *tx);
 
@@ -125,6 +128,10 @@ COBALT_SYSCALL_DECL(clock_gettime64,
 COBALT_SYSCALL_DECL(clock_settime,
 		    (clockid_t clock_id, const struct __user_old_timespec __user *u_ts));
 
+COBALT_SYSCALL_DECL(clock_settime64,
+		    (clockid_t clock_id,
+			 const struct __kernel_timespec __user *u_ts));
+
 COBALT_SYSCALL_DECL(clock_adjtime,
 		    (clockid_t clock_id, struct __user_old_timex __user *u_tx));
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 138779011..464d7a8dd 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -191,6 +191,13 @@ COBALT_SYSCALL32emu(clock_settime, current,
 	return __cobalt_clock_settime(clock_id, &ts);
 }
 
+COBALT_SYSCALL32emu(clock_settime64, current,
+		    (clockid_t clock_id,
+		     const struct __kernel_timespec __user *u_ts))
+{
+	return __cobalt_clock_settime64(clock_id, u_ts);
+}
+
 COBALT_SYSCALL32emu(clock_adjtime, current,
 		    (clockid_t clock_id, struct old_timex32 __user *u_tx))
 {
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index a6e3aff65..4ec5ee599 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -67,6 +67,10 @@ COBALT_SYSCALL32emu_DECL(clock_settime,
 			 (clockid_t clock_id,
 			  const struct old_timespec32 __user *u_ts));
 
+COBALT_SYSCALL32emu_DECL(clock_settime64,
+			 (clockid_t clock_id,
+			  const struct __kernel_timespec __user *u_ts));
+
 COBALT_SYSCALL32emu_DECL(clock_adjtime,
 			 (clockid_t clock_id,
 			  struct old_timex32 __user *u_tx));
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/9] y2038: lib/cobalt/clock: dispatch clock_gettime
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (2 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 3/9] y2038: cobalt/posix/clock: Adding clock_settime64 Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 5/9] y2038: lib/cobalt/clock: dispatch clock_settime Florian Bezdeka
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

If sizeof time_t bigger than 4, which means glibc supports
64bit timespec, go to clock_gettime64.

otherwise, go to original clock_settime.

Signed-off-by: chensong <chensong@tj.kylinos.cn>
[Florian: Rebased on top of next]
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/clock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index 3f87278ce..21a66ddcf 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -151,7 +151,11 @@ static int __do_clock_host_realtime(struct timespec *ts)
 
 static int __do_clock_gettime(clockid_t clock_id, struct timespec *tp)
 {
+#ifdef __USE_TIME_BITS64
+	return -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime64, clock_id, tp);
+#else
 	return -XENOMAI_SYSCALL2(sc_cobalt_clock_gettime, clock_id, tp);
+#endif
 }
 
 static int gettime_via_tsc(clockid_t clock_id, struct timespec *tp)
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/9] y2038: lib/cobalt/clock: dispatch clock_settime
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (3 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 4/9] y2038: lib/cobalt/clock: dispatch clock_gettime Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 6/9] y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64 Florian Bezdeka
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

If sizeof time_t bigger than 4, which means glibc supports
64bit timespec, go to clock_settime64.

otherwise, go to original clock_settime.

Signed-off-by: chensong <chensong@tj.kylinos.cn>
Reviewed-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/clock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index 21a66ddcf..16081c86e 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -285,7 +285,11 @@ COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec *tp))
 	if (clock_id == CLOCK_REALTIME && !cobalt_use_legacy_tsc())
 		return __STD(clock_settime(CLOCK_REALTIME, tp));
 
+#ifdef __USE_TIME_BITS64
+	ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_settime64, clock_id, tp);
+#else
 	ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_settime, clock_id, tp);
+#endif
 	if (ret) {
 		errno = ret;
 		return -1;
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/9] y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (4 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 5/9] y2038: lib/cobalt/clock: dispatch clock_settime Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 7/9] y2038: cobalt/posix/clock: Adding clock_nanosleep64 Florian Bezdeka
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

Adding new test cases for clock_settime64 and clock_gettime64.

Signed-off-by: chensong <chensong@tj.kylinos.cn>
[Florian: Rebased on top of next, test improvements, reword commit msg]
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 84 ++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index 716be4f2a..840be89a5 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -166,6 +166,82 @@ static int test_sc_cobalt_sem_timedwait64(void)
 	return 0;
 }
 
+static int test_sc_cobalt_clock_gettime64(void)
+{
+	int ret;
+	int sc_nr = sc_cobalt_clock_gettime64;
+	struct xn_timespec64 ts64 = {0};
+
+	/* Make sure we don't crash because of NULL pointers */
+	ret = XENOMAI_SYSCALL2(sc_nr, NULL, NULL);
+	if (ret == -ENOSYS) {
+		smokey_note("clock_gettime64: skipped. (no kernel support)");
+		return 0; // Not implemented, nothing to test, success
+	}
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* Providing an invalid address has to deliver EFAULT */
+	ret = XENOMAI_SYSCALL2(sc_nr, CLOCK_MONOTONIC, (void *)0xdeadbeefUL);
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* Provide a valid 64bit timespec */
+	ret = XENOMAI_SYSCALL2(sc_nr, CLOCK_MONOTONIC, &ts64);
+	if (!smokey_assert(!ret))
+		return ret ? ret : -EINVAL;
+
+	/* Validate seconds only, nanoseconds might still be zero */
+	smokey_assert(ts64.tv_sec != 0);
+
+	return 0;
+}
+
+static int test_sc_cobalt_clock_settime64(void)
+{
+	int ret;
+	int sc_nr = sc_cobalt_clock_settime64;
+	struct xn_timespec64 ts64, now64;
+	struct timespec now;
+
+	/* Make sure we don't crash because of NULL pointers */
+	ret = XENOMAI_SYSCALL2(sc_nr, NULL, NULL);
+	if (ret == -ENOSYS) {
+		smokey_note("clock_settime64: skipped. (no kernel support)");
+		return 0; // Not implemented, nothing to test, success
+	}
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* Providing an invalid address has to deliver EFAULT */
+	ret = XENOMAI_SYSCALL2(sc_nr, CLOCK_MONOTONIC, (void *)0xdeadbeefUL);
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	ret = clock_gettime(CLOCK_REALTIME, &now);
+	if (ret)
+		return -errno;
+
+	/* Provide a valid 64bit timespec */
+	ts64.tv_sec  = now.tv_sec + 1;
+	ts64.tv_nsec = now.tv_nsec;
+	ret = XENOMAI_SYSCALL2(sc_nr, CLOCK_REALTIME, &ts64);
+	if (!smokey_assert(!ret))
+		return ret ? ret : -EINVAL;
+
+	ret = clock_gettime(CLOCK_REALTIME, &now);
+	if (ret)
+		return -errno;
+
+	now64.tv_sec = now.tv_sec;
+	now64.tv_nsec = now.tv_nsec;
+
+	if (ts_less(&now64, &ts64))
+		smokey_warning("clock_settime() reported no error but no new time seen");
+
+	return 0;
+}
+
 static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 {
 	int ret;
@@ -174,5 +250,13 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
+	ret = test_sc_cobalt_clock_gettime64();
+	if (ret)
+		return ret;
+
+	ret = test_sc_cobalt_clock_settime64();
+	if (ret)
+		return ret;
+
 	return 0;
 }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/9] y2038: cobalt/posix/clock: Adding clock_nanosleep64
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (5 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 6/9] y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64 Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 8/9] y2038: lib/cobalt/clock: dispatch clock_nanosleep Florian Bezdeka
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

Add a syscall specific for clock_nanosleep with 64bit
time_t.

Signed-off-by: chensong <chensong@tj.kylinos.cn>
Reviewed-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/cobalt/uapi/syscall.h   |  1 +
 kernel/cobalt/posix/clock.c     | 30 ++++++++++++++++++++++++++++++
 kernel/cobalt/posix/clock.h     |  9 +++++++++
 kernel/cobalt/posix/syscall32.c |  9 +++++++++
 kernel/cobalt/posix/syscall32.h |  6 ++++++
 5 files changed, 55 insertions(+)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 438af30ad..acb8260d0 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -125,6 +125,7 @@
 #define sc_cobalt_sem_timedwait64		102
 #define sc_cobalt_clock_gettime64		103
 #define sc_cobalt_clock_settime64		104
+#define sc_cobalt_clock_nanosleep64		105
 
 #define __NR_COBALT_SYSCALLS			128 /* Power of 2 */
 
diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index a30ed6c4b..eafd580bd 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -355,6 +355,36 @@ COBALT_SYSCALL(clock_nanosleep, primary,
 	return ret;
 }
 
+int __cobalt_clock_nanosleep64(clockid_t clock_id, int flags,
+		const struct __kernel_timespec __user *u_rqt,
+		struct __kernel_timespec __user *u_rmt)
+{
+	struct timespec64 rqt, rmt, *rmtp = NULL;
+	int ret;
+
+	if (u_rmt)
+		rmtp = &rmt;
+
+	if (cobalt_get_timespec64(&rqt, u_rqt))
+		return -EFAULT;
+
+	ret = __cobalt_clock_nanosleep(clock_id, flags, &rqt, rmtp);
+	if (ret == -EINTR && flags == 0 && rmtp) {
+		if (cobalt_put_timespec64(rmtp, u_rmt))
+			return -EFAULT;
+	}
+
+	return ret;
+}
+
+COBALT_SYSCALL(clock_nanosleep64, primary,
+	       (clockid_t clock_id, int flags,
+		const struct __kernel_timespec __user *u_rqt,
+		struct __kernel_timespec __user *u_rmt))
+{
+	return __cobalt_clock_nanosleep64(clock_id, flags, u_rqt, u_rmt);
+}
+
 int cobalt_clock_register(struct xnclock *clock, const cpumask_t *affinity,
 			  clockid_t *clk_id)
 {
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index 74c71c826..ff8653b39 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -116,6 +116,10 @@ int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,
 			     const struct timespec64 *rqt,
 			     struct timespec64 *rmt);
 
+int __cobalt_clock_nanosleep64(clockid_t clock_id, int flags,
+		const struct __kernel_timespec __user *u_rqt,
+		struct __kernel_timespec __user *u_rmt);
+
 COBALT_SYSCALL_DECL(clock_getres,
 		    (clockid_t clock_id, struct __user_old_timespec __user *u_ts));
 
@@ -140,6 +144,11 @@ COBALT_SYSCALL_DECL(clock_nanosleep,
 		     const struct __user_old_timespec __user *u_rqt,
 		     struct __user_old_timespec __user *u_rmt));
 
+COBALT_SYSCALL_DECL(clock_nanosleep64,
+		    (clockid_t clock_id, int flags,
+		     const struct __kernel_timespec __user *u_rqt,
+		     struct __kernel_timespec __user *u_rmt));
+
 int cobalt_clock_register(struct xnclock *clock,
 			  const cpumask_t *affinity,
 			  clockid_t *clk_id);
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 464d7a8dd..d7fc2cd71 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -237,6 +237,15 @@ COBALT_SYSCALL32emu(clock_nanosleep, nonrestartable,
 	return ret;
 }
 
+COBALT_SYSCALL32emu(clock_nanosleep64, nonrestartable,
+		    (clockid_t clock_id, int flags,
+		     const struct __kernel_timespec __user *u_rqt,
+		     struct __kernel_timespec __user *u_rmt))
+{
+	return __cobalt_clock_nanosleep64(clock_id, flags, u_rqt, u_rmt);
+}
+
+
 COBALT_SYSCALL32emu(mutex_timedlock, primary,
 		    (struct cobalt_mutex_shadow __user *u_mx,
 		     const struct old_timespec32 __user *u_ts))
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index 4ec5ee599..7bcde4254 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -80,6 +80,12 @@ COBALT_SYSCALL32emu_DECL(clock_nanosleep,
 			  const struct old_timespec32 __user *u_rqt,
 			  struct old_timespec32 __user *u_rmt));
 
+COBALT_SYSCALL32emu_DECL(clock_nanosleep64,
+			 (clockid_t clock_id, int flags,
+			  const struct __kernel_timespec __user *u_rqt,
+			  struct __kernel_timespec __user *u_rmt));
+
+
 COBALT_SYSCALL32emu_DECL(mutex_timedlock,
 			 (struct cobalt_mutex_shadow __user *u_mx,
 			  const struct old_timespec32 __user *u_ts));
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 8/9] y2038: lib/cobalt/clock: dispatch clock_nanosleep
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (6 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 7/9] y2038: cobalt/posix/clock: Adding clock_nanosleep64 Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-01  9:43 ` [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64 Florian Bezdeka
  2021-06-04 12:07 ` [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Jan Kiszka
  9 siblings, 0 replies; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

If sizeof time_t bigger than 4, which means glibc supports
64bit timespec, go to clock_nanosleep64.

otherwise, go to original clock_nanosleep.

Signed-off-by: chensong <chensong@tj.kylinos.cn>
Reviewed-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/clock.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index 16081c86e..edecb40a0 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -361,8 +361,13 @@ COBALT_IMPL(int, clock_nanosleep, (clockid_t clock_id,
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
+#ifdef __USE_TIME_BITS64
+	ret = -XENOMAI_SYSCALL4(sc_cobalt_clock_nanosleep64,
+				clock_id, flags, rqtp, rmtp);
+#else
 	ret = -XENOMAI_SYSCALL4(sc_cobalt_clock_nanosleep,
 				clock_id, flags, rqtp, rmtp);
+#endif
 
 	pthread_setcanceltype(oldtype, NULL);
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (7 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 8/9] y2038: lib/cobalt/clock: dispatch clock_nanosleep Florian Bezdeka
@ 2021-06-01  9:43 ` Florian Bezdeka
  2021-06-04 11:41   ` Jan Kiszka
  2021-06-04 12:07 ` [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Jan Kiszka
  9 siblings, 1 reply; 16+ messages in thread
From: Florian Bezdeka @ 2021-06-01  9:43 UTC (permalink / raw)
  To: xenomai; +Cc: jan.kiszka, chensong, Florian Bezdeka

From: chensong <chensong@tj.kylinos.cn>

Add test case for clock_nanosleep64 in smokey testsuite

Signed-off-by: chensong <chensong@tj.kylinos.cn>
[Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index 840be89a5..54d529b6b 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)
 	return 0;
 }
 
+static int test_sc_cobalt_clock_nanosleep64(void)
+{
+	int ret;
+	int sc_nr = sc_cobalt_clock_nanosleep64;
+	struct xn_timespec64 next, rmt;
+	struct timespec ts1, ts2, delta;
+	long interval = 1;
+
+	/* Make sure we don't crash because of NULL pointers */
+	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
+	if (ret == -ENOSYS) {
+		smokey_note("clock_nanosleep64: skipped. (no kernel support)");
+		return 0; // Not implemented, nothing to test, success
+	}
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* Providing an invalid address has to deliver EFAULT */
+	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
+			       (void *)0xdeadbeefUL, &rmt);
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* Provide a valid 64bit timespec, round 1 */
+	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
+	if (ret)
+		return -errno;
+
+	next.tv_sec  = ts1.tv_sec + interval;
+	next.tv_nsec = ts1.tv_nsec;
+
+	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
+			       &next, (void *)0xdeadbeefUL);
+	if (!smokey_assert(!ret))
+		return ret ? ret : -EINVAL;
+
+	ret = clock_gettime(CLOCK_MONOTONIC, &ts2);
+	if (ret)
+		return -errno;
+
+	timespec_sub(&delta, &ts2, &ts1);
+	if (delta.tv_sec < interval)
+		smokey_warning("nanosleep didn't sleep long enough.");
+
+	/* Provide a valid 64bit timespec, round 2*/
+	next.tv_sec  = ts2.tv_sec + interval;
+	next.tv_nsec = ts2.tv_nsec;
+
+	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
+	if (!smokey_assert(!ret))
+		return ret ? ret : -EINVAL;
+
+	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
+	if (ret)
+		return -errno;
+
+	timespec_sub(&delta, &ts1, &ts2);
+	if (delta.tv_sec < interval)
+		smokey_warning("nanosleep didn't sleep long enough.");
+
+	return 0;
+}
+
 static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 {
 	int ret;
@@ -258,5 +321,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
+	ret = test_sc_cobalt_clock_nanosleep64();
+	if (ret)
+		return ret;
+
 	return 0;
 }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
  2021-06-01  9:43 ` [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64 Florian Bezdeka
@ 2021-06-04 11:41   ` Jan Kiszka
  2021-06-04 11:43     ` Jan Kiszka
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Kiszka @ 2021-06-04 11:41 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai; +Cc: chensong

On 01.06.21 11:43, Florian Bezdeka wrote:
> From: chensong <chensong@tj.kylinos.cn>
> 
> Add test case for clock_nanosleep64 in smokey testsuite
> 
> Signed-off-by: chensong <chensong@tj.kylinos.cn>
> [Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
>  testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++
>  1 file changed, 67 insertions(+)
> 
> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
> index 840be89a5..54d529b6b 100644
> --- a/testsuite/smokey/y2038/syscall-tests.c
> +++ b/testsuite/smokey/y2038/syscall-tests.c
> @@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)
>  	return 0;
>  }
>  
> +static int test_sc_cobalt_clock_nanosleep64(void)
> +{
> +	int ret;
> +	int sc_nr = sc_cobalt_clock_nanosleep64;
> +	struct xn_timespec64 next, rmt;
> +	struct timespec ts1, ts2, delta;
> +	long interval = 1;
> +
> +	/* Make sure we don't crash because of NULL pointers */
> +	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
> +	if (ret == -ENOSYS) {
> +		smokey_note("clock_nanosleep64: skipped. (no kernel support)");
> +		return 0; // Not implemented, nothing to test, success
> +	}
> +	if (!smokey_assert(ret == -EFAULT))
> +		return ret ? ret : -EINVAL;
> +
> +	/* Providing an invalid address has to deliver EFAULT */
> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
> +			       (void *)0xdeadbeefUL, &rmt);
> +	if (!smokey_assert(ret == -EFAULT))
> +		return ret ? ret : -EINVAL;
> +
> +	/* Provide a valid 64bit timespec, round 1 */
> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
> +	if (ret)
> +		return -errno;
> +
> +	next.tv_sec  = ts1.tv_sec + interval;
> +	next.tv_nsec = ts1.tv_nsec;
> +
> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
> +			       &next, (void *)0xdeadbeefUL);
> +	if (!smokey_assert(!ret))
> +		return ret ? ret : -EINVAL;

Unneeded test here - ret is != 0.

> +
> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts2);
> +	if (ret)
> +		return -errno;
> +
> +	timespec_sub(&delta, &ts2, &ts1);
> +	if (delta.tv_sec < interval)
> +		smokey_warning("nanosleep didn't sleep long enough.");
> +
> +	/* Provide a valid 64bit timespec, round 2*/
> +	next.tv_sec  = ts2.tv_sec + interval;
> +	next.tv_nsec = ts2.tv_nsec;
> +
> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
> +	if (!smokey_assert(!ret))
> +		return ret ? ret : -EINVAL;

Same here.

I can fix those up - once I understood why they trigger here ATM.

Jan

> +
> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
> +	if (ret)
> +		return -errno;
> +
> +	timespec_sub(&delta, &ts1, &ts2);
> +	if (delta.tv_sec < interval)
> +		smokey_warning("nanosleep didn't sleep long enough.");
> +
> +	return 0;
> +}
> +
>  static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
>  {
>  	int ret;
> @@ -258,5 +321,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
>  	if (ret)
>  		return ret;
>  
> +	ret = test_sc_cobalt_clock_nanosleep64();
> +	if (ret)
> +		return ret;
> +
>  	return 0;
>  }
> 


-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
  2021-06-04 11:41   ` Jan Kiszka
@ 2021-06-04 11:43     ` Jan Kiszka
  2021-06-04 12:05       ` Jan Kiszka
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Kiszka @ 2021-06-04 11:43 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai; +Cc: chensong

On 04.06.21 13:41, Jan Kiszka via Xenomai wrote:
> On 01.06.21 11:43, Florian Bezdeka wrote:
>> From: chensong <chensong@tj.kylinos.cn>
>>
>> Add test case for clock_nanosleep64 in smokey testsuite
>>
>> Signed-off-by: chensong <chensong@tj.kylinos.cn>
>> [Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]
>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>> ---
>>  testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++
>>  1 file changed, 67 insertions(+)
>>
>> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
>> index 840be89a5..54d529b6b 100644
>> --- a/testsuite/smokey/y2038/syscall-tests.c
>> +++ b/testsuite/smokey/y2038/syscall-tests.c
>> @@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)
>>  	return 0;
>>  }
>>  
>> +static int test_sc_cobalt_clock_nanosleep64(void)
>> +{
>> +	int ret;
>> +	int sc_nr = sc_cobalt_clock_nanosleep64;
>> +	struct xn_timespec64 next, rmt;
>> +	struct timespec ts1, ts2, delta;
>> +	long interval = 1;
>> +
>> +	/* Make sure we don't crash because of NULL pointers */
>> +	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
>> +	if (ret == -ENOSYS) {
>> +		smokey_note("clock_nanosleep64: skipped. (no kernel support)");
>> +		return 0; // Not implemented, nothing to test, success
>> +	}
>> +	if (!smokey_assert(ret == -EFAULT))
>> +		return ret ? ret : -EINVAL;
>> +
>> +	/* Providing an invalid address has to deliver EFAULT */
>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>> +			       (void *)0xdeadbeefUL, &rmt);
>> +	if (!smokey_assert(ret == -EFAULT))
>> +		return ret ? ret : -EINVAL;
>> +
>> +	/* Provide a valid 64bit timespec, round 1 */
>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
>> +	if (ret)
>> +		return -errno;
>> +
>> +	next.tv_sec  = ts1.tv_sec + interval;
>> +	next.tv_nsec = ts1.tv_nsec;
>> +
>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>> +			       &next, (void *)0xdeadbeefUL);
>> +	if (!smokey_assert(!ret))
>> +		return ret ? ret : -EINVAL;
> 
> Unneeded test here - ret is != 0.
> 
>> +
>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts2);
>> +	if (ret)
>> +		return -errno;
>> +
>> +	timespec_sub(&delta, &ts2, &ts1);
>> +	if (delta.tv_sec < interval)
>> +		smokey_warning("nanosleep didn't sleep long enough.");
>> +
>> +	/* Provide a valid 64bit timespec, round 2*/
>> +	next.tv_sec  = ts2.tv_sec + interval;
>> +	next.tv_nsec = ts2.tv_nsec;
>> +
>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
>> +	if (!smokey_assert(!ret))
>> +		return ret ? ret : -EINVAL;
> 
> Same here.
> 
> I can fix those up - once I understood why they trigger here ATM.
> 

In fact, if we want to return the real error, errno needs to be
consulted. What is the intention then?

Jan

>> +
>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
>> +	if (ret)
>> +		return -errno;
>> +
>> +	timespec_sub(&delta, &ts1, &ts2);
>> +	if (delta.tv_sec < interval)
>> +		smokey_warning("nanosleep didn't sleep long enough.");
>> +
>> +	return 0;
>> +}
>> +
>>  static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
>>  {
>>  	int ret;
>> @@ -258,5 +321,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
>>  	if (ret)
>>  		return ret;
>>  
>> +	ret = test_sc_cobalt_clock_nanosleep64();
>> +	if (ret)
>> +		return ret;
>> +
>>  	return 0;
>>  }
>>
> 
> 


-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
  2021-06-04 11:43     ` Jan Kiszka
@ 2021-06-04 12:05       ` Jan Kiszka
  2021-06-04 12:21         ` Jan Kiszka
  2021-06-04 12:45         ` Philippe Gerum
  0 siblings, 2 replies; 16+ messages in thread
From: Jan Kiszka @ 2021-06-04 12:05 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai, Philippe Gerum; +Cc: chensong

On 04.06.21 13:43, Jan Kiszka via Xenomai wrote:
> On 04.06.21 13:41, Jan Kiszka via Xenomai wrote:
>> On 01.06.21 11:43, Florian Bezdeka wrote:
>>> From: chensong <chensong@tj.kylinos.cn>
>>>
>>> Add test case for clock_nanosleep64 in smokey testsuite
>>>
>>> Signed-off-by: chensong <chensong@tj.kylinos.cn>
>>> [Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]
>>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>>> ---
>>>  testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++
>>>  1 file changed, 67 insertions(+)
>>>
>>> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
>>> index 840be89a5..54d529b6b 100644
>>> --- a/testsuite/smokey/y2038/syscall-tests.c
>>> +++ b/testsuite/smokey/y2038/syscall-tests.c
>>> @@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)
>>>  	return 0;
>>>  }
>>>  
>>> +static int test_sc_cobalt_clock_nanosleep64(void)
>>> +{
>>> +	int ret;
>>> +	int sc_nr = sc_cobalt_clock_nanosleep64;
>>> +	struct xn_timespec64 next, rmt;
>>> +	struct timespec ts1, ts2, delta;
>>> +	long interval = 1;
>>> +
>>> +	/* Make sure we don't crash because of NULL pointers */
>>> +	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
>>> +	if (ret == -ENOSYS) {
>>> +		smokey_note("clock_nanosleep64: skipped. (no kernel support)");
>>> +		return 0; // Not implemented, nothing to test, success
>>> +	}
>>> +	if (!smokey_assert(ret == -EFAULT))
>>> +		return ret ? ret : -EINVAL;
>>> +
>>> +	/* Providing an invalid address has to deliver EFAULT */
>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>>> +			       (void *)0xdeadbeefUL, &rmt);
>>> +	if (!smokey_assert(ret == -EFAULT))
>>> +		return ret ? ret : -EINVAL;
>>> +
>>> +	/* Provide a valid 64bit timespec, round 1 */
>>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
>>> +	if (ret)
>>> +		return -errno;
>>> +
>>> +	next.tv_sec  = ts1.tv_sec + interval;
>>> +	next.tv_nsec = ts1.tv_nsec;
>>> +
>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>>> +			       &next, (void *)0xdeadbeefUL);
>>> +	if (!smokey_assert(!ret))
>>> +		return ret ? ret : -EINVAL;
>>
>> Unneeded test here - ret is != 0.
>>
>>> +
>>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts2);
>>> +	if (ret)
>>> +		return -errno;
>>> +
>>> +	timespec_sub(&delta, &ts2, &ts1);
>>> +	if (delta.tv_sec < interval)
>>> +		smokey_warning("nanosleep didn't sleep long enough.");
>>> +
>>> +	/* Provide a valid 64bit timespec, round 2*/
>>> +	next.tv_sec  = ts2.tv_sec + interval;
>>> +	next.tv_nsec = ts2.tv_nsec;
>>> +
>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
>>> +	if (!smokey_assert(!ret))
>>> +		return ret ? ret : -EINVAL;
>>
>> Same here.
>>
>> I can fix those up - once I understood why they trigger here ATM.
>>
> 
> In fact, if we want to return the real error, errno needs to be
> consulted. What is the intention then?

Err, no, it's direct syscall invocation, no errno at this point yet.

Found the reason for the failing test meanwhile: I was on wip/dovetail
already, and there we have

static inline int pipeline_set_wallclock(xnticks_t epoch_ns)
{
	return -EOPNOTSUPP;
}

Philippe, any particular reason for this?

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64
  2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
                   ` (8 preceding siblings ...)
  2021-06-01  9:43 ` [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64 Florian Bezdeka
@ 2021-06-04 12:07 ` Jan Kiszka
  9 siblings, 0 replies; 16+ messages in thread
From: Jan Kiszka @ 2021-06-04 12:07 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai; +Cc: chensong

On 01.06.21 11:43, Florian Bezdeka wrote:
> Hi!
> 
> This is the next set of changes needed for solving the y2038 problem.
> Most patches were provided by Song. I reviewed them and fixed some error
> handling problems as well as test failures on some architectures. Some
> of the tests were rebased on top of the current next branch.
> 
> With this series applied the wip/dovetail and florian/y2038 [1] branches 
> are merge-able without conflicts.
> 
> Best regards,
> Florian
> 
> [1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/tree/florian/y2038
> 
> Florian Bezdeka (1):
>   y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall
> 
> chensong (8):
>   y2038: cobalt/posix/clock: Adding clock_gettime64
>   y2038: cobalt/posix/clock: Adding clock_settime64
>   y2038: lib/cobalt/clock: dispatch clock_gettime
>   y2038: lib/cobalt/clock: dispatch clock_settime
>   y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64
>   y2038: cobalt/posix/clock: Adding clock_nanosleep64
>   y2038: lib/cobalt/clock: dispatch clock_nanosleep
>   y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
> 
>  include/cobalt/kernel/time.h           |  11 ++
>  include/cobalt/uapi/syscall.h          |   3 +
>  kernel/cobalt/posix/clock.c            |  70 +++++++++++-
>  kernel/cobalt/posix/clock.h            |  22 ++++
>  kernel/cobalt/posix/syscall32.c        |  23 ++++
>  kernel/cobalt/posix/syscall32.h        |  14 +++
>  kernel/cobalt/time.c                   |  11 ++
>  lib/cobalt/clock.c                     |  22 +++-
>  testsuite/smokey/y2038/syscall-tests.c | 151 +++++++++++++++++++++++++
>  9 files changed, 324 insertions(+), 3 deletions(-)
> 

Thanks, applied to next. A tiny cleanup patch for the error test will
follow on top.

As I just found out: clock_settime does not work with dovetail yet. So
the testsuite will fail over wip/dovetail for the time being.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
  2021-06-04 12:05       ` Jan Kiszka
@ 2021-06-04 12:21         ` Jan Kiszka
  2021-06-04 12:45         ` Philippe Gerum
  1 sibling, 0 replies; 16+ messages in thread
From: Jan Kiszka @ 2021-06-04 12:21 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai, Philippe Gerum; +Cc: chensong

On 04.06.21 14:05, Jan Kiszka wrote:
> On 04.06.21 13:43, Jan Kiszka via Xenomai wrote:
>> On 04.06.21 13:41, Jan Kiszka via Xenomai wrote:
>>> On 01.06.21 11:43, Florian Bezdeka wrote:
>>>> From: chensong <chensong@tj.kylinos.cn>
>>>>
>>>> Add test case for clock_nanosleep64 in smokey testsuite
>>>>
>>>> Signed-off-by: chensong <chensong@tj.kylinos.cn>
>>>> [Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]
>>>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>>>> ---
>>>>  testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++
>>>>  1 file changed, 67 insertions(+)
>>>>
>>>> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
>>>> index 840be89a5..54d529b6b 100644
>>>> --- a/testsuite/smokey/y2038/syscall-tests.c
>>>> +++ b/testsuite/smokey/y2038/syscall-tests.c
>>>> @@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)
>>>>  	return 0;
>>>>  }
>>>>  
>>>> +static int test_sc_cobalt_clock_nanosleep64(void)
>>>> +{
>>>> +	int ret;
>>>> +	int sc_nr = sc_cobalt_clock_nanosleep64;
>>>> +	struct xn_timespec64 next, rmt;
>>>> +	struct timespec ts1, ts2, delta;
>>>> +	long interval = 1;
>>>> +
>>>> +	/* Make sure we don't crash because of NULL pointers */
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
>>>> +	if (ret == -ENOSYS) {
>>>> +		smokey_note("clock_nanosleep64: skipped. (no kernel support)");
>>>> +		return 0; // Not implemented, nothing to test, success
>>>> +	}
>>>> +	if (!smokey_assert(ret == -EFAULT))
>>>> +		return ret ? ret : -EINVAL;
>>>> +
>>>> +	/* Providing an invalid address has to deliver EFAULT */
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>>>> +			       (void *)0xdeadbeefUL, &rmt);
>>>> +	if (!smokey_assert(ret == -EFAULT))
>>>> +		return ret ? ret : -EINVAL;
>>>> +
>>>> +	/* Provide a valid 64bit timespec, round 1 */
>>>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
>>>> +	if (ret)
>>>> +		return -errno;
>>>> +
>>>> +	next.tv_sec  = ts1.tv_sec + interval;
>>>> +	next.tv_nsec = ts1.tv_nsec;
>>>> +
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>>>> +			       &next, (void *)0xdeadbeefUL);
>>>> +	if (!smokey_assert(!ret))
>>>> +		return ret ? ret : -EINVAL;
>>>
>>> Unneeded test here - ret is != 0.
>>>
>>>> +
>>>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts2);
>>>> +	if (ret)
>>>> +		return -errno;
>>>> +
>>>> +	timespec_sub(&delta, &ts2, &ts1);
>>>> +	if (delta.tv_sec < interval)
>>>> +		smokey_warning("nanosleep didn't sleep long enough.");
>>>> +
>>>> +	/* Provide a valid 64bit timespec, round 2*/
>>>> +	next.tv_sec  = ts2.tv_sec + interval;
>>>> +	next.tv_nsec = ts2.tv_nsec;
>>>> +
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
>>>> +	if (!smokey_assert(!ret))
>>>> +		return ret ? ret : -EINVAL;
>>>
>>> Same here.
>>>
>>> I can fix those up - once I understood why they trigger here ATM.
>>>
>>
>> In fact, if we want to return the real error, errno needs to be
>> consulted. What is the intention then?
> 
> Err, no, it's direct syscall invocation, no errno at this point yet.
> 
> Found the reason for the failing test meanwhile: I was on wip/dovetail
> already, and there we have
> 
> static inline int pipeline_set_wallclock(xnticks_t epoch_ns)
> {
> 	return -EOPNOTSUPP;
> }
> 
> Philippe, any particular reason for this?
> 

...because of

COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec *tp))
{
	int ret;

	if (clock_id == CLOCK_REALTIME && !cobalt_use_legacy_tsc())
		return __STD(clock_settime(CLOCK_REALTIME, tp));


IOW, that set settime64 syscall is I-pipe only.

Florian, we need to adjust the test case accordingly for dovetail.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
  2021-06-04 12:05       ` Jan Kiszka
  2021-06-04 12:21         ` Jan Kiszka
@ 2021-06-04 12:45         ` Philippe Gerum
  1 sibling, 0 replies; 16+ messages in thread
From: Philippe Gerum @ 2021-06-04 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Florian Bezdeka, xenomai, chensong


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 04.06.21 13:43, Jan Kiszka via Xenomai wrote:
>> On 04.06.21 13:41, Jan Kiszka via Xenomai wrote:
>>> On 01.06.21 11:43, Florian Bezdeka wrote:
>>>> From: chensong <chensong@tj.kylinos.cn>
>>>>
>>>> Add test case for clock_nanosleep64 in smokey testsuite
>>>>
>>>> Signed-off-by: chensong <chensong@tj.kylinos.cn>
>>>> [Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]
>>>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>>>> ---
>>>>  testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++
>>>>  1 file changed, 67 insertions(+)
>>>>
>>>> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
>>>> index 840be89a5..54d529b6b 100644
>>>> --- a/testsuite/smokey/y2038/syscall-tests.c
>>>> +++ b/testsuite/smokey/y2038/syscall-tests.c
>>>> @@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)
>>>>  	return 0;
>>>>  }
>>>>  
>>>> +static int test_sc_cobalt_clock_nanosleep64(void)
>>>> +{
>>>> +	int ret;
>>>> +	int sc_nr = sc_cobalt_clock_nanosleep64;
>>>> +	struct xn_timespec64 next, rmt;
>>>> +	struct timespec ts1, ts2, delta;
>>>> +	long interval = 1;
>>>> +
>>>> +	/* Make sure we don't crash because of NULL pointers */
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
>>>> +	if (ret == -ENOSYS) {
>>>> +		smokey_note("clock_nanosleep64: skipped. (no kernel support)");
>>>> +		return 0; // Not implemented, nothing to test, success
>>>> +	}
>>>> +	if (!smokey_assert(ret == -EFAULT))
>>>> +		return ret ? ret : -EINVAL;
>>>> +
>>>> +	/* Providing an invalid address has to deliver EFAULT */
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>>>> +			       (void *)0xdeadbeefUL, &rmt);
>>>> +	if (!smokey_assert(ret == -EFAULT))
>>>> +		return ret ? ret : -EINVAL;
>>>> +
>>>> +	/* Provide a valid 64bit timespec, round 1 */
>>>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts1);
>>>> +	if (ret)
>>>> +		return -errno;
>>>> +
>>>> +	next.tv_sec  = ts1.tv_sec + interval;
>>>> +	next.tv_nsec = ts1.tv_nsec;
>>>> +
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME,
>>>> +			       &next, (void *)0xdeadbeefUL);
>>>> +	if (!smokey_assert(!ret))
>>>> +		return ret ? ret : -EINVAL;
>>>
>>> Unneeded test here - ret is != 0.
>>>
>>>> +
>>>> +	ret = clock_gettime(CLOCK_MONOTONIC, &ts2);
>>>> +	if (ret)
>>>> +		return -errno;
>>>> +
>>>> +	timespec_sub(&delta, &ts2, &ts1);
>>>> +	if (delta.tv_sec < interval)
>>>> +		smokey_warning("nanosleep didn't sleep long enough.");
>>>> +
>>>> +	/* Provide a valid 64bit timespec, round 2*/
>>>> +	next.tv_sec  = ts2.tv_sec + interval;
>>>> +	next.tv_nsec = ts2.tv_nsec;
>>>> +
>>>> +	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
>>>> +	if (!smokey_assert(!ret))
>>>> +		return ret ? ret : -EINVAL;
>>>
>>> Same here.
>>>
>>> I can fix those up - once I understood why they trigger here ATM.
>>>
>> 
>> In fact, if we want to return the real error, errno needs to be
>> consulted. What is the intention then?
>
> Err, no, it's direct syscall invocation, no errno at this point yet.
>
> Found the reason for the failing test meanwhile: I was on wip/dovetail
> already, and there we have
>
> static inline int pipeline_set_wallclock(xnticks_t epoch_ns)
> {
> 	return -EOPNOTSUPP;
> }
>
> Philippe, any particular reason for this?
>

Yes, because setting the wallclock from oob context over Dovetail does
not make sense because Xenomai shares the time base with the common
kernel when running on top of Dovetail. The latter can jump to the vDSO
for reading time using the common services on the regular time base, but
setting that time base does require a regular in-band context.

What you could do is handing the clock_settime request over to the glibc
instead, but that would entail a stage switch to in-band then.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-06-04 12:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01  9:43 [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Florian Bezdeka
2021-06-01  9:43 ` [PATCH 1/9] y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall Florian Bezdeka
2021-06-01  9:43 ` [PATCH 2/9] y2038: cobalt/posix/clock: Adding clock_gettime64 Florian Bezdeka
2021-06-01  9:43 ` [PATCH 3/9] y2038: cobalt/posix/clock: Adding clock_settime64 Florian Bezdeka
2021-06-01  9:43 ` [PATCH 4/9] y2038: lib/cobalt/clock: dispatch clock_gettime Florian Bezdeka
2021-06-01  9:43 ` [PATCH 5/9] y2038: lib/cobalt/clock: dispatch clock_settime Florian Bezdeka
2021-06-01  9:43 ` [PATCH 6/9] y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64 Florian Bezdeka
2021-06-01  9:43 ` [PATCH 7/9] y2038: cobalt/posix/clock: Adding clock_nanosleep64 Florian Bezdeka
2021-06-01  9:43 ` [PATCH 8/9] y2038: lib/cobalt/clock: dispatch clock_nanosleep Florian Bezdeka
2021-06-01  9:43 ` [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64 Florian Bezdeka
2021-06-04 11:41   ` Jan Kiszka
2021-06-04 11:43     ` Jan Kiszka
2021-06-04 12:05       ` Jan Kiszka
2021-06-04 12:21         ` Jan Kiszka
2021-06-04 12:45         ` Philippe Gerum
2021-06-04 12:07 ` [PATCH 0/9] y2038: clock_{g,s}ettime64, clock_nanosleep64 Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.