All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] y2038: Adding event_wait64()
@ 2021-08-11 13:36 Florian Bezdeka
  2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/event: Adding event_wait64 Florian Bezdeka
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

Hi!

Just another y2038 related syscall, once again based on v1 sent out by
Song and rebased to current next with some code- and test-cleanups applied.

@Song:
This one was the last one in my inbox. Please make sure that all
following patches are based on next. IIRC there are 3 or 4 syscalls
remaining. We should take care of [1] as well. We need something in the CI 
that tests the full implementation, i.e. including the glibc wrappers (proper
syscall delegation). Recent glibc should allow us to use 64bit time_t.

[1]: https://gitlab.com/Xenomai/xenomai-hacker-space/-/issues/21

Best regards,
Florian

Florian Bezdeka (1):
  y2038: testsuite/smokey/y2038: Adding tests for event_wait64

Song Chen (2):
  y2038: cobalt/posix/event: Adding event_wait64
  y2038: lib/cobalt/internal: dispatch event_wait

 include/cobalt/uapi/syscall.h          |  1 +
 kernel/cobalt/posix/event.c            | 34 ++++++++++-
 kernel/cobalt/posix/event.h            | 12 ++++
 kernel/cobalt/posix/syscall32.c        |  9 +++
 kernel/cobalt/posix/syscall32.h        |  7 +++
 kernel/cobalt/trace/cobalt-posix.h     |  3 +-
 lib/cobalt/internal.c                  |  5 ++
 testsuite/smokey/y2038/syscall-tests.c | 78 +++++++++++++++++++++++---
 8 files changed, 136 insertions(+), 13 deletions(-)

-- 
2.30.2



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

* [PATCH v2 1/3] y2038: cobalt/posix/event: Adding event_wait64
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
@ 2021-08-11 13:36 ` Florian Bezdeka
  2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/monitor: Adding monitor_wait64 Florian Bezdeka
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

From: Song Chen <chensong_2000@189.cn>

Add a syscall specific for event_wait with 64bit time_t.

Signed-off-by: Song Chen <chensong_2000@189.cn>
[Florian: Tracing, reformatting/rebasing]
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/cobalt/uapi/syscall.h      |  1 +
 kernel/cobalt/posix/event.c        | 34 +++++++++++++++++++++++++++---
 kernel/cobalt/posix/event.h        | 12 +++++++++++
 kernel/cobalt/posix/syscall32.c    |  9 ++++++++
 kernel/cobalt/posix/syscall32.h    |  7 ++++++
 kernel/cobalt/trace/cobalt-posix.h |  3 ++-
 6 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index e49110f5d..16edce15d 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -133,6 +133,7 @@
 #define sc_cobalt_mq_timedreceive64		110
 #define sc_cobalt_sigtimedwait64		111
 #define sc_cobalt_monitor_wait64		112
+#define sc_cobalt_event_wait64			113
 
 #define __NR_COBALT_SYSCALLS			128 /* Power of 2 */
 
diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c
index 3712154f5..052c68605 100644
--- a/kernel/cobalt/posix/event.c
+++ b/kernel/cobalt/posix/event.c
@@ -20,6 +20,7 @@
 #include "clock.h"
 #include "event.h"
 #include <trace/events/cobalt-posix.h>
+#include <cobalt/kernel/time.h>
 
 /*
  * Cobalt event notification services
@@ -119,9 +120,9 @@ int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
 	handle = cobalt_get_handle_from_user(&u_event->handle);
 
 	if (ts) {
-		if ((unsigned long)ts->tv_nsec >= ONE_BILLION)
+		if (!timespec64_valid(ts))
 			return -EINVAL;
-	
+
 		timeout = ts2ns(ts);
 		if (timeout) {
 			timeout++;
@@ -189,6 +190,24 @@ out:
 	return ret;
 }
 
+int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
+			  unsigned int bits,
+			  unsigned int __user *u_bits_r,
+			  int mode, const struct __kernel_timespec __user *u_ts)
+{
+	struct timespec64 ts, *tsp = NULL;
+	int ret;
+
+	if (u_ts) {
+		tsp = &ts;
+		ret = cobalt_get_timespec64(&ts, u_ts);
+		if (ret)
+			return ret;
+	}
+
+	return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
+}
+
 COBALT_SYSCALL(event_wait, primary,
 	       (struct cobalt_event_shadow __user *u_event,
 		unsigned int bits,
@@ -208,6 +227,15 @@ COBALT_SYSCALL(event_wait, primary,
 	return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
 }
 
+COBALT_SYSCALL(event_wait64, primary,
+	       (struct cobalt_event_shadow __user *u_event,
+		unsigned int bits,
+		unsigned int __user *u_bits_r,
+		int mode, const struct __kernel_timespec __user *u_ts))
+{
+	return __cobalt_event_wait64(u_event, bits, u_bits_r, mode, u_ts);
+}
+
 COBALT_SYSCALL(event_sync, current,
 	       (struct cobalt_event_shadow __user *u_event))
 {
@@ -278,7 +306,7 @@ COBALT_SYSCALL(event_destroy, current,
 	}
 
 	cobalt_event_reclaim(&event->resnode, s); /* drops lock */
-	
+
 	return 0;
 }
 
diff --git a/kernel/cobalt/posix/event.h b/kernel/cobalt/posix/event.h
index ef592f72c..919774c9a 100644
--- a/kernel/cobalt/posix/event.h
+++ b/kernel/cobalt/posix/event.h
@@ -41,6 +41,11 @@ int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
 			unsigned int __user *u_bits_r,
 			int mode, const struct timespec64 *ts);
 
+int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
+			  unsigned int bits, unsigned int __user *u_bits_r,
+			  int mode,
+			  const struct __kernel_timespec __user *u_ts);
+
 COBALT_SYSCALL_DECL(event_init,
 		    (struct cobalt_event_shadow __user *u_evtsh,
 		     unsigned int value,
@@ -53,6 +58,13 @@ COBALT_SYSCALL_DECL(event_wait,
 		     int mode,
 		     const struct __user_old_timespec __user *u_ts));
 
+COBALT_SYSCALL_DECL(event_wait64,
+		    (struct cobalt_event_shadow __user *u_evtsh,
+		     unsigned int bits,
+		     unsigned int __user *u_bits_r,
+		     int mode,
+		     const struct __kernel_timespec __user *u_ts));
+
 COBALT_SYSCALL_DECL(event_sync,
 		    (struct cobalt_event_shadow __user *u_evtsh));
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index e6c9831b9..2d88fac83 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -795,6 +795,15 @@ COBALT_SYSCALL32emu(event_wait, primary,
 	return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
 }
 
+COBALT_SYSCALL32emu(event_wait64, primary,
+		    (struct cobalt_event_shadow __user *u_event,
+		     unsigned int bits,
+		     unsigned int __user *u_bits_r,
+		     int mode, const struct __kernel_timespec __user *u_ts))
+{
+	return __cobalt_event_wait64(u_event, bits, u_bits_r, mode, u_ts);
+}
+
 COBALT_SYSCALL32emu(select, primary,
 		    (int nfds,
 		     compat_fd_set __user *u_rfds,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index a2ef67808..3eb66571b 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -230,6 +230,13 @@ COBALT_SYSCALL32emu_DECL(event_wait,
 			  unsigned int __user *u_bits_r,
 			  int mode, const struct old_timespec32 __user *u_ts));
 
+COBALT_SYSCALL32emu_DECL(event_wait64,
+			 (struct cobalt_event_shadow __user *u_event,
+			  unsigned int bits,
+			  unsigned int __user *u_bits_r,
+			  int mode,
+			  const struct __kernel_timespec __user *u_ts));
+
 COBALT_SYSCALL32emu_DECL(select,
 			 (int nfds,
 			  compat_fd_set __user *u_rfds,
diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h
index 221e25037..45e3cbcf7 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -165,7 +165,8 @@
 		__cobalt_symbolic_syscall(mq_timedsend64),  		\
 		__cobalt_symbolic_syscall(mq_timedreceive64),		\
 		__cobalt_symbolic_syscall(sigtimedwait64),		\
-		__cobalt_symbolic_syscall(monitor_wait64))
+		__cobalt_symbolic_syscall(monitor_wait64),		\
+		__cobalt_symbolic_syscall(event_wait64))
 
 DECLARE_EVENT_CLASS(cobalt_syscall_entry,
 	TP_PROTO(unsigned int nr),
-- 
2.30.2



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

* [PATCH v2 1/3] y2038: cobalt/posix/monitor: Adding monitor_wait64
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
  2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/event: Adding event_wait64 Florian Bezdeka
@ 2021-08-11 13:36 ` Florian Bezdeka
  2021-08-11 13:40   ` Bezdeka, Florian
  2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch event_wait Florian Bezdeka
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

Adding monitor_wait64. Patch is based on v1 sent out by Song and was
re-worked to apply on top of current next/master.

__cobalt_monitor_wait() is now validating the struct timespec64 it
received from userland. That was not the case up to now.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 include/cobalt/uapi/syscall.h      |  1 +
 kernel/cobalt/posix/monitor.c      | 32 +++++++++++++++++++++++++++++-
 kernel/cobalt/posix/monitor.h      | 10 ++++++++++
 kernel/cobalt/posix/syscall32.c    |  8 ++++++++
 kernel/cobalt/posix/syscall32.h    |  6 ++++++
 kernel/cobalt/trace/cobalt-posix.h |  3 ++-
 6 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 4de7e59d0..e49110f5d 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -132,6 +132,7 @@
 #define sc_cobalt_mq_timedsend64		109
 #define sc_cobalt_mq_timedreceive64		110
 #define sc_cobalt_sigtimedwait64		111
+#define sc_cobalt_monitor_wait64		112
 
 #define __NR_COBALT_SYSCALLS			128 /* Power of 2 */
 
diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index b907e0050..0d0213273 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -20,6 +20,7 @@
 #include "clock.h"
 #include "monitor.h"
 #include <trace/events/cobalt-posix.h>
+#include <cobalt/kernel/time.h>
 
 /*
  * The Cobalt monitor is a double-wait condition object, serializing
@@ -218,8 +219,12 @@ int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
 
 	handle = cobalt_get_handle_from_user(&u_mon->handle);
 
-	if (ts)
+	if (ts) {
+		if (!timespec64_valid(ts))
+			return -EINVAL;
+
 		timeout = ts2ns(ts) + 1;
+	}
 
 	xnlock_get_irqsave(&nklock, s);
 
@@ -289,6 +294,24 @@ out:
 	return ret;
 }
 
+int __cobalt_monitor_wait64(struct cobalt_monitor_shadow __user *u_mon,
+			    int event,
+			    const struct __kernel_timespec __user *u_ts,
+			    int __user *u_ret)
+{
+	struct timespec64 ts, *tsp = NULL;
+	int ret;
+
+	if (u_ts) {
+		tsp = &ts;
+		ret = cobalt_get_timespec64(&ts, u_ts);
+		if (ret)
+			return ret;
+	}
+
+	return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
+}
+
 COBALT_SYSCALL(monitor_wait, nonrestartable,
 	       (struct cobalt_monitor_shadow __user *u_mon,
 	       int event, const struct __user_old_timespec __user *u_ts,
@@ -307,6 +330,13 @@ COBALT_SYSCALL(monitor_wait, nonrestartable,
 	return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
 }
 
+COBALT_SYSCALL(monitor_wait64, nonrestartable,
+	       (struct cobalt_monitor_shadow __user *u_mon, int event,
+		const struct __kernel_timespec __user *u_ts, int __user *u_ret))
+{
+	return __cobalt_monitor_wait64(u_mon, event, u_ts, u_ret);
+}
+
 COBALT_SYSCALL(monitor_sync, nonrestartable,
 	       (struct cobalt_monitor_shadow __user *u_mon))
 {
diff --git a/kernel/cobalt/posix/monitor.h b/kernel/cobalt/posix/monitor.h
index d4a4aa24e..bf8794e36 100644
--- a/kernel/cobalt/posix/monitor.h
+++ b/kernel/cobalt/posix/monitor.h
@@ -42,6 +42,11 @@ int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
 			  int event, const struct timespec64 *ts,
 			  int __user *u_ret);
 
+int __cobalt_monitor_wait64(struct cobalt_monitor_shadow __user *u_mon,
+			    int event,
+			    const struct __kernel_timespec __user *u_ts,
+			    int __user *u_ret);
+
 COBALT_SYSCALL_DECL(monitor_init,
 		    (struct cobalt_monitor_shadow __user *u_monsh,
 		     clockid_t clk_id,
@@ -61,6 +66,11 @@ COBALT_SYSCALL_DECL(monitor_wait,
 		     int event, const struct __user_old_timespec __user *u_ts,
 		     int __user *u_ret));
 
+COBALT_SYSCALL_DECL(monitor_wait64,
+		    (struct cobalt_monitor_shadow __user *u_monsh, int event,
+		     const struct __kernel_timespec __user *u_ts,
+		     int __user *u_ret));
+
 COBALT_SYSCALL_DECL(monitor_destroy,
 		    (struct cobalt_monitor_shadow __user *u_monsh));
 
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
index 79fc365fc..e6c9831b9 100644
--- a/kernel/cobalt/posix/syscall32.c
+++ b/kernel/cobalt/posix/syscall32.c
@@ -768,6 +768,14 @@ COBALT_SYSCALL32emu(monitor_wait, nonrestartable,
 	return __cobalt_monitor_wait(u_mon, event, tsp, u_ret);
 }
 
+COBALT_SYSCALL32emu(monitor_wait64, nonrestartable,
+		    (struct cobalt_monitor_shadow __user *u_mon, int event,
+		     const struct __kernel_timespec __user *u_ts,
+		     int __user *u_ret))
+{
+	return __cobalt_monitor_wait64(u_mon, event, u_ts, u_ret);
+}
+
 COBALT_SYSCALL32emu(event_wait, primary,
 		    (struct cobalt_event_shadow __user *u_event,
 		     unsigned int bits,
diff --git a/kernel/cobalt/posix/syscall32.h b/kernel/cobalt/posix/syscall32.h
index cf295ed5e..a2ef67808 100644
--- a/kernel/cobalt/posix/syscall32.h
+++ b/kernel/cobalt/posix/syscall32.h
@@ -218,6 +218,12 @@ COBALT_SYSCALL32emu_DECL(monitor_wait,
 			  int event, const struct old_timespec32 __user *u_ts,
 			  int __user *u_ret));
 
+COBALT_SYSCALL32emu_DECL(monitor_wait64,
+			 (struct cobalt_monitor_shadow __user *u_mon,
+			  int event,
+			  const struct __kernel_timespec __user *u_ts,
+			  int __user *u_ret));
+
 COBALT_SYSCALL32emu_DECL(event_wait,
 			 (struct cobalt_event_shadow __user *u_event,
 			  unsigned int bits,
diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h
index 5d14d851f..221e25037 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -164,7 +164,8 @@
 		__cobalt_symbolic_syscall(mutex_timedlock64),		\
 		__cobalt_symbolic_syscall(mq_timedsend64),  		\
 		__cobalt_symbolic_syscall(mq_timedreceive64),		\
-		__cobalt_symbolic_syscall(sigtimedwait64))
+		__cobalt_symbolic_syscall(sigtimedwait64),		\
+		__cobalt_symbolic_syscall(monitor_wait64))
 
 DECLARE_EVENT_CLASS(cobalt_syscall_entry,
 	TP_PROTO(unsigned int nr),
-- 
2.30.2



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

* [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch event_wait
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
  2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/event: Adding event_wait64 Florian Bezdeka
  2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/monitor: Adding monitor_wait64 Florian Bezdeka
@ 2021-08-11 13:36 ` Florian Bezdeka
  2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch monitor_wait Florian Bezdeka
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

From: Song Chen <chensong_2000@189.cn>

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

otherwise, go to original event_wait.

Signed-off-by: Song Chen <chensong_2000@189.cn>
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/internal.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 75933a830..bf1e940b7 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -483,8 +483,13 @@ int cobalt_event_wait(cobalt_event_t *event,
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
+#ifdef __USE_TIME_BITS64
+	ret = XENOMAI_SYSCALL5(sc_cobalt_event_wait64,
+			       event, bits, bits_r, mode, timeout);
+#else
 	ret = XENOMAI_SYSCALL5(sc_cobalt_event_wait,
 			       event, bits, bits_r, mode, timeout);
+#endif
 
 	pthread_setcanceltype(oldtype, NULL);
 
-- 
2.30.2



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

* [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch monitor_wait
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
                   ` (2 preceding siblings ...)
  2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch event_wait Florian Bezdeka
@ 2021-08-11 13:36 ` Florian Bezdeka
  2021-08-11 13:41   ` Bezdeka, Florian
  2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64() Florian Bezdeka
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

From: Song Chen <chensong_2000@189.cn>

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

otherwise, go to original monitor_wait.

Signed-off-by: Song Chen <chensong_2000@189.cn>
[Florian: Fix warnings reported by checkpatch.pl, coding style]
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 lib/cobalt/internal.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 42b60c35b..75933a830 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -258,8 +258,12 @@ int cobalt_monitor_wait(cobalt_monitor_t *mon, int event,
 
 	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
 
-	ret = XENOMAI_SYSCALL4(sc_cobalt_monitor_wait,
-			       mon, event, ts, &opret);
+#ifdef __USE_TIME_BITS64
+	ret = XENOMAI_SYSCALL4(sc_cobalt_monitor_wait64, mon, event, ts,
+			       &opret);
+#else
+	ret = XENOMAI_SYSCALL4(sc_cobalt_monitor_wait, mon, event, ts, &opret);
+#endif
 
 	pthread_setcanceltype(oldtype, NULL);
 
-- 
2.30.2



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

* [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64()
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
                   ` (3 preceding siblings ...)
  2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch monitor_wait Florian Bezdeka
@ 2021-08-11 13:36 ` Florian Bezdeka
  2021-08-11 13:42   ` Bezdeka, Florian
  2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding tests for event_wait64 Florian Bezdeka
  2021-08-12  7:02 ` [PATCH v2 0/3] y2038: Adding event_wait64() chensong_2000
  6 siblings, 1 reply; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

The time measurement is a bit different to the other y2038 related
measurements we do. Using a monitor with CLOCK_REALTIME requires an
absolute timeout.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 78 +++++++++++++++++++++++++-
 1 file changed, 77 insertions(+), 1 deletion(-)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index 427117038..839a50e07 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -19,6 +19,8 @@
 #include <errno.h>
 #include <mqueue.h>
 #include <signal.h>
+#include <cobalt/uapi/monitor.h>
+#include <sys/cobalt.h>
 
 smokey_test_plugin(y2038, SMOKEY_NOARGS, "Validate correct y2038 support");
 
@@ -367,7 +369,8 @@ static int test_sc_cobalt_clock_nanosleep64(void)
 	next.tv_sec  = ts2.tv_sec + interval;
 	next.tv_nsec = ts2.tv_nsec;
 
-	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
+	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next,
+			       &rmt);
 	if (!smokey_assert(!ret))
 		return ret;
 
@@ -844,6 +847,75 @@ static int test_sc_cobalt_sigtimedwait64(void)
 	return 0;
 }
 
+static int test_sc_cobalt_monitor_wait64(void)
+{
+	int ret, opret;
+	int sc_nr = sc_cobalt_monitor_wait64;
+	struct xn_timespec64 t1, t2, to;
+	struct timespec ts_nat;
+	struct cobalt_monitor_shadow mon;
+
+	ret = cobalt_monitor_init(&mon, CLOCK_REALTIME, 0);
+	if (ret)
+		return -errno;
+
+	/* Make sure we don't crash because of NULL pointers */
+	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
+	if (ret == -ENOSYS) {
+		smokey_note("monitor_wait64: skipped. (no kernel support)");
+		return 0; // Not implemented, nothing to test, success
+	}
+	if (!smokey_assert(ret == -EINVAL))
+		return ret ? ret : -EINVAL;
+
+	/* Providing an invalid address has to deliver EFAULT */
+	ret = XENOMAI_SYSCALL4(sc_nr, &mon, COBALT_MONITOR_WAITGRANT,
+			       (void *)0xdeadbeefUL, NULL);
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* providing an invalid timeout has to deliver EINVAL */
+	t1.tv_sec = -1;
+	ret = XENOMAI_SYSCALL4(sc_nr, &mon, COBALT_MONITOR_WAITGRANT, &t1,
+			       NULL);
+	if (!smokey_assert(ret == -EINVAL))
+		return ret ? ret : -EINVAL;
+
+	/*
+	 * Providing a valid timeout, waiting for it to time out and check
+	 * that we didn't come back to early.
+	 */
+	ret = clock_gettime(CLOCK_REALTIME, &ts_nat);
+	if (ret)
+		return -errno;
+
+	t1.tv_sec = ts_nat.tv_sec;
+	t1.tv_nsec = ts_nat.tv_nsec;
+
+	to = t1;
+	ts_add_ns(&to, 50000);
+
+	ret = XENOMAI_SYSCALL4(sc_nr, &mon, COBALT_MONITOR_WAITGRANT, &to,
+			       &opret);
+	if (!smokey_assert(opret == -ETIMEDOUT))
+		return ret;
+
+	ret = clock_gettime(CLOCK_REALTIME, &ts_nat);
+	if (ret)
+		return -errno;
+
+	t2.tv_sec = ts_nat.tv_sec;
+	t2.tv_nsec = ts_nat.tv_nsec;
+
+	if (ts_less(&t2, &to))
+		smokey_warning("monitor_wait64 returned too early!\n"
+			       "Expected wakeup at: %lld sec %lld nsec\n"
+			       "Back at           : %lld sec %lld nsec\n",
+			       to.tv_sec, to.tv_nsec, t2.tv_sec, t2.tv_nsec);
+
+	return 0;
+}
+
 static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 {
 	int ret;
@@ -888,5 +960,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
+	ret = test_sc_cobalt_monitor_wait64();
+	if (ret)
+		return ret;
+
 	return 0;
 }
-- 
2.30.2



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

* [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding tests for event_wait64
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
                   ` (4 preceding siblings ...)
  2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64() Florian Bezdeka
@ 2021-08-11 13:36 ` Florian Bezdeka
  2021-08-12  7:02 ` [PATCH v2 0/3] y2038: Adding event_wait64() chensong_2000
  6 siblings, 0 replies; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11 13:36 UTC (permalink / raw)
  To: xenomai

Based on the tests provided by Song, slightly adjusted, #includes
cleaned up and making sure all resources used during tests have been
cleaned up as well.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 80 +++++++++++++++++++++++---
 1 file changed, 71 insertions(+), 9 deletions(-)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index 839a50e07..7add1c454 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -10,17 +10,8 @@
  * Released under the terms of GPLv2.
  */
 #include <asm/xenomai/syscall.h>
-#include <cobalt/uapi/syscall.h>
 #include <smokey/smokey.h>
-#include <semaphore.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <errno.h>
 #include <mqueue.h>
-#include <signal.h>
-#include <cobalt/uapi/monitor.h>
-#include <sys/cobalt.h>
 
 smokey_test_plugin(y2038, SMOKEY_NOARGS, "Validate correct y2038 support");
 
@@ -916,6 +907,73 @@ static int test_sc_cobalt_monitor_wait64(void)
 	return 0;
 }
 
+static int test_sc_cobalt_event_wait64(void)
+{
+	int ret;
+	int sc_nr = sc_cobalt_event_wait64;
+	struct xn_timespec64 t1, t2;
+	struct timespec ts_nat;
+	struct cobalt_event_shadow evt;
+	unsigned int flags;
+
+	ret = cobalt_event_init(&evt, 0, COBALT_EVENT_FIFO);
+	if (ret)
+		return -errno;
+
+	/* Make sure we don't crash because of NULL pointers */
+	ret = XENOMAI_SYSCALL5(sc_nr, NULL, NULL, NULL, NULL, NULL);
+	if (ret == -ENOSYS) {
+		smokey_note("event_wait64: skipped. (no kernel support)");
+		return 0; // Not implemented, nothing to test, success
+	}
+	if (!smokey_assert(ret == -EINVAL))
+		return ret ? ret : -EINVAL;
+
+	/* Providing an invalid address has to deliver EFAULT */
+	ret = XENOMAI_SYSCALL5(sc_nr, &evt, 0x1, &flags, 0,
+			       (void *)0xdeadbeefUL);
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* providing an invalid timeout has to deliver EINVAL */
+	t1.tv_sec = -1;
+	ret = XENOMAI_SYSCALL5(sc_nr, &evt, 0x1, &flags, 0, &t1);
+	if (!smokey_assert(ret == -EINVAL))
+		return ret ? ret : -EINVAL;
+
+	/*
+	 * Providing a valid timeout, waiting for it to time out and check
+	 * that we didn't come back to early.
+	 */
+	ret = clock_gettime(CLOCK_REALTIME, &ts_nat);
+	if (ret)
+		return -errno;
+
+	t1.tv_sec = 0;
+	t1.tv_nsec = 500000;
+
+	ret = XENOMAI_SYSCALL5(sc_nr, &evt, 0x1, &flags, 0, &t1);
+	if (!smokey_assert(ret == -ETIMEDOUT))
+		return ret;
+
+	ret = clock_gettime(CLOCK_REALTIME, &ts_nat);
+	if (ret)
+		return -errno;
+
+	t2.tv_sec = ts_nat.tv_sec;
+	t2.tv_nsec = ts_nat.tv_nsec;
+
+	if (ts_less(&t2, &t1))
+		smokey_warning("event_wait64 returned too early!\n"
+			       "Expected wakeup at: %lld sec %lld nsec\n"
+			       "Back at           : %lld sec %lld nsec\n",
+			       t1.tv_sec, t1.tv_nsec, t2.tv_sec, t2.tv_nsec);
+
+	cobalt_event_destroy(&evt);
+
+	return 0;
+}
+
 static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 {
 	int ret;
@@ -964,5 +1022,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
+	ret = test_sc_cobalt_event_wait64();
+	if (ret)
+		return ret;
+
 	return 0;
 }
-- 
2.30.2



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

* Re: [PATCH v2 1/3] y2038: cobalt/posix/monitor: Adding monitor_wait64
  2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/monitor: Adding monitor_wait64 Florian Bezdeka
@ 2021-08-11 13:40   ` Bezdeka, Florian
  0 siblings, 0 replies; 13+ messages in thread
From: Bezdeka, Florian @ 2021-08-11 13:40 UTC (permalink / raw)
  To: xenomai

On Wed, 2021-08-11 at 15:36 +0200, Florian Bezdeka wrote:
> Adding monitor_wait64. Patch is based on v1 sent out by Song and was
> re-worked to apply on top of current next/master.
> 
> __cobalt_monitor_wait() is now validating the struct timespec64 it
> received from userland. That was not the case up to now.
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>

Already applied. Can be ignored. Searching for the reason of the re-
send...

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

* Re: [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch monitor_wait
  2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch monitor_wait Florian Bezdeka
@ 2021-08-11 13:41   ` Bezdeka, Florian
  0 siblings, 0 replies; 13+ messages in thread
From: Bezdeka, Florian @ 2021-08-11 13:41 UTC (permalink / raw)
  To: xenomai

On Wed, 2021-08-11 at 15:36 +0200, Florian Bezdeka wrote:
> From: Song Chen <chensong_2000@189.cn>
> 
> If sizeof time_t bigger than 4, which means glibc supports
> 64bit timespec, go to monitor_wait64.
> 
> otherwise, go to original monitor_wait.
> 
> Signed-off-by: Song Chen <chensong_2000@189.cn>
> [Florian: Fix warnings reported by checkpatch.pl, coding style]
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
> 
> 

Already applied. Can be ignored. Searching for the reason of the re-
send...


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

* Re: [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64()
  2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64() Florian Bezdeka
@ 2021-08-11 13:42   ` Bezdeka, Florian
  0 siblings, 0 replies; 13+ messages in thread
From: Bezdeka, Florian @ 2021-08-11 13:42 UTC (permalink / raw)
  To: xenomai

On Wed, 2021-08-11 at 15:36 +0200, Florian Bezdeka wrote:
> The time measurement is a bit different to the other y2038 related
> measurements we do. Using a monitor with CLOCK_REALTIME requires an
> absolute timeout.
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---

Already applied. Can be ignored. Searching for the reason of the re-
send...

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

* Re: [PATCH v2 0/3] y2038: Adding event_wait64()
  2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
                   ` (5 preceding siblings ...)
  2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding tests for event_wait64 Florian Bezdeka
@ 2021-08-12  7:02 ` chensong_2000
  2021-08-23 15:43   ` Bezdeka, Florian
  6 siblings, 1 reply; 13+ messages in thread
From: chensong_2000 @ 2021-08-12  7:02 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai



在 2021/8/11 下午9:36, Florian Bezdeka 写道:
> Hi!
> 
> Just another y2038 related syscall, once again based on v1 sent out by
> Song and rebased to current next with some code- and test-cleanups applied.
> 
> @Song:
> This one was the last one in my inbox. Please make sure that all
> following patches are based on next. IIRC there are 3 or 4 syscalls
> remaining. We should take care of [1] as well. We need something in the CI
> that tests the full implementation, i.e. including the glibc wrappers (proper
> syscall delegation). Recent glibc should allow us to use 64bit time_t.

hi Florian,

There are left in implementation:

1, cobalt_thread_setschedparam_ex
2, cobalt_thread_getschedparam_ex

those 2 are a little bit tricky, i'm working on it.

3, recvmmsg (waiting to submit) but will double check to keep aligned 
with your modification.

4, cond_wait_prologue (haven't started yet)

I will submit patches about them and please feel free to reject if you 
think something wrong.

BR

Song

> 
> [1]: https://gitlab.com/Xenomai/xenomai-hacker-space/-/issues/21
> 
> Best regards,
> Florian
> 
> Florian Bezdeka (1):
>    y2038: testsuite/smokey/y2038: Adding tests for event_wait64
> 
> Song Chen (2):
>    y2038: cobalt/posix/event: Adding event_wait64
>    y2038: lib/cobalt/internal: dispatch event_wait
> 
>   include/cobalt/uapi/syscall.h          |  1 +
>   kernel/cobalt/posix/event.c            | 34 ++++++++++-
>   kernel/cobalt/posix/event.h            | 12 ++++
>   kernel/cobalt/posix/syscall32.c        |  9 +++
>   kernel/cobalt/posix/syscall32.h        |  7 +++
>   kernel/cobalt/trace/cobalt-posix.h     |  3 +-
>   lib/cobalt/internal.c                  |  5 ++
>   testsuite/smokey/y2038/syscall-tests.c | 78 +++++++++++++++++++++++---
>   8 files changed, 136 insertions(+), 13 deletions(-)
> 


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

* Re: [PATCH v2 0/3] y2038: Adding event_wait64()
  2021-08-12  7:02 ` [PATCH v2 0/3] y2038: Adding event_wait64() chensong_2000
@ 2021-08-23 15:43   ` Bezdeka, Florian
  0 siblings, 0 replies; 13+ messages in thread
From: Bezdeka, Florian @ 2021-08-23 15:43 UTC (permalink / raw)
  To: chensong_2000, jan.kiszka; +Cc: xenomai

On Thu, 2021-08-12 at 15:02 +0800, chensong_2000@189.cn wrote:
> 
> 在 2021/8/11 下午9:36, Florian Bezdeka 写道:
> > Hi!
> > 
> > Just another y2038 related syscall, once again based on v1 sent out by
> > Song and rebased to current next with some code- and test-cleanups applied.
> > 
> > @Song:
> > This one was the last one in my inbox. Please make sure that all
> > following patches are based on next. IIRC there are 3 or 4 syscalls
> > remaining. We should take care of [1] as well. We need something in the CI
> > that tests the full implementation, i.e. including the glibc wrappers (proper
> > syscall delegation). Recent glibc should allow us to use 64bit time_t.
> 
> hi Florian,
> 
> There are left in implementation:
> 
> 1, cobalt_thread_setschedparam_ex
> 2, cobalt_thread_getschedparam_ex
> 
> those 2 are a little bit tricky, i'm working on it.
> 
> 3, recvmmsg (waiting to submit) but will double check to keep aligned 
> with your modification.
> 
> 4, cond_wait_prologue (haven't started yet)
> 
> I will submit patches about them and please feel free to reject if you 
> think something wrong.

There is one more missing:

5, select

I will update the wiki page soon [2]. Select was already listed, but
not yet implemented. Taking select already into account we now have
12/17 syscalls implemented, that is around 70%.

Best regards,
Florian

[2] https://gitlab.com/Xenomai/xenomai-hacker-space/-/wikis/y2038/Y2038_Affected_Syscalls

> 
> BR
> 
> Song
> 
> > 
> > [1]: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2FXenomai%2Fxenomai-hacker-space%2F-%2Fissues%2F21&amp;data=04%7C01%7Cflorian.bezdeka%40siemens.com%7C70c719a95f234ad8f47408d95d5f4445%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637643486028192120%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=fOJ0rh38UBzM1NBN1FLBjudikKR7OQlWv0jpLL2vtuU%3D&amp;reserved=0
> > 
> > Best regards,
> > Florian
> > 
> > Florian Bezdeka (1):
> >    y2038: testsuite/smokey/y2038: Adding tests for event_wait64
> > 
> > Song Chen (2):
> >    y2038: cobalt/posix/event: Adding event_wait64
> >    y2038: lib/cobalt/internal: dispatch event_wait
> > 
> >   include/cobalt/uapi/syscall.h          |  1 +
> >   kernel/cobalt/posix/event.c            | 34 ++++++++++-
> >   kernel/cobalt/posix/event.h            | 12 ++++
> >   kernel/cobalt/posix/syscall32.c        |  9 +++
> >   kernel/cobalt/posix/syscall32.h        |  7 +++
> >   kernel/cobalt/trace/cobalt-posix.h     |  3 +-
> >   lib/cobalt/internal.c                  |  5 ++
> >   testsuite/smokey/y2038/syscall-tests.c | 78 +++++++++++++++++++++++---
> >   8 files changed, 136 insertions(+), 13 deletions(-)
> > 


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

* [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64()
  2021-08-11  8:11 [PATCH v2 0/3] y2038: Adding monitor_wait64() Florian Bezdeka
@ 2021-08-11  8:11 ` Florian Bezdeka
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Bezdeka @ 2021-08-11  8:11 UTC (permalink / raw)
  To: xenomai

The time measurement is a bit different to the other y2038 related
measurements we do. Using a monitor with CLOCK_REALTIME requires an
absolute timeout.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 78 +++++++++++++++++++++++++-
 1 file changed, 77 insertions(+), 1 deletion(-)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index 427117038..839a50e07 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -19,6 +19,8 @@
 #include <errno.h>
 #include <mqueue.h>
 #include <signal.h>
+#include <cobalt/uapi/monitor.h>
+#include <sys/cobalt.h>
 
 smokey_test_plugin(y2038, SMOKEY_NOARGS, "Validate correct y2038 support");
 
@@ -367,7 +369,8 @@ static int test_sc_cobalt_clock_nanosleep64(void)
 	next.tv_sec  = ts2.tv_sec + interval;
 	next.tv_nsec = ts2.tv_nsec;
 
-	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt);
+	ret = XENOMAI_SYSCALL4(sc_nr, CLOCK_MONOTONIC, TIMER_ABSTIME, &next,
+			       &rmt);
 	if (!smokey_assert(!ret))
 		return ret;
 
@@ -844,6 +847,75 @@ static int test_sc_cobalt_sigtimedwait64(void)
 	return 0;
 }
 
+static int test_sc_cobalt_monitor_wait64(void)
+{
+	int ret, opret;
+	int sc_nr = sc_cobalt_monitor_wait64;
+	struct xn_timespec64 t1, t2, to;
+	struct timespec ts_nat;
+	struct cobalt_monitor_shadow mon;
+
+	ret = cobalt_monitor_init(&mon, CLOCK_REALTIME, 0);
+	if (ret)
+		return -errno;
+
+	/* Make sure we don't crash because of NULL pointers */
+	ret = XENOMAI_SYSCALL4(sc_nr, NULL, NULL, NULL, NULL);
+	if (ret == -ENOSYS) {
+		smokey_note("monitor_wait64: skipped. (no kernel support)");
+		return 0; // Not implemented, nothing to test, success
+	}
+	if (!smokey_assert(ret == -EINVAL))
+		return ret ? ret : -EINVAL;
+
+	/* Providing an invalid address has to deliver EFAULT */
+	ret = XENOMAI_SYSCALL4(sc_nr, &mon, COBALT_MONITOR_WAITGRANT,
+			       (void *)0xdeadbeefUL, NULL);
+	if (!smokey_assert(ret == -EFAULT))
+		return ret ? ret : -EINVAL;
+
+	/* providing an invalid timeout has to deliver EINVAL */
+	t1.tv_sec = -1;
+	ret = XENOMAI_SYSCALL4(sc_nr, &mon, COBALT_MONITOR_WAITGRANT, &t1,
+			       NULL);
+	if (!smokey_assert(ret == -EINVAL))
+		return ret ? ret : -EINVAL;
+
+	/*
+	 * Providing a valid timeout, waiting for it to time out and check
+	 * that we didn't come back to early.
+	 */
+	ret = clock_gettime(CLOCK_REALTIME, &ts_nat);
+	if (ret)
+		return -errno;
+
+	t1.tv_sec = ts_nat.tv_sec;
+	t1.tv_nsec = ts_nat.tv_nsec;
+
+	to = t1;
+	ts_add_ns(&to, 50000);
+
+	ret = XENOMAI_SYSCALL4(sc_nr, &mon, COBALT_MONITOR_WAITGRANT, &to,
+			       &opret);
+	if (!smokey_assert(opret == -ETIMEDOUT))
+		return ret;
+
+	ret = clock_gettime(CLOCK_REALTIME, &ts_nat);
+	if (ret)
+		return -errno;
+
+	t2.tv_sec = ts_nat.tv_sec;
+	t2.tv_nsec = ts_nat.tv_nsec;
+
+	if (ts_less(&t2, &to))
+		smokey_warning("monitor_wait64 returned too early!\n"
+			       "Expected wakeup at: %lld sec %lld nsec\n"
+			       "Back at           : %lld sec %lld nsec\n",
+			       to.tv_sec, to.tv_nsec, t2.tv_sec, t2.tv_nsec);
+
+	return 0;
+}
+
 static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 {
 	int ret;
@@ -888,5 +960,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])
 	if (ret)
 		return ret;
 
+	ret = test_sc_cobalt_monitor_wait64();
+	if (ret)
+		return ret;
+
 	return 0;
 }
-- 
2.30.2



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

end of thread, other threads:[~2021-08-23 15:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 13:36 [PATCH v2 0/3] y2038: Adding event_wait64() Florian Bezdeka
2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/event: Adding event_wait64 Florian Bezdeka
2021-08-11 13:36 ` [PATCH v2 1/3] y2038: cobalt/posix/monitor: Adding monitor_wait64 Florian Bezdeka
2021-08-11 13:40   ` Bezdeka, Florian
2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch event_wait Florian Bezdeka
2021-08-11 13:36 ` [PATCH v2 2/3] y2038: lib/cobalt/internal: dispatch monitor_wait Florian Bezdeka
2021-08-11 13:41   ` Bezdeka, Florian
2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64() Florian Bezdeka
2021-08-11 13:42   ` Bezdeka, Florian
2021-08-11 13:36 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding tests for event_wait64 Florian Bezdeka
2021-08-12  7:02 ` [PATCH v2 0/3] y2038: Adding event_wait64() chensong_2000
2021-08-23 15:43   ` Bezdeka, Florian
  -- strict thread matches above, loose matches on Subject: below --
2021-08-11  8:11 [PATCH v2 0/3] y2038: Adding monitor_wait64() Florian Bezdeka
2021-08-11  8:11 ` [PATCH v2 3/3] y2038: testsuite/smokey/y2038: Adding testcases for monitor_wait64() Florian Bezdeka

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.