xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] I-pipe house cleaning
@ 2023-09-03 15:04 Jan Kiszka
  2023-09-03 15:04 ` [PATCH 01/20] cobalt: Drop self element from lostage_signal Jan Kiszka
                   ` (19 more replies)
  0 siblings, 20 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

Initially, I just ran into the "Revisit: I-pipe requirement" comment on
the lostage_signal self field. But then I did a systematic search for
i[-]pipe and found way more. This is the result which should only make
things (minimally) faster and otherwise simply remove now dead code.

Jan

Jan Kiszka (20):
  cobalt: Drop self element from lostage_signal
  drivers/udd: Drop self element from irqswitch_work
  cobalt: Drop not longer supported CONFIG_XENO_OPT_STATS_IRQS
  testsuite/smokey/y2038: Activate minimal clock_settime64
  testsuite/clocktest: Drop obsolete CLOCK_HOST_REALTIME and wallclock
    offset bits
  testsuite/smokey: Remove VDSO test
  lib/cobalt: Drop legacy_tsc code for I-pipe
  lib/cobalt: Drop tsc.h
  cobalt/uapi: Drop tsc.h
  lib/cobalt: Drop VDSO support
  kernel/cobalt: Remove archcall syscall stub
  kernel/cobalt: Retire clock_freq field in cobalt_featinfo
  kernel/cobalt: Remove VDSO support
  testsuite/smokey/rtdm: Remove dead code
  lib/cobalt: Refactor cobalt_read_tsc API to cobalt_read_ns
  lib/copperplate: Refactor clockobj_get_tsc API to clockobj_get_ns
  scripts/Kconfig.frag: Switch to I-pipe only
  include/cobalt: Fix inclusion guard names
  ci: Update comment
  cobalt/posix: Update comment

 .gitlab-ci.yml                                |   2 +-
 configure.ac                                  |   1 -
 include/cobalt/kernel/Makefile.am             |   1 -
 .../kernel/dovetail/pipeline/pipeline.h       |   5 -
 .../cobalt/kernel/dovetail/pipeline/tick.h    |   6 +-
 include/cobalt/kernel/intr.h                  |  30 -----
 include/cobalt/kernel/thread.h                |   1 -
 include/cobalt/kernel/vdso.h                  |  49 -------
 include/cobalt/sys/cobalt.h                   |   3 +-
 include/cobalt/ticks.h                        |  49 -------
 include/cobalt/uapi/asm-generic/features.h    |   8 +-
 include/cobalt/uapi/kernel/Makefile.am        |   4 +-
 include/cobalt/uapi/kernel/urw.h              | 113 ----------------
 include/cobalt/uapi/kernel/vdso.h             |  66 ----------
 include/cobalt/uapi/syscall.h                 |   2 +-
 include/copperplate/clockobj.h                |  35 +----
 kernel/cobalt/Kconfig                         |  12 --
 .../arch/arm/include/asm/xenomai/syscall.h    |   9 --
 .../arm/include/asm/xenomai/uapi/features.h   |   1 -
 .../arch/arm/include/asm/xenomai/uapi/tsc.h   |  25 ----
 .../arch/arm64/include/asm/xenomai/syscall.h  |   9 --
 .../arm64/include/asm/xenomai/uapi/features.h |   2 -
 .../arch/arm64/include/asm/xenomai/uapi/tsc.h |  25 ----
 .../arch/x86/include/asm/xenomai/syscall.h    |   8 --
 .../x86/include/asm/xenomai/uapi/features.h   |   1 -
 kernel/cobalt/clock.c                         |   2 -
 kernel/cobalt/dovetail/kevents.c              |   1 -
 kernel/cobalt/init.c                          |   1 -
 kernel/cobalt/posix/memory.c                  |  21 ---
 kernel/cobalt/posix/process.c                 |   5 +-
 kernel/cobalt/posix/syscall.c                 |  12 --
 kernel/cobalt/sched.c                         |  51 +------
 kernel/cobalt/thread.c                        |   6 -
 kernel/cobalt/trace/cobalt-posix.h            |   1 -
 kernel/drivers/udd/udd.c                      |   4 +-
 lib/cobalt/arch/arm/features.c                |  46 -------
 .../arch/arm/include/asm/xenomai/Makefile.am  |   3 +-
 lib/cobalt/arch/arm/include/asm/xenomai/tsc.h |  48 -------
 lib/cobalt/arch/arm64/features.c              |  42 ------
 .../arm64/include/asm/xenomai/Makefile.am     |   3 +-
 .../arch/arm64/include/asm/xenomai/tsc.h      |  54 --------
 .../arch/x86/include/asm/xenomai/Makefile.am  |   3 +-
 lib/cobalt/arch/x86/include/asm/xenomai/tsc.h |  38 ------
 lib/cobalt/clock.c                            | 124 +++---------------
 lib/cobalt/init.c                             |   4 +-
 lib/cobalt/internal.c                         |   6 +-
 lib/cobalt/internal.h                         |   2 +-
 lib/cobalt/ticks.c                            |  70 +---------
 lib/cobalt/umm.c                              |  14 +-
 lib/cobalt/umm.h                              |   6 +-
 lib/copperplate/clockobj.c                    |   8 +-
 lib/copperplate/threadobj.c                   |   4 +-
 lib/psos/tm.c                                 |   2 +-
 scripts/Kconfig.frag                          |   6 +-
 testsuite/clocktest/clocktest.c               |  64 +--------
 testsuite/smokey/Makefile.am                  |   2 -
 testsuite/smokey/arith/arith.c                |   6 +-
 testsuite/smokey/posix-cond/posix-cond.c      |  46 +++----
 testsuite/smokey/rtdm/rtdm.c                  |  12 --
 testsuite/smokey/tsc/tsc.c                    |  37 +-----
 testsuite/smokey/vdso-access/Makefile.am      |   9 --
 testsuite/smokey/vdso-access/vdso-access.c    |  31 -----
 testsuite/smokey/y2038/syscall-tests.c        |  30 -----
 63 files changed, 99 insertions(+), 1192 deletions(-)
 delete mode 100644 include/cobalt/kernel/vdso.h
 delete mode 100644 include/cobalt/uapi/kernel/urw.h
 delete mode 100644 include/cobalt/uapi/kernel/vdso.h
 delete mode 100644 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/tsc.h
 delete mode 100644 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/tsc.h
 delete mode 100644 lib/cobalt/arch/arm/include/asm/xenomai/tsc.h
 delete mode 100644 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
 delete mode 100644 lib/cobalt/arch/x86/include/asm/xenomai/tsc.h
 delete mode 100644 testsuite/smokey/vdso-access/Makefile.am
 delete mode 100644 testsuite/smokey/vdso-access/vdso-access.c

-- 
2.35.3


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

* [PATCH 01/20] cobalt: Drop self element from lostage_signal
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 02/20] drivers/udd: Drop self element from irqswitch_work Jan Kiszka
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This was only needed for I-pipe which was dropped.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/kernel/thread.h | 1 -
 kernel/cobalt/thread.c         | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index b79cb84296..7f9a37d29a 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -62,7 +62,6 @@ struct lostage_signal {
 	struct pipeline_inband_work inband_work; /* Must be first. */
 	struct task_struct *task;
 	int signo, sigval;
-	struct lostage_signal *self; /* Revisit: I-pipe requirement */
 };
 
 struct xnthread_init_attr {
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 41804b24fc..cf3b4dbb0e 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -2162,11 +2162,6 @@ static void lostage_task_signal(struct pipeline_inband_work *inband_work)
 	spl_t s;
 
 	rq = container_of(inband_work, struct lostage_signal, inband_work);
-	/*
-	 * Revisit: I-pipe requirement. It passes a copy of the original work
-	 * struct, so retrieve the original one first in order to update is.
-	 */
-	rq = rq->self;
 
 	xnlock_get_irqsave(&nklock, s);
 
@@ -2396,7 +2391,6 @@ void __xnthread_signal(struct xnthread *thread, int sig, int arg)
 	sigwork->task = xnthread_host_task(thread);
 	sigwork->signo = sig;
 	sigwork->sigval = sig == SIGDEBUG ? arg | sigdebug_marker : arg;
-	sigwork->self = sigwork; /* Revisit: I-pipe requirement */
 
 	trace_cobalt_lostage_request("signal", sigwork->task);
 
-- 
2.35.3


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

* [PATCH 02/20] drivers/udd: Drop self element from irqswitch_work
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
  2023-09-03 15:04 ` [PATCH 01/20] cobalt: Drop self element from lostage_signal Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 03/20] cobalt: Drop not longer supported CONFIG_XENO_OPT_STATS_IRQS Jan Kiszka
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This was only needed for I-pipe which was dropped.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 kernel/drivers/udd/udd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/drivers/udd/udd.c b/kernel/drivers/udd/udd.c
index 958208ec7e..b1efcebd0f 100644
--- a/kernel/drivers/udd/udd.c
+++ b/kernel/drivers/udd/udd.c
@@ -520,7 +520,6 @@ struct irqswitch_work {
 	rtdm_irq_t *irqh;
 	int enabled;
 	rtdm_event_t *done;
-	struct irqswitch_work *self; /* Revisit: I-pipe requirement */
 };
 
 static void lostage_irqswitch_line(struct pipeline_inband_work *inband_work)
@@ -540,7 +539,7 @@ static void lostage_irqswitch_line(struct pipeline_inband_work *inband_work)
 	if (rq->done)
 		rtdm_event_signal(rq->done);
 
-	xnfree(rq->self);
+	xnfree(rq);
 }
 
 static void switch_irq_line(rtdm_irq_t *irqh, int enable, rtdm_event_t *done)
@@ -556,7 +555,6 @@ static void switch_irq_line(rtdm_irq_t *irqh, int enable, rtdm_event_t *done)
 	rq->irqh = irqh;
 	rq->enabled = enable;
 	rq->done = done;
-	rq->self = rq;	/* Revisit: I-pipe requirement */
 
 	/*
 	 * Not pretty, but we may not traverse the kernel code for
-- 
2.35.3


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

* [PATCH 03/20] cobalt: Drop not longer supported CONFIG_XENO_OPT_STATS_IRQS
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
  2023-09-03 15:04 ` [PATCH 01/20] cobalt: Drop self element from lostage_signal Jan Kiszka
  2023-09-03 15:04 ` [PATCH 02/20] drivers/udd: Drop self element from irqswitch_work Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64 Jan Kiszka
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This was I-pipe-only, and I-pipe is gone.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/kernel/intr.h | 30 ---------------------
 kernel/cobalt/Kconfig        | 12 ---------
 kernel/cobalt/sched.c        | 51 ++----------------------------------
 3 files changed, 2 insertions(+), 91 deletions(-)

diff --git a/include/cobalt/kernel/intr.h b/include/cobalt/kernel/intr.h
index 393ad96830..060edc8a57 100644
--- a/include/cobalt/kernel/intr.h
+++ b/include/cobalt/kernel/intr.h
@@ -84,10 +84,6 @@ struct xnintr {
 	const char *name;
 	/** Descriptor maintenance lock. */
 	raw_spinlock_t lock;
-#ifdef CONFIG_XENO_OPT_STATS_IRQS
-	/** Statistics. */
-	struct xnirqstat *stats;
-#endif
 };
 
 struct xnintr_iterator {
@@ -126,32 +122,6 @@ void xnintr_disable(struct xnintr *intr);
 
 int xnintr_affinity(struct xnintr *intr, const cpumask_t *cpumask);
 
-#ifdef CONFIG_XENO_OPT_STATS_IRQS
-
-int xnintr_query_init(struct xnintr_iterator *iterator);
-
-int xnintr_get_query_lock(void);
-
-void xnintr_put_query_lock(void);
-
-int xnintr_query_next(int irq, struct xnintr_iterator *iterator,
-		      char *name_buf);
-
-#else /* !CONFIG_XENO_OPT_STATS_IRQS */
-
-static inline int xnintr_query_init(struct xnintr_iterator *iterator)
-{
-	return 0;
-}
-
-static inline int xnintr_get_query_lock(void)
-{
-	return 0;
-}
-
-static inline void xnintr_put_query_lock(void) {}
-#endif /* !CONFIG_XENO_OPT_STATS_IRQS */
-
 /** @} */
 
 #endif /* !_COBALT_KERNEL_INTR_H */
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index 3233de1b18..6ba4cdc5db 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -135,18 +135,6 @@ config XENO_OPT_STATS
 	per-thread runtime statistics, which are accessible through
 	the /proc/xenomai/sched/stat interface.
 
-config XENO_OPT_STATS_IRQS
-	bool "Account IRQ handlers separatly"
-	depends on XENO_OPT_STATS && IPIPE
-	default y
-	help
-	When enabled, the runtime of interrupt handlers is accounted
-	separately from the threads they interrupt. Also, the
-	occurrence of shared interrupts is accounted on a per-handler
-	basis.
-
-	This option is available to legacy I-pipe builds only.
-
 config XENO_OPT_SHIRQ
 	bool "Shared interrupts"
 	help
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index aa65fd7f5d..62db291a71 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -1121,11 +1121,6 @@ static spl_t vfile_schedstat_lock_s;
 
 static int vfile_schedstat_get_lock(struct xnvfile *vfile)
 {
-	int ret;
-
-	ret = xnintr_get_query_lock();
-	if (ret < 0)
-		return ret;
 	xnlock_get_irqsave(&nklock, vfile_schedstat_lock_s);
 	return 0;
 }
@@ -1133,7 +1128,6 @@ static int vfile_schedstat_get_lock(struct xnvfile *vfile)
 static void vfile_schedstat_put_lock(struct xnvfile *vfile)
 {
 	xnlock_put_irqrestore(&nklock, vfile_schedstat_lock_s);
-	xnintr_put_query_lock();
 }
 
 static struct xnvfile_lock_ops vfile_schedstat_lockops = {
@@ -1177,7 +1171,6 @@ static struct xnvfile_snapshot schedstat_vfile = {
 static int vfile_schedstat_rewind(struct xnvfile_snapshot_iterator *it)
 {
 	struct vfile_schedstat_priv *priv = xnvfile_iterator_priv(it);
-	int irqnr;
 
 	/*
 	 * The activity numbers on each valid interrupt descriptor are
@@ -1185,9 +1178,8 @@ static int vfile_schedstat_rewind(struct xnvfile_snapshot_iterator *it)
 	 */
 	priv->curr = list_first_entry(&nkthreadq, struct xnthread, glink);
 	priv->irq = 0;
-	irqnr = xnintr_query_init(&priv->intr_it) * num_online_cpus();
 
-	return irqnr + cobalt_nrthreads;
+	return cobalt_nrthreads;
 }
 
 static int vfile_schedstat_next(struct xnvfile_snapshot_iterator *it,
@@ -1201,11 +1193,7 @@ static int vfile_schedstat_next(struct xnvfile_snapshot_iterator *it,
 	int __maybe_unused ret;
 
 	if (priv->curr == NULL)
-		/*
-		 * We are done with actual threads, scan interrupt
-		 * descriptors.
-		 */
-		goto scan_irqs;
+		return 0; /* We are done. */
 
 	thread = priv->curr;
 	if (list_is_last(&thread->glink, &nkthreadq))
@@ -1242,41 +1230,6 @@ static int vfile_schedstat_next(struct xnvfile_snapshot_iterator *it,
 	thread->stat.lastperiod.start = sched->last_account_switch;
 
 	return 1;
-
-scan_irqs:
-#ifdef CONFIG_XENO_OPT_STATS_IRQS
-	if (priv->irq >= PIPELINE_NR_IRQS)
-		return 0;	/* All done. */
-
-	ret = xnintr_query_next(priv->irq, &priv->intr_it, p->name);
-	if (ret) {
-		if (ret == -EAGAIN)
-			xnvfile_touch(it->vfile); /* force rewind. */
-		priv->irq++;
-		return VFILE_SEQ_SKIP;
-	}
-
-	if (!xnsched_supported_cpu(priv->intr_it.cpu))
-		return VFILE_SEQ_SKIP;
-
-	p->cpu = priv->intr_it.cpu;
-	p->csw = priv->intr_it.hits;
-	p->exectime_period = priv->intr_it.exectime_period;
-	p->account_period = priv->intr_it.account_period;
-	p->exectime_total = priv->intr_it.exectime_total;
-	p->pid = 0;
-	p->state =  0;
-	p->ssw = 0;
-	p->xsc = 0;
-	p->pf = 0;
-	p->sched_class = &xnsched_class_idle;
-	p->cprio = 0;
-	p->period = 0;
-
-	return 1;
-#else /* !CONFIG_XENO_OPT_STATS_IRQS */
-	return 0;
-#endif /* !CONFIG_XENO_OPT_STATS_IRQS */
 }
 
 static int vfile_schedstat_show(struct xnvfile_snapshot_iterator *it,
-- 
2.35.3


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

* [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (2 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 03/20] cobalt: Drop not longer supported CONFIG_XENO_OPT_STATS_IRQS Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-04  7:12   ` Florian Bezdeka
  2023-09-03 15:04 ` [PATCH 05/20] testsuite/clocktest: Drop obsolete CLOCK_HOST_REALTIME and wallclock offset bits Jan Kiszka
                   ` (15 subsequent siblings)
  19 siblings, 1 reply; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

The clock_settime64 syscall is theoretically still relevant, even with
libc-based settime for standard clocks, but only for external clocks -
which we do not have in-tree. But we can at least check that invalid
parameters are detected and rejected

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 testsuite/smokey/y2038/syscall-tests.c | 30 --------------------------
 1 file changed, 30 deletions(-)

diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
index 0c7de52161..3d4a9106bd 100644
--- a/testsuite/smokey/y2038/syscall-tests.c
+++ b/testsuite/smokey/y2038/syscall-tests.c
@@ -278,18 +278,9 @@ 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;
-
-	if (!cobalt_use_legacy_tsc())
-		return 0; // Not implemented, nothing to test, success
 
 	/* 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;
 
@@ -298,27 +289,6 @@ static int test_sc_cobalt_clock_settime64(void)
 	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 = 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;
 }
 
-- 
2.35.3


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

* [PATCH 05/20] testsuite/clocktest: Drop obsolete CLOCK_HOST_REALTIME and wallclock offset bits
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (3 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64 Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 06/20] testsuite/smokey: Remove VDSO test Jan Kiszka
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This clock was retired with the removal of I-pipe support. Along with
it, wallclock offset support became obsolete.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 testsuite/clocktest/clocktest.c | 64 ++-------------------------------
 1 file changed, 2 insertions(+), 62 deletions(-)

diff --git a/testsuite/clocktest/clocktest.c b/testsuite/clocktest/clocktest.c
index c524f42fb7..c2b9ee5f43 100644
--- a/testsuite/clocktest/clocktest.c
+++ b/testsuite/clocktest/clocktest.c
@@ -31,11 +31,8 @@
 #include <sys/time.h>
 #include <boilerplate/ancillaries.h>
 #include <boilerplate/atomic.h>
-#include <cobalt/uapi/kernel/vdso.h>
 #include <xeno_config.h>
 
-extern struct xnvdso *cobalt_vdso;
-
 /*
  * We can't really trust POSIX headers to check for features, since
  * some archs may not implement all of the declared uClibc POSIX
@@ -67,44 +64,6 @@ struct per_cpu_data {
 	pthread_t thread;
 } *per_cpu_data;
 
-static void show_hostrt_diagnostics(void)
-{
-	if (!xnvdso_test_feature(cobalt_vdso, XNVDSO_FEAT_HOST_REALTIME)) {
-		printf("XNVDSO_FEAT_HOST_REALTIME not available\n");
-		return;
-	}
-
-	if (cobalt_vdso->hostrt_data.live)
-		printf("hostrt data area is live\n");
-	else {
-		printf("hostrt data area is not live\n");
-		return;
-	}
-
-	printf("sequence counter : %u\n",
-	       cobalt_vdso->hostrt_data.lock.sequence);
-	printf("wall_time_sec    : %lld\n",
-	       (unsigned long long)cobalt_vdso->hostrt_data.wall_sec);
-	printf("wall_time_nsec   : %u\n", cobalt_vdso->hostrt_data.wall_nsec);
-	printf("wall_to_monotonic_sec    : %lld\n",
-	       (unsigned long long)cobalt_vdso->hostrt_data.wtom_sec);
-	printf("wall_to_monotonic_nsec   : %u\n", cobalt_vdso->hostrt_data.wtom_nsec);
-	printf("cycle_last       : %Lu\n", (long long)cobalt_vdso->hostrt_data.cycle_last);
-	printf("mask             : 0x%Lx\n", (long long)cobalt_vdso->hostrt_data.mask);
-	printf("mult             : %u\n", cobalt_vdso->hostrt_data.mult);
-	printf("shift            : %u\n\n", cobalt_vdso->hostrt_data.shift);
-}
-
-static void show_realtime_offset(void)
-{
-	if (!xnvdso_test_feature(cobalt_vdso, XNVDSO_FEAT_HOST_REALTIME)) {
-		printf("XNVDSO_FEAT_WALLCLOCK_OFFSET not available\n");
-		return;
-	}
-
-	printf("Wallclock offset : %llu\n", (long long)cobalt_vdso->wallclock_offset);
-}
-
 static inline uint64_t read_clock(clockid_t clock_id)
 {
 	struct timespec ts;
@@ -114,11 +73,6 @@ static inline uint64_t read_clock(clockid_t clock_id)
 	if (res != 0) {
 		fprintf(stderr, "clock_gettime failed for clock id %d\n",
 			clock_id);
-		if (clock_id == CLOCK_HOST_REALTIME)
-			show_hostrt_diagnostics();
-		else if (clock_id == CLOCK_REALTIME)
-			show_realtime_offset();
-
 		exit(-1);
 	}
 	return ts.tv_nsec + ts.tv_sec * 1000000000ULL;
@@ -249,9 +203,6 @@ static clockid_t resolve_clock_name(const char *name,
 			case CLOCK_MONOTONIC_RAW:
 				*real_name = "CLOCK_MONOTONIC_RAW";
 				break;
-			case CLOCK_HOST_REALTIME:
-				*real_name = "CLOCK_HOST_REALTIME";
-				break;
 			default:
 				error(1, EINVAL, "bad built-in clock id '%d'",
 				      clock_id);
@@ -264,8 +215,6 @@ static clockid_t resolve_clock_name(const char *name,
 			return CLOCK_MONOTONIC;
 		if (strcmp(name, "CLOCK_MONOTONIC_RAW") == 0)
 			return CLOCK_MONOTONIC_RAW;
-		if (strcmp(name, "CLOCK_HOST_REALTIME") == 0)
-			return CLOCK_HOST_REALTIME;
 		if (strcmp(name, "coreclk") == 0) {
 			/* Read the core clock as CLOCK_MONOTONIC_RAW */
 			*real_name = "CLOCK_MONOTONIC_RAW";
@@ -303,10 +252,9 @@ int main(int argc, char *argv[])
 	int max_cpu, cpus;
 	int i;
 	int c;
-	int d = 0;
 	int ext = 0;
 
-	while ((c = getopt(argc, argv, "C:ET:D")) != EOF)
+	while ((c = getopt(argc, argv, "C:ET:")) != EOF)
 		switch (c) {
 		case 'C':
 			clock_name = optarg;
@@ -320,16 +268,11 @@ int main(int argc, char *argv[])
 			alarm(atoi(optarg));
 			break;
 
-		case 'D':
-			d = 1;
-			break;
-
 		default:
 			fprintf(stderr, "usage: clocktest [options]\n"
 				"  [-C <clock_id|clock_name>]   # tested clock, defaults to CLOCK_REALTIME\n"
 				"  [-E]                         # -C specifies extension clock\n"
-				"  [-T <test_duration_seconds>] # default=0, so ^C to end\n"
-				"  [-D]                         # print extra diagnostics for CLOCK_HOST_REALTIME\n");
+				"  [-T <test_duration_seconds>] # default=0, so ^C to end\n");
 			exit(2);
 		}
 
@@ -340,9 +283,6 @@ int main(int argc, char *argv[])
 
 	init_lock(&lock);
 
-	if (d && clock_id == CLOCK_HOST_REALTIME)
-		show_hostrt_diagnostics();
-
 	if (get_realtime_cpu_set(&cpu_realtime_set) != 0)
 		error(1, ENOSYS, "get_realtime_cpu_set");
 
-- 
2.35.3


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

* [PATCH 06/20] testsuite/smokey: Remove VDSO test
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (4 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 05/20] testsuite/clocktest: Drop obsolete CLOCK_HOST_REALTIME and wallclock offset bits Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 07/20] lib/cobalt: Drop legacy_tsc code for I-pipe Jan Kiszka
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

The Xenomai VDSO is about to be removed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 configure.ac                               |  1 -
 testsuite/smokey/Makefile.am               |  2 --
 testsuite/smokey/vdso-access/Makefile.am   |  9 -------
 testsuite/smokey/vdso-access/vdso-access.c | 31 ----------------------
 4 files changed, 43 deletions(-)
 delete mode 100644 testsuite/smokey/vdso-access/Makefile.am
 delete mode 100644 testsuite/smokey/vdso-access/vdso-access.c

diff --git a/configure.ac b/configure.ac
index a601f94cd3..86dd8ba4f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1015,7 +1015,6 @@ AC_CONFIG_FILES([ \
 	testsuite/smokey/sched-tp/Makefile \
 	testsuite/smokey/setsched/Makefile \
 	testsuite/smokey/rtdm/Makefile \
-	testsuite/smokey/vdso-access/Makefile \
 	testsuite/smokey/posix-cond/Makefile \
 	testsuite/smokey/posix-mutex/Makefile \
 	testsuite/smokey/posix-clock/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b7654682d5..c49a5d77f0 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -38,7 +38,6 @@ COBALT_SUBDIRS = 	\
 	sigdebug	\
 	timerfd		\
 	tsc		\
-	vdso-access 	\
 	xddp		\
 	y2038		\
 	alchemytests	\
@@ -84,7 +83,6 @@ DIST_SUBDIRS = 		\
 	sigdebug	\
 	timerfd		\
 	tsc		\
-	vdso-access 	\
 	xddp		\
 	y2038		\
 	alchemytests	\
diff --git a/testsuite/smokey/vdso-access/Makefile.am b/testsuite/smokey/vdso-access/Makefile.am
deleted file mode 100644
index 250ef08400..0000000000
--- a/testsuite/smokey/vdso-access/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-noinst_LIBRARIES = libvdso-access.a
-
-libvdso_access_a_SOURCES = vdso-access.c
-
-libvdso_access_a_CPPFLAGS = 	\
-	@XENO_USER_CFLAGS@	\
-	-I$(top_srcdir)		\
-	-I$(top_srcdir)/include
diff --git a/testsuite/smokey/vdso-access/vdso-access.c b/testsuite/smokey/vdso-access/vdso-access.c
deleted file mode 100644
index 42c1b28f72..0000000000
--- a/testsuite/smokey/vdso-access/vdso-access.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * VDSO feature set testcase
- * by Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
- */
-#include <stdio.h>
-#include <time.h>
-#include <boilerplate/atomic.h>
-#include <cobalt/uapi/kernel/vdso.h>
-#include <smokey/smokey.h>
-
-smokey_test_plugin(vdso_access,
-		   SMOKEY_NOARGS,
-		   "Check VDSO access."
-);
-
-extern void *cobalt_umm_shared;
-
-extern struct xnvdso *cobalt_vdso;
-
-int run_vdso_access(struct smokey_test *t, int argc, char *const argv[])
-{
-	if (cobalt_umm_shared == NULL) {
-		warning("could not determine position of the VDSO segment");
-		return 1;
-	}
-
-	smokey_trace("VDSO: features detected: %llx",
-		     (long long)cobalt_vdso->features);
-
-	return 0;
-}
-- 
2.35.3


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

* [PATCH 07/20] lib/cobalt: Drop legacy_tsc code for I-pipe
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (5 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 06/20] testsuite/smokey: Remove VDSO test Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 08/20] lib/cobalt: Drop tsc.h Jan Kiszka
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

With I-pipe support removed, cobalt_use_legacy_tsc is now always false
because the kernel will report 0 as clock_freq. Drop code that was
guarded by this runtime check. This obsoletes XNARCH_HAVE_LLMULSHFT.
Furthermoe fold gettime_via_vdso directly into clock_gettime as the only
possible case now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/ticks.h                        |  31 -----
 .../arm/include/asm/xenomai/uapi/features.h   |   1 -
 .../arm64/include/asm/xenomai/uapi/features.h |   2 -
 .../x86/include/asm/xenomai/uapi/features.h   |   1 -
 lib/cobalt/arch/arm/features.c                |  46 -------
 lib/cobalt/arch/arm64/features.c              |  42 ------
 lib/cobalt/clock.c                            | 124 +++---------------
 lib/cobalt/init.c                             |   2 +-
 lib/cobalt/internal.c                         |   4 -
 lib/cobalt/internal.h                         |   2 +-
 lib/cobalt/ticks.c                            |  70 +---------
 11 files changed, 28 insertions(+), 297 deletions(-)

diff --git a/include/cobalt/ticks.h b/include/cobalt/ticks.h
index e59d86d499..fe5a6ac21a 100644
--- a/include/cobalt/ticks.h
+++ b/include/cobalt/ticks.h
@@ -21,56 +21,25 @@
 #include <stdbool.h>
 #include <cobalt/uapi/kernel/types.h>
 
-/*
- * Depending on the underlying pipeline support, we may represent time
- * stamps as count of nanoseconds (Dovetail), or as values of the
- * hardware tick counter (aka TSC) available with the platform
- * (I-pipe). In the latter - legacy - case, we need to convert from
- * TSC values to nanoseconds and conversely via scaled maths. This
- * indirection will go away once support for the I-pipe is removed.
- */
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern unsigned long long __cobalt_tsc_clockfreq;
-
-static inline bool cobalt_use_legacy_tsc(void)
-{
-	return !!__cobalt_tsc_clockfreq;
-}
-
-xnsticks_t __cobalt_tsc_to_ns(xnsticks_t ticks);
-
-xnsticks_t __cobalt_tsc_to_ns_rounded(xnsticks_t ticks);
-
-xnsticks_t __cobalt_ns_to_tsc(xnsticks_t ns);
-
 static inline
 xnsticks_t cobalt_ns_to_ticks(xnsticks_t ns)
 {
-	if (cobalt_use_legacy_tsc())
-		return __cobalt_ns_to_tsc(ns);
-
 	return ns;
 }
 
 static inline
 xnsticks_t cobalt_ticks_to_ns(xnsticks_t ticks)
 {
-	if (cobalt_use_legacy_tsc())
-		return __cobalt_tsc_to_ns(ticks);
-
 	return ticks;
 }
 
 static inline
 xnsticks_t cobalt_ticks_to_ns_rounded(xnsticks_t ticks)
 {
-	if (cobalt_use_legacy_tsc())
-		return __cobalt_tsc_to_ns_rounded(ticks);
-
 	return ticks;
 }
 
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
index fdd5c0e327..4a87c67329 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/features.h
@@ -28,7 +28,6 @@
 
 #define XENOMAI_FEAT_MAN (__xn_feat_generic_man_mask)
 
-#define XNARCH_HAVE_LLMULSHFT    1
 #define XNARCH_HAVE_NODIV_LLIMD  1
 
 struct cobalt_featinfo_archdep { /* no arch-specific feature */ };
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
index 301797748c..fba1db391b 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/features.h
@@ -28,8 +28,6 @@
 
 #define XENOMAI_FEAT_MAN (__xn_feat_generic_man_mask)
 
-#undef XNARCH_HAVE_LLMULSHFT
-
 #undef XNARCH_HAVE_NODIV_LLIMD
 
 struct cobalt_featinfo_archdep { /* no arch-specific feature */ };
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
index 045adf0c1c..554dc249cb 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/features.h
@@ -25,7 +25,6 @@
 
 #define XENOMAI_FEAT_MAN  __xn_feat_generic_man_mask
 
-#define XNARCH_HAVE_LLMULSHFT    1
 #define XNARCH_HAVE_NODIV_LLIMD  1
 
 struct cobalt_featinfo_archdep { /* no arch-specific feature */ };
diff --git a/lib/cobalt/arch/arm/features.c b/lib/cobalt/arch/arm/features.c
index b4eddaad46..c918861025 100644
--- a/lib/cobalt/arch/arm/features.c
+++ b/lib/cobalt/arch/arm/features.c
@@ -27,58 +27,12 @@
 #include <cobalt/wrappers.h>
 #include <cobalt/ticks.h>
 #include <asm/xenomai/syscall.h>
-#include <asm/xenomai/tsc.h>
 #include <asm/xenomai/features.h>
 #include <asm/xenomai/uapi/fptest.h>
 #include "internal.h"
 
-struct __xn_full_tscinfo __xn_tscinfo = {
-	.kinfo = {
-		.counter = NULL,
-	},
-};
-
 void cobalt_arch_check_features(struct cobalt_featinfo *finfo)
 {
-	unsigned long phys_addr;
-	unsigned page_size;
-	int err, fd;
-	void *addr;
-
-	if (!cobalt_use_legacy_tsc())
-		return;
-
-	if (__xn_tscinfo.kinfo.counter != NULL)
-		return;
-
-	err = XENOMAI_SYSCALL2(sc_cobalt_archcall,
-			       XENOMAI_SYSARCH_TSCINFO, &__xn_tscinfo.kinfo);
-	if (err)
-		early_panic("missing TSC emulation: %s",
-			     strerror(-err));
-
-	fd = __STD(open("/dev/mem", O_RDONLY | O_SYNC));
-	if (fd == -1)
-		early_panic("failed open(/dev/mem): %s", strerror(errno));
-
-	page_size = sysconf(_SC_PAGESIZE);
-
-	__xn_tscinfo.kuser_tsc_get =
-		(__xn_rdtsc_t *)(0xffff1004 -
-				((*(unsigned *)(0xffff0ffc) + 3) << 5));
-
-	phys_addr = (unsigned long)__xn_tscinfo.kinfo.counter;
-
-	addr = __STD(mmap(NULL, page_size, PROT_READ, MAP_SHARED,
-			  fd, phys_addr & ~(page_size - 1)));
-	if (addr == MAP_FAILED)
-		early_panic("failed mmap(/dev/mem): %s", strerror(errno));
-
-	__xn_tscinfo.kinfo.counter =
-		((volatile unsigned *)
-		 ((char *) addr + (phys_addr & (page_size - 1))));
-
-	__STD(close(fd));
 }
 
 int cobalt_fp_detect(void)
diff --git a/lib/cobalt/arch/arm64/features.c b/lib/cobalt/arch/arm64/features.c
index 5baabfb69d..044c95db30 100644
--- a/lib/cobalt/arch/arm64/features.c
+++ b/lib/cobalt/arch/arm64/features.c
@@ -27,54 +27,12 @@
 #include <cobalt/wrappers.h>
 #include <cobalt/ticks.h>
 #include <asm/xenomai/syscall.h>
-#include <asm/xenomai/tsc.h>
 #include <asm/xenomai/features.h>
 #include <asm/xenomai/uapi/fptest.h>
 #include "internal.h"
 
-struct __xn_full_tscinfo __xn_tscinfo = {
-	.kinfo = {
-		.counter = NULL,
-	},
-};
-
 void cobalt_arch_check_features(struct cobalt_featinfo *finfo)
 {
-	unsigned long phys_addr;
-	unsigned page_size;
-	int err, fd;
-	void *addr;
-
-	if (!cobalt_use_legacy_tsc())
-		return;
-
-	if (__xn_tscinfo.kinfo.counter != NULL)
-		return;
-
-	err = XENOMAI_SYSCALL2(sc_cobalt_archcall,
-			       XENOMAI_SYSARCH_TSCINFO, &__xn_tscinfo.kinfo);
-	if (err)
-		early_panic("missing TSC emulation: %s",
-			     strerror(-err));
-
-	fd = __STD(open("/dev/mem", O_RDONLY | O_SYNC));
-	if (fd == -1)
-		early_panic("failed open(/dev/mem): %s", strerror(errno));
-
-	page_size = sysconf(_SC_PAGESIZE);
-
-	phys_addr = (unsigned long)__xn_tscinfo.kinfo.counter;
-
-	addr = __STD(mmap(NULL, page_size, PROT_READ, MAP_SHARED,
-			  fd, phys_addr & ~(page_size - 1)));
-	if (addr == MAP_FAILED)
-		early_panic("failed mmap(/dev/mem): %s", strerror(errno));
-
-	__xn_tscinfo.kinfo.counter =
-		((volatile unsigned *)
-		 ((char *) addr + (phys_addr & (page_size - 1))));
-
-	__STD(close(fd));
 }
 
 int cobalt_fp_detect(void)
diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index dbfcd4d76d..377582cf37 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -29,7 +29,6 @@
 #include <cobalt/uapi/time.h>
 #include <cobalt/ticks.h>
 #include <asm/xenomai/syscall.h>
-#include <asm/xenomai/tsc.h>
 #include "umm.h"
 #include "internal.h"
 
@@ -115,45 +114,6 @@ COBALT_IMPL(int, clock_getres, (clockid_t clock_id, struct timespec *tp))
 	return 0;
 }
 
-static int __do_clock_host_realtime(struct timespec *ts)
-{
-	uint64_t now, base, mask, cycle_delta, nsec;
-	struct xnvdso_hostrt_data *hostrt_data;
-	uint32_t mult, shift;
-	unsigned long rem;
-	urwstate_t tmp;
-
-	if (!xnvdso_test_feature(cobalt_vdso, XNVDSO_FEAT_HOST_REALTIME))
-		return -1;
-
-	hostrt_data = &cobalt_vdso->hostrt_data;
-
-	if (!hostrt_data->live)
-		return -1;
-
-	/*
-	 * The following is essentially a verbatim copy of the
-	 * mechanism in the kernel.
-	 */
-	unsynced_read_block(&tmp, &hostrt_data->lock) {
-		now = cobalt_read_legacy_tsc();
-		base = hostrt_data->cycle_last;
-		mask = hostrt_data->mask;
-		mult = hostrt_data->mult;
-		shift = hostrt_data->shift;
-		ts->tv_sec = hostrt_data->wall_sec;
-		nsec = hostrt_data->wall_nsec;
-	}
-
-	cycle_delta = (now - base) & mask;
-	nsec += (cycle_delta * mult) >> shift;
-
-	ts->tv_sec += cobalt_divrem_billion(nsec, &rem);
-	ts->tv_nsec = rem;
-
-	return 0;
-}
-
 static int __do_clock_gettime(clockid_t clock_id, struct timespec *tp)
 {
 #ifdef __USE_TIME_BITS64
@@ -163,65 +123,6 @@ static int __do_clock_gettime(clockid_t clock_id, struct timespec *tp)
 #endif
 }
 
-static int gettime_via_tsc(clockid_t clock_id, struct timespec *tp)
-{
-	unsigned long rem;
-	xnticks_t ns;
-	int ret;
-
-	switch (clock_id) {
-	case CLOCK_HOST_REALTIME:
-		ret = __do_clock_host_realtime(tp);
-		break;
-	case CLOCK_MONOTONIC:
-	case CLOCK_MONOTONIC_RAW:
-		ns = cobalt_ticks_to_ns(cobalt_read_legacy_tsc());
-		tp->tv_sec = cobalt_divrem_billion(ns, &rem);
-		tp->tv_nsec = rem;
-		return 0;
-	case CLOCK_REALTIME:
-		ns = cobalt_ticks_to_ns(cobalt_read_legacy_tsc());
-		ns += cobalt_vdso->wallclock_offset;
-		tp->tv_sec = cobalt_divrem_billion(ns, &rem);
-		tp->tv_nsec = rem;
-		return 0;
-	default:
-		ret = __do_clock_gettime(clock_id, tp);
-	}
-
-	if (ret) {
-		errno = ret;
-		return -1;
-	}
-
-	return 0;
-}
-
-static int gettime_via_vdso(clockid_t clock_id, struct timespec *tp)
-{
-	int ret;
-
-	switch (clock_id) {
-	case CLOCK_REALTIME:
-	case CLOCK_HOST_REALTIME:
-		ret = __cobalt_vdso_gettime(CLOCK_REALTIME, tp);
-		break;
-	case CLOCK_MONOTONIC:
-	case CLOCK_MONOTONIC_RAW:
-		ret = __cobalt_vdso_gettime(clock_id, tp);
-		break;
-	default:
-		ret = __do_clock_gettime(clock_id, tp);
-	}
-
-	if (ret) {
-		errno = ret;
-		return -1;
-	}
-
-	return 0;
-}
-
 /**
  * Read the specified clock.
  *
@@ -253,10 +154,27 @@ static int gettime_via_vdso(clockid_t clock_id, struct timespec *tp)
  */
 COBALT_IMPL(int, clock_gettime, (clockid_t clock_id, struct timespec *tp))
 {
-	if (cobalt_use_legacy_tsc())
-		return gettime_via_tsc(clock_id, tp);
+	int ret;
 
-	return gettime_via_vdso(clock_id, tp);
+	switch (clock_id) {
+	case CLOCK_REALTIME:
+	case CLOCK_HOST_REALTIME:
+		ret = __cobalt_vdso_gettime(CLOCK_REALTIME, tp);
+		break;
+	case CLOCK_MONOTONIC:
+	case CLOCK_MONOTONIC_RAW:
+		ret = __cobalt_vdso_gettime(clock_id, tp);
+		break;
+	default:
+		ret = __do_clock_gettime(clock_id, tp);
+	}
+
+	if (ret) {
+		errno = ret;
+		return -1;
+	}
+
+	return 0;
 }
 
 /**
@@ -287,7 +205,7 @@ COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec *tp))
 {
 	int ret;
 
-	if (clock_id == CLOCK_REALTIME && !cobalt_use_legacy_tsc())
+	if (clock_id == CLOCK_REALTIME)
 		return __STD(clock_settime(CLOCK_REALTIME, tp));
 
 #ifdef __USE_TIME_BITS64
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index dcd63cad8e..58051a2f26 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -177,7 +177,7 @@ static void low_init(void)
 		early_panic("mlockall: %s", strerror(errno));
 
 	trace_me("memory locked");
-	cobalt_ticks_init(f->clock_freq);
+	cobalt_ticks_init();
 	cobalt_features_init(f);
 	cobalt_init_umm(f->vdso_offset);
 	trace_me("memory heaps mapped");
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index bf1e940b71..74b5bd8350 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -31,7 +31,6 @@
 #include <stdarg.h>
 #include <pthread.h>
 #include <asm/xenomai/syscall.h>
-#include <asm/xenomai/tsc.h>
 #include <cobalt/ticks.h>
 #include <cobalt/sys/cobalt.h>
 #include "internal.h"
@@ -581,9 +580,6 @@ unsigned long long cobalt_read_tsc(void)
 {
 	struct timespec ts;
 
-	if (cobalt_use_legacy_tsc())
-		return cobalt_read_legacy_tsc();
-
 	__cobalt_vdso_gettime(CLOCK_MONOTONIC, &ts);
 
 	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index 00f51fa23d..049ab3fc4d 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -82,7 +82,7 @@ void cobalt_print_init(void);
 
 void cobalt_print_init_atfork(void);
 
-void cobalt_ticks_init(unsigned long long freq);
+void cobalt_ticks_init(void);
 
 void cobalt_mutex_init(void);
 
diff --git a/lib/cobalt/ticks.c b/lib/cobalt/ticks.c
index 94e0c1b0d3..a6792389c8 100644
--- a/lib/cobalt/ticks.c
+++ b/lib/cobalt/ticks.c
@@ -17,12 +17,9 @@
  */
 #include <cobalt/arith.h>
 #include <cobalt/ticks.h>
-#include <asm/xenomai/tsc.h>
 #include <asm/xenomai/time.h>
 #include "internal.h"
 
-unsigned long long __cobalt_tsc_clockfreq;
-
 /*
  * If we have no fast path via the vDSO for reading timestamps, ask
  * the Cobalt core.
@@ -35,13 +32,8 @@ static int gettime_fallback(clockid_t clk_id, struct timespec *tp)
 int (*__cobalt_vdso_gettime)(clockid_t clk_id,
 			struct timespec *tp) = gettime_fallback;
 
-#ifdef XNARCH_HAVE_LLMULSHFT
-
-static unsigned int tsc_scale, tsc_shift;
-
 #ifdef XNARCH_HAVE_NODIV_LLIMD
 
-static struct xnarch_u32frac tsc_frac;
 static struct xnarch_u32frac bln_frac;
 
 unsigned long long cobalt_divrem_billion(unsigned long long value,
@@ -60,50 +52,8 @@ unsigned long long cobalt_divrem_billion(unsigned long long value,
 	return q;
 }
 
-xnsticks_t __cobalt_ns_to_tsc(xnsticks_t ns)
-{
-	return xnarch_nodiv_llimd(ns, tsc_frac.frac, tsc_frac.integ);
-}
-
 #else /* !XNARCH_HAVE_NODIV_LLIMD */
 
-xnsticks_t __cobalt_ns_to_tsc(xnsticks_t ns)
-{
-	return xnarch_llimd(ns, 1 << tsc_shift, tsc_scale);
-}
-
-#endif /* !XNARCH_HAVE_NODIV_LLIMD */
-
-xnsticks_t __cobalt_tsc_to_ns(xnsticks_t ticks)
-{
-	return xnarch_llmulshft(ticks, tsc_scale, tsc_shift);
-}
-
-xnsticks_t __cobalt_tsc_to_ns_rounded(xnsticks_t ticks)
-{
-	unsigned int shift = tsc_shift - 1;
-	return (xnarch_llmulshft(ticks, tsc_scale, shift) + 1) / 2;
-}
-
-#else  /* !XNARCH_HAVE_LLMULSHFT */
-
-xnsticks_t __cobalt_tsc_to_ns(xnsticks_t ticks)
-{
-	return xnarch_llimd(ticks, 1000000000, __cobalt_tsc_clockfreq);
-}
-
-xnsticks_t __cobalt_tsc_to_ns_rounded(xnsticks_t ticks)
-{
-	return (xnarch_llimd(ticks, 1000000000, __cobalt_tsc_clockfreq/2) + 1) / 2;
-}
-
-xnsticks_t __cobalt_ns_to_tsc(xnsticks_t ns)
-{
-	return xnarch_llimd(ns, __cobalt_tsc_clockfreq, 1000000000);
-}
-#endif /* !XNARCH_HAVE_LLMULSHFT */
-
-#ifndef XNARCH_HAVE_NODIV_LLIMD
 unsigned long long cobalt_divrem_billion(unsigned long long value,
 					 unsigned long *rem)
 {
@@ -112,22 +62,12 @@ unsigned long long cobalt_divrem_billion(unsigned long long value,
 }
 #endif /* !XNARCH_HAVE_NODIV_LLIMD */
 
-void cobalt_ticks_init(unsigned long long freq)
+void cobalt_ticks_init(void)
 {
-	__cobalt_tsc_clockfreq = freq;
-	if (freq) {
-#ifdef XNARCH_HAVE_LLMULSHFT
-		xnarch_init_llmulshft(1000000000, freq, &tsc_scale, &tsc_shift);
-#ifdef XNARCH_HAVE_NODIV_LLIMD
-		xnarch_init_u32frac(&tsc_frac, 1 << tsc_shift, tsc_scale);
-#endif
-#endif
-	} else {
-		void *vcall = cobalt_lookup_vdso(COBALT_VDSO_VERSION,
-						 COBALT_VDSO_GETTIME);
-		if (vcall)
-			__cobalt_vdso_gettime = vcall;
-	}
+	void *vcall = cobalt_lookup_vdso(COBALT_VDSO_VERSION,
+					 COBALT_VDSO_GETTIME);
+	if (vcall)
+		__cobalt_vdso_gettime = vcall;
 #ifdef XNARCH_HAVE_NODIV_LLIMD
 	xnarch_init_u32frac(&bln_frac, 1, 1000000000);
 #endif
-- 
2.35.3


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

* [PATCH 08/20] lib/cobalt: Drop tsc.h
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (6 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 07/20] lib/cobalt: Drop legacy_tsc code for I-pipe Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 09/20] cobalt/uapi: " Jan Kiszka
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

Was providing cobalt_read_legacy_tsc which is no longer used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../arch/arm/include/asm/xenomai/Makefile.am  |  3 +-
 lib/cobalt/arch/arm/include/asm/xenomai/tsc.h | 48 -----------------
 .../arm64/include/asm/xenomai/Makefile.am     |  3 +-
 .../arch/arm64/include/asm/xenomai/tsc.h      | 54 -------------------
 .../arch/x86/include/asm/xenomai/Makefile.am  |  3 +-
 lib/cobalt/arch/x86/include/asm/xenomai/tsc.h | 38 -------------
 6 files changed, 3 insertions(+), 146 deletions(-)
 delete mode 100644 lib/cobalt/arch/arm/include/asm/xenomai/tsc.h
 delete mode 100644 lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
 delete mode 100644 lib/cobalt/arch/x86/include/asm/xenomai/tsc.h

diff --git a/lib/cobalt/arch/arm/include/asm/xenomai/Makefile.am b/lib/cobalt/arch/arm/include/asm/xenomai/Makefile.am
index d308b06e62..a7dd090432 100644
--- a/lib/cobalt/arch/arm/include/asm/xenomai/Makefile.am
+++ b/lib/cobalt/arch/arm/include/asm/xenomai/Makefile.am
@@ -1,5 +1,4 @@
 
 noinst_HEADERS =	\
 	features.h	\
-	syscall.h	\
-	tsc.h
+	syscall.h
diff --git a/lib/cobalt/arch/arm/include/asm/xenomai/tsc.h b/lib/cobalt/arch/arm/include/asm/xenomai/tsc.h
deleted file mode 100644
index 2be4009d84..0000000000
--- a/lib/cobalt/arch/arm/include/asm/xenomai/tsc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <rpm@xenomai.org>.
- * Copyright (C) 2013 Gilles Chanteperdrix <gch@xenomai.org>.
- *
- * ARM port
- *   Copyright (C) 2005 Stelian Pop
- *
- * Copyright (C) 2007 Sebastian Smolorz <sesmo@gmx.net>
- *	Support for TSC emulation in user space for decrementing counters
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef _LIB_COBALT_ARM_TSC_H
-#define _LIB_COBALT_ARM_TSC_H
-
-#include <asm/xenomai/uapi/tsc.h>
-#include <asm/xenomai/features.h>
-
-/*
- * Putting kuser_tsc_get and kinfo.counter in the same struct results
- * in less operations in PIC code, thus optimizes.
- */
-typedef unsigned long long __xn_rdtsc_t(volatile unsigned *vaddr);
-struct __xn_full_tscinfo {
-	__xn_rdtsc_t *kuser_tsc_get;
-	struct __xn_tscinfo kinfo;
-};
-extern struct __xn_full_tscinfo __xn_tscinfo;
-
-static inline __attribute__((always_inline))
-unsigned long long cobalt_read_legacy_tsc(void)
-{
-	return __xn_tscinfo.kuser_tsc_get(__xn_tscinfo.kinfo.counter);
-}
-
-#endif /* !_LIB_COBALT_ARM_TSC_H */
diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/Makefile.am b/lib/cobalt/arch/arm64/include/asm/xenomai/Makefile.am
index d308b06e62..a7dd090432 100644
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/Makefile.am
+++ b/lib/cobalt/arch/arm64/include/asm/xenomai/Makefile.am
@@ -1,5 +1,4 @@
 
 noinst_HEADERS =	\
 	features.h	\
-	syscall.h	\
-	tsc.h
+	syscall.h
diff --git a/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h b/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
deleted file mode 100644
index e664adb07a..0000000000
--- a/lib/cobalt/arch/arm64/include/asm/xenomai/tsc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2001,2002,2003,2004 Philippe Gerum <rpm@xenomai.org>.
- * Copyright (C) 2013 Gilles Chanteperdrix <gch@xenomai.org>.
- *
- * ARM port
- *   Copyright (C) 2005 Stelian Pop
- *
- * Copyright (C) 2007 Sebastian Smolorz <sesmo@gmx.net>
- *	Support for TSC emulation in user space for decrementing counters
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef _LIB_COBALT_ARM64_TSC_H
-#define _LIB_COBALT_ARM64_TSC_H
-
-#include <asm/xenomai/uapi/tsc.h>
-#include <asm/xenomai/features.h>
-#include <inttypes.h>
-#include <sys/time.h>
-
-typedef unsigned long long __xn_rdtsc_t(volatile unsigned *vaddr);
-struct __xn_full_tscinfo {
-	struct __xn_tscinfo kinfo;
-};
-extern struct __xn_full_tscinfo __xn_tscinfo;
-
-static inline uint64_t get_counter(void)
-{
-        uint64_t cval;
-
-	asm volatile("isb; mrs %0, cntvct_el0; isb; " : "=r" (cval) :: "memory");
-
-	return cval;
-}
-
-static inline __attribute__((always_inline))
-unsigned long long cobalt_read_legacy_tsc(void)
-{
-	return get_counter();
-}
-
-#endif /* !_LIB_COBALT_ARM64_TSC_H */
diff --git a/lib/cobalt/arch/x86/include/asm/xenomai/Makefile.am b/lib/cobalt/arch/x86/include/asm/xenomai/Makefile.am
index d308b06e62..a7dd090432 100644
--- a/lib/cobalt/arch/x86/include/asm/xenomai/Makefile.am
+++ b/lib/cobalt/arch/x86/include/asm/xenomai/Makefile.am
@@ -1,5 +1,4 @@
 
 noinst_HEADERS =	\
 	features.h	\
-	syscall.h	\
-	tsc.h
+	syscall.h
diff --git a/lib/cobalt/arch/x86/include/asm/xenomai/tsc.h b/lib/cobalt/arch/x86/include/asm/xenomai/tsc.h
deleted file mode 100644
index bf400e8505..0000000000
--- a/lib/cobalt/arch/x86/include/asm/xenomai/tsc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2001,2002,2003,2007 Philippe Gerum <rpm@xenomai.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-
-#ifndef _LIB_COBALT_X86_TSC_H
-#define _LIB_COBALT_X86_TSC_H
-
-static inline unsigned long long cobalt_read_legacy_tsc(void)
-{
-#ifdef __i386__
-	unsigned long long t;
-
-	__asm__ __volatile__ ("rdtsc" : "=A" (t));
-	return t;
-
-#else /* x86_64 */
-	unsigned int __a,__d;
-
-	__asm__ __volatile__ ("rdtsc" : "=a" (__a), "=d" (__d));
-	return ((unsigned long)__a) | (((unsigned long)__d) << 32);
-#endif /* x86_64 */
-}
-
-#endif /* !_LIB_COBALT_X86_TSC_H */
-- 
2.35.3


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

* [PATCH 09/20] cobalt/uapi: Drop tsc.h
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (7 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 08/20] lib/cobalt: Drop tsc.h Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 10/20] lib/cobalt: Drop VDSO support Jan Kiszka
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

No longer used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../arch/arm/include/asm/xenomai/uapi/tsc.h   | 25 -------------------
 .../arch/arm64/include/asm/xenomai/uapi/tsc.h | 25 -------------------
 2 files changed, 50 deletions(-)
 delete mode 100644 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/tsc.h
 delete mode 100644 kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/tsc.h

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/tsc.h b/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/tsc.h
deleted file mode 100644
index b17cfb24fc..0000000000
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/uapi/tsc.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2013 Gilles Chanteperdrix <gch@xenomai.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef _COBALT_ARM_ASM_UAPI_TSC_H
-#define _COBALT_ARM_ASM_UAPI_TSC_H
-
-struct __xn_tscinfo {
-	volatile unsigned int *counter;
-};
-
-#endif /* !_COBALT_ARM_ASM_UAPI_TSC_H */
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/tsc.h b/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/tsc.h
deleted file mode 100644
index 20a4eaa882..0000000000
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/uapi/tsc.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2013 Gilles Chanteperdrix <gch@xenomai.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef _COBALT_ARM64_ASM_UAPI_TSC_H
-#define _COBALT_ARM64_ASM_UAPI_TSC_H
-
-struct __xn_tscinfo {
-	volatile unsigned int *counter;
-};
-
-#endif /* !_COBALT_ARM64_ASM_UAPI_TSC_H */
-- 
2.35.3


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

* [PATCH 10/20] lib/cobalt: Drop VDSO support
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (8 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 09/20] cobalt/uapi: " Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 11/20] kernel/cobalt: Remove archcall syscall stub Jan Kiszka
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This only existed to provide clock services under I-pipe. There are no
other use cases in sight, so drop the related code from userspace first.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 lib/cobalt/init.c |  2 +-
 lib/cobalt/umm.c  | 14 +++-----------
 lib/cobalt/umm.h  |  6 +-----
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 58051a2f26..7aa7c48de7 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -179,7 +179,7 @@ static void low_init(void)
 	trace_me("memory locked");
 	cobalt_ticks_init();
 	cobalt_features_init(f);
-	cobalt_init_umm(f->vdso_offset);
+	cobalt_init_umm();
 	trace_me("memory heaps mapped");
 	cobalt_init_current_keys();
 }
diff --git a/lib/cobalt/umm.c b/lib/cobalt/umm.c
index c30ada6a23..555bee8474 100644
--- a/lib/cobalt/umm.c
+++ b/lib/cobalt/umm.c
@@ -34,8 +34,6 @@
 #include "umm.h"
 #include "internal.h"
 
-struct xnvdso *cobalt_vdso;
-
 void *cobalt_umm_private = NULL;
 
 void *cobalt_umm_shared = NULL;
@@ -117,20 +115,14 @@ static void init_bind(void)
 }
 
 /* Will be called only once, upon call to xenomai_init(). */
-static void init_loadup(__u32 vdso_offset)
+void cobalt_init_umm(void)
 {
 	uint32_t size;
 
+	pthread_once(&init_bind_once, init_bind);
+
 	cobalt_umm_shared = map_umm(COBALT_MEMDEV_SHARED, &size);
 	if (cobalt_umm_shared == MAP_FAILED)
 		early_panic("cannot map shared umm area: %s",
 			    strerror(errno));
-
-	cobalt_vdso = (struct xnvdso *)(cobalt_umm_shared + vdso_offset);
-}
-
-void cobalt_init_umm(__u32 vdso_offset)
-{
-	pthread_once(&init_bind_once, init_bind);
-	init_loadup(vdso_offset);
 }
diff --git a/lib/cobalt/umm.h b/lib/cobalt/umm.h
index b592968832..7705f9cf94 100644
--- a/lib/cobalt/umm.h
+++ b/lib/cobalt/umm.h
@@ -20,12 +20,8 @@
 
 #include <linux/types.h>
 
-void cobalt_init_umm(__u32 vdso_offset);
+void cobalt_init_umm(void);
 
 void cobalt_unmap_umm(void);
 
-struct xnvdso;
-
-extern struct xnvdso *cobalt_vdso;
-
 #endif /* _LIB_COBALT_UMM_H */
-- 
2.35.3


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

* [PATCH 11/20] kernel/cobalt: Remove archcall syscall stub
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (9 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 10/20] lib/cobalt: Drop VDSO support Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 12/20] kernel/cobalt: Retire clock_freq field in cobalt_featinfo Jan Kiszka
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This was returning ENOSYS only anyway.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/uapi/syscall.h                          | 2 +-
 kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h   | 9 ---------
 kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h | 9 ---------
 kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h   | 8 --------
 kernel/cobalt/posix/syscall.c                          | 8 --------
 kernel/cobalt/trace/cobalt-posix.h                     | 1 -
 6 files changed, 1 insertion(+), 36 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 3e65efaabe..f27988f552 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -109,7 +109,7 @@
 #define sc_cobalt_select			86
 #define sc_cobalt_fcntl				87
 #define sc_cobalt_migrate			88
-#define sc_cobalt_archcall			89
+/* 89: formerly archcall */
 #define sc_cobalt_trace				90
 #define sc_cobalt_corectl			91
 #define sc_cobalt_get_current			92
diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
index 2490e7fe81..1721977251 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
@@ -77,15 +77,6 @@ static inline int __xn_interrupted_p(struct pt_regs *regs)
 	return __xn_reg_rval(regs) == -EINTR;
 }
 
-static inline
-int xnarch_local_syscall(unsigned long a1, unsigned long a2,
-			unsigned long a3, unsigned long a4,
-			unsigned long a5)
-{
-	/* We need none of these with Dovetail. */
-	return -ENOSYS;
-}
-
 #define pipeline_get_syscall_args pipeline_get_syscall_args
 static inline void pipeline_get_syscall_args(struct task_struct *task,
 					     struct pt_regs *regs,
diff --git a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
index 0f1d1eaf8d..26e4ed8c32 100644
--- a/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm64/include/asm/xenomai/syscall.h
@@ -51,13 +51,4 @@ static inline int __xn_interrupted_p(struct pt_regs *regs)
 	return __xn_reg_rval(regs) == -EINTR;
 }
 
-static inline
-int xnarch_local_syscall(unsigned long a1, unsigned long a2,
-			unsigned long a3, unsigned long a4,
-			unsigned long a5)
-{
-	/* We need none of these with Dovetail. */
-	return -ENOSYS;
-}
-
 #endif /* !_COBALT_ARM64_SYSCALL_H */
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
index b2e158247f..f60aed0132 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
@@ -74,12 +74,4 @@ static inline int __xn_interrupted_p(struct pt_regs *regs)
 	return __xn_reg_rval(regs) == -EINTR;
 }
 
-static inline
-int xnarch_local_syscall(unsigned long a1, unsigned long a2,
-			 unsigned long a3, unsigned long a4,
-			 unsigned long a5)
-{
-	return -ENOSYS;
-}
-
 #endif /* !_COBALT_X86_ASM_SYSCALL_H */
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 46c4998e4c..6193098bab 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -205,14 +205,6 @@ static COBALT_SYSCALL(ftrace_puts, current,
 	return 0;
 }
 
-static COBALT_SYSCALL(archcall, current,
-		      (unsigned long a1, unsigned long a2,
-		       unsigned long a3, unsigned long a4,
-		       unsigned long a5))
-{
-	return xnarch_local_syscall(a1, a2, a3, a4, a5);
-}
-
 static COBALT_SYSCALL(get_current, current,
 		      (xnhandle_t __user *u_handle))
 {
diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h
index 47dc77e1cd..1c93023240 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -144,7 +144,6 @@
 		__cobalt_symbolic_syscall(select),			\
 		__cobalt_symbolic_syscall(fcntl),			\
 		__cobalt_symbolic_syscall(migrate),			\
-		__cobalt_symbolic_syscall(archcall),			\
 		__cobalt_symbolic_syscall(trace),			\
 		__cobalt_symbolic_syscall(corectl),			\
 		__cobalt_symbolic_syscall(get_current),			\
-- 
2.35.3


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

* [PATCH 12/20] kernel/cobalt: Retire clock_freq field in cobalt_featinfo
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (10 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 11/20] kernel/cobalt: Remove archcall syscall stub Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 13/20] kernel/cobalt: Remove VDSO support Jan Kiszka
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

Was always 0 since I-pipe was removed, and userspace no longer expects
it with the latest ABI revision.

Keep the field as reserved so that older userspace still finds the ABI
revision at the same offset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/kernel/dovetail/pipeline/pipeline.h | 5 -----
 include/cobalt/uapi/asm-generic/features.h         | 4 ++--
 kernel/cobalt/posix/syscall.c                      | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/cobalt/kernel/dovetail/pipeline/pipeline.h b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
index 2ee7b32101..18a7da1913 100644
--- a/include/cobalt/kernel/dovetail/pipeline/pipeline.h
+++ b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
@@ -92,11 +92,6 @@ static inline void pipeline_prepare_panic(void)
 	/* N/A */
 }
 
-static inline void pipeline_collect_features(struct cobalt_featinfo *f)
-{
-	f->clock_freq = 0;	/* N/A */
-}
-
 #ifndef pipeline_get_syscall_args
 static inline void pipeline_get_syscall_args(struct task_struct *task,
 					     struct pt_regs *regs,
diff --git a/include/cobalt/uapi/asm-generic/features.h b/include/cobalt/uapi/asm-generic/features.h
index 8a4927c491..4f069b1ceb 100644
--- a/include/cobalt/uapi/asm-generic/features.h
+++ b/include/cobalt/uapi/asm-generic/features.h
@@ -23,8 +23,8 @@
 #define XNFEAT_STRING_LEN 64
 
 struct cobalt_featinfo {
-	/** Real-time clock frequency */
-	__u64 clock_freq;
+	/* Used to be real-time clock frequency. */
+	__u64 __reserved1;
 	/** Offset of nkvdso in the sem heap. */
 	__u32 vdso_offset;
 	/** ABI revision level. */
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 6193098bab..59c45d0499 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -331,7 +331,6 @@ static COBALT_SYSCALL(bind, lostage,
 	f->feat_abirev = XENOMAI_ABI_REV;
 	collect_arch_features(f);
 
-	pipeline_collect_features(f);
 	f->vdso_offset = cobalt_umm_offset(&cobalt_ppd_get(1)->umm, nkvdso);
 
 	if (cobalt_copy_to_user(u_breq, &breq, sizeof(breq)))
-- 
2.35.3


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

* [PATCH 13/20] kernel/cobalt: Remove VDSO support
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (11 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 12/20] kernel/cobalt: Retire clock_freq field in cobalt_featinfo Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 14/20] testsuite/smokey/rtdm: Remove dead code Jan Kiszka
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

No longer used, and userspace no longer expects it with the latest ABI
revision.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/kernel/Makefile.am          |   1 -
 include/cobalt/kernel/vdso.h               |  49 ---------
 include/cobalt/sys/cobalt.h                |   1 -
 include/cobalt/uapi/asm-generic/features.h |   4 +-
 include/cobalt/uapi/kernel/Makefile.am     |   4 +-
 include/cobalt/uapi/kernel/urw.h           | 113 ---------------------
 include/cobalt/uapi/kernel/vdso.h          |  66 ------------
 kernel/cobalt/clock.c                      |   2 -
 kernel/cobalt/dovetail/kevents.c           |   1 -
 kernel/cobalt/init.c                       |   1 -
 kernel/cobalt/posix/memory.c               |  21 ----
 kernel/cobalt/posix/process.c              |   1 -
 kernel/cobalt/posix/syscall.c              |   3 -
 13 files changed, 3 insertions(+), 264 deletions(-)
 delete mode 100644 include/cobalt/kernel/vdso.h
 delete mode 100644 include/cobalt/uapi/kernel/urw.h
 delete mode 100644 include/cobalt/uapi/kernel/vdso.h

diff --git a/include/cobalt/kernel/Makefile.am b/include/cobalt/kernel/Makefile.am
index 6413481f8b..aa6d1de8a5 100644
--- a/include/cobalt/kernel/Makefile.am
+++ b/include/cobalt/kernel/Makefile.am
@@ -31,7 +31,6 @@ noinst_HEADERS =	\
 	timer.h		\
 	trace.h		\
 	tree.h		\
-	vdso.h		\
 	vfile.h
 
 SUBDIRS = rtdm
diff --git a/include/cobalt/kernel/vdso.h b/include/cobalt/kernel/vdso.h
deleted file mode 100644
index 7da88a7309..0000000000
--- a/include/cobalt/kernel/vdso.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2009 Wolfgang Mauerer <wolfgang.mauerer@siemens.com>.
- *
- * Xenomai is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * Xenomai is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Xenomai; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-#ifndef _COBALT_KERNEL_VDSO_H
-#define _COBALT_KERNEL_VDSO_H
-
-#include <linux/time.h>
-#include <asm/barrier.h>
-#include <asm/atomic.h>
-#include <asm/processor.h>
-#include <cobalt/uapi/kernel/vdso.h>
-
-extern struct xnvdso *nkvdso;
-
-/*
- * Define the available feature set here. We have a single feature
- * defined for now, only in the I-pipe case.
- */
-#ifdef CONFIG_IPIPE_HAVE_HOSTRT
-
-#define XNVDSO_FEATURES XNVDSO_FEAT_HOST_REALTIME
-
-static inline struct xnvdso_hostrt_data *get_hostrt_data(void)
-{
-	return &nkvdso->hostrt_data;
-}
-
-#else
-
-#define XNVDSO_FEATURES 0
-
-#endif
-
-#endif /* _COBALT_KERNEL_VDSO_H */
diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h
index 46096e8801..39c9a8493a 100644
--- a/include/cobalt/sys/cobalt.h
+++ b/include/cobalt/sys/cobalt.h
@@ -29,7 +29,6 @@
 #include <boilerplate/atomic.h>
 #include <boilerplate/list.h>
 #include <cobalt/uapi/kernel/synch.h>
-#include <cobalt/uapi/kernel/vdso.h>
 #include <cobalt/uapi/corectl.h>
 #include <cobalt/uapi/mutex.h>
 #include <cobalt/uapi/event.h>
diff --git a/include/cobalt/uapi/asm-generic/features.h b/include/cobalt/uapi/asm-generic/features.h
index 4f069b1ceb..4b0635d0c7 100644
--- a/include/cobalt/uapi/asm-generic/features.h
+++ b/include/cobalt/uapi/asm-generic/features.h
@@ -25,8 +25,8 @@
 struct cobalt_featinfo {
 	/* Used to be real-time clock frequency. */
 	__u64 __reserved1;
-	/** Offset of nkvdso in the sem heap. */
-	__u32 vdso_offset;
+	/* Used to be vdso_offset. */
+	__u32 __reserved2;
 	/** ABI revision level. */
 	__u32 feat_abirev;
 	/** Available feature set. */
diff --git a/include/cobalt/uapi/kernel/Makefile.am b/include/cobalt/uapi/kernel/Makefile.am
index 12e1b37285..093d917bdb 100644
--- a/include/cobalt/uapi/kernel/Makefile.am
+++ b/include/cobalt/uapi/kernel/Makefile.am
@@ -7,6 +7,4 @@ includesub_HEADERS =	\
 	synch.h		\
 	thread.h	\
 	trace.h		\
-	types.h		\
-	urw.h		\
-	vdso.h
+	types.h
diff --git a/include/cobalt/uapi/kernel/urw.h b/include/cobalt/uapi/kernel/urw.h
deleted file mode 100644
index fcfde21a02..0000000000
--- a/include/cobalt/uapi/kernel/urw.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2013 Philippe Gerum <rpm@xenomai.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef _COBALT_UAPI_KERNEL_URW_H
-#define _COBALT_UAPI_KERNEL_URW_H
-
-#include <linux/types.h>
-
-/*
- * A restricted version of the kernel seqlocks with a slightly
- * different interface, allowing for unsynced reads with concurrent
- * write detection, without serializing writers.  Caller should
- * provide for proper locking to deal with concurrent updates.
- *
- * urw_t lock = URW_INITIALIZER;
- * urwstate_t tmp;
- *
- * unsynced_read_block(&tmp, &lock) {
- *          (will redo until clean read)...
- * }
- *
- * unsynced_write_block(&tmp, &lock) {
- *          ...
- * }
- *
- * This code was inspired by Wolfgang Mauerer's linux/seqlock.h
- * adaptation for Xenomai 2.6 to support the VDSO feature.
- */
-
-typedef struct {
-	__u32 sequence;
-} urw_t;
-
-typedef struct {
-	__u32 token;
-	__u32 dirty;
-} urwstate_t;
-
-#define URW_INITIALIZER     { 0 }
-#define DEFINE_URW(__name)  urw_t __name = URW_INITIALIZER
-
-#ifndef READ_ONCE
-#define READ_ONCE ACCESS_ONCE
-#endif
-
-static inline void __try_read_start(const urw_t *urw, urwstate_t *tmp)
-{
-	__u32 token;
-repeat:
-	token = READ_ONCE(urw->sequence);
-	smp_rmb();
-	if (token & 1) {
-		cpu_relax();
-		goto repeat;
-	}
-
-	tmp->token = token;
-	tmp->dirty = 1;
-}
-
-static inline void __try_read_end(const urw_t *urw, urwstate_t *tmp)
-{
-	smp_rmb();
-	if (urw->sequence != tmp->token) {
-		__try_read_start(urw, tmp);
-		return;
-	}
-
-	tmp->dirty = 0;
-}
-
-static inline void __do_write_start(urw_t *urw, urwstate_t *tmp)
-{
-	urw->sequence++;
-	tmp->dirty = 1;
-	smp_wmb();
-}
-
-static inline void __do_write_end(urw_t *urw, urwstate_t *tmp)
-{
-	smp_wmb();
-	tmp->dirty = 0;
-	urw->sequence++;
-}
-
-static inline void unsynced_rw_init(urw_t *urw)
-{
-	urw->sequence = 0;
-}
-
-#define unsynced_read_block(__tmp, __urw)		\
-	for (__try_read_start(__urw, __tmp);		\
-	     (__tmp)->dirty; __try_read_end(__urw, __tmp))
-
-#define unsynced_write_block(__tmp, __urw)		\
-	for (__do_write_start(__urw, __tmp);		\
-	     (__tmp)->dirty; __do_write_end(__urw, __tmp))
-
-#endif /* !_COBALT_UAPI_KERNEL_URW_H */
diff --git a/include/cobalt/uapi/kernel/vdso.h b/include/cobalt/uapi/kernel/vdso.h
deleted file mode 100644
index 5b9b1b66b2..0000000000
--- a/include/cobalt/uapi/kernel/vdso.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 Wolfgang Mauerer <wolfgang.mauerer@siemens.com>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-#ifndef _COBALT_UAPI_KERNEL_VDSO_H
-#define _COBALT_UAPI_KERNEL_VDSO_H
-
-#include <cobalt/uapi/kernel/urw.h>
-
-/*
- * I-pipe only. Dovetail enables the common vDSO for getting
- * CLOCK_REALTIME timestamps from the out-of-band stage
- * (XNVDSO_FEAT_HOST_REALTIME is cleared in this case).
- */
-struct xnvdso_hostrt_data {
-	__u64 wall_sec;
-	__u64 wtom_sec;
-	__u64 cycle_last;
-	__u64 mask;
-	__u32 wall_nsec;
-	__u32 wtom_nsec;
-	__u32 mult;
-	__u32 shift;
-	__u32 live;
-	urw_t lock;
-};
-
-/*
- * Data shared between the Cobalt kernel and applications, which lives
- * in the shared memory heap (COBALT_MEMDEV_SHARED).
- * xnvdso_hostrt_data.features tells which data is present. Notice
- * that struct xnvdso may only grow, but never shrink.
- */
-struct xnvdso {
-	__u64 features;
-	/* XNVDSO_FEAT_HOST_REALTIME */
-	struct xnvdso_hostrt_data hostrt_data;
-	/* XNVDSO_FEAT_WALLCLOCK_OFFSET */
-	__u64 wallclock_offset;
-};
-
-/* For each shared feature, add a flag below. */
-
-#define XNVDSO_FEAT_HOST_REALTIME	0x0000000000000001ULL
-#define XNVDSO_FEAT_WALLCLOCK_OFFSET	0x0000000000000002ULL
-
-static inline int xnvdso_test_feature(struct xnvdso *vdso,
-				      __u64 feature)
-{
-	return (vdso->features & feature) != 0;
-}
-
-#endif /* !_COBALT_UAPI_KERNEL_VDSO_H */
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 2b9efad4e7..fbb7ddbe95 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -22,7 +22,6 @@
 #include <cobalt/kernel/timer.h>
 #include <cobalt/kernel/clock.h>
 #include <cobalt/kernel/arith.h>
-#include <cobalt/kernel/vdso.h>
 #include <cobalt/uapi/time.h>
 #include <asm/xenomai/calibration.h>
 #include <trace/events/cobalt-core.h>
@@ -292,7 +291,6 @@ void xnclock_set_wallclock(xnticks_t epoch_ns)
 	old_offset_ns = nkclock.wallclock_offset;
 	offset_ns = (xnsticks_t)(epoch_ns - xnclock_core_read_monotonic());
 	nkclock.wallclock_offset = offset_ns;
-	nkvdso->wallclock_offset = offset_ns;
 	xnclock_apply_offset(&nkclock, offset_ns - old_offset_ns);
 	xnlock_put_irqrestore(&nklock, s);
 }
diff --git a/kernel/cobalt/dovetail/kevents.c b/kernel/cobalt/dovetail/kevents.c
index 4da4f51b7a..817aa954dc 100644
--- a/kernel/cobalt/dovetail/kevents.c
+++ b/kernel/cobalt/dovetail/kevents.c
@@ -14,7 +14,6 @@
 #include <cobalt/kernel/sched.h>
 #include <cobalt/kernel/thread.h>
 #include <cobalt/kernel/clock.h>
-#include <cobalt/kernel/vdso.h>
 #include <cobalt/kernel/init.h>
 #include <rtdm/driver.h>
 #include <trace/events/cobalt-core.h>
diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c
index 5168b56035..509ba3fc4c 100644
--- a/kernel/cobalt/init.c
+++ b/kernel/cobalt/init.c
@@ -28,7 +28,6 @@
 #include <cobalt/kernel/ppd.h>
 #include <cobalt/kernel/pipe.h>
 #include <cobalt/kernel/select.h>
-#include <cobalt/kernel/vdso.h>
 #include <rtdm/fd.h>
 #include "rtdm/internal.h"
 #include "posix/internal.h"
diff --git a/kernel/cobalt/posix/memory.c b/kernel/cobalt/posix/memory.c
index 25cc784ea9..79db01cebd 100644
--- a/kernel/cobalt/posix/memory.c
+++ b/kernel/cobalt/posix/memory.c
@@ -23,7 +23,6 @@
 #include <linux/gfp.h>
 #include <linux/vmalloc.h>
 #include <rtdm/driver.h>
-#include <cobalt/kernel/vdso.h>
 #include "process.h"
 #include "memory.h"
 
@@ -31,9 +30,6 @@
 #define UMM_SHARED   1	/* Shared user-mapped memory heap */
 #define SYS_GLOBAL   2	/* System heap (not mmapped) */
 
-struct xnvdso *nkvdso;
-EXPORT_SYMBOL_GPL(nkvdso);
-
 static void umm_vmopen(struct vm_area_struct *vma)
 {
 	struct cobalt_umm *umm = vma->vm_private_data;
@@ -252,12 +248,6 @@ static struct rtdm_device sysmem_device = {
 	.label = COBALT_MEMDEV_SYS,
 };
 
-static inline void init_vdso(void)
-{
-	nkvdso->features = XNVDSO_FEATURES;
-	nkvdso->wallclock_offset = nkclock.wallclock_offset;
-}
-
 int cobalt_memdev_init(void)
 {
 	int ret;
@@ -269,14 +259,6 @@ int cobalt_memdev_init(void)
 
 	cobalt_umm_set_name(&cobalt_kernel_ppd.umm, "shared heap");
 
-	nkvdso = cobalt_umm_alloc(&cobalt_kernel_ppd.umm, sizeof(*nkvdso));
-	if (nkvdso == NULL) {
-		ret = -ENOMEM;
-		goto fail_vdso;
-	}
-
-	init_vdso();
-
 	ret = rtdm_dev_register(umm_devices + UMM_PRIVATE);
 	if (ret)
 		goto fail_private;
@@ -296,8 +278,6 @@ fail_sysmem:
 fail_shared:
 	rtdm_dev_unregister(umm_devices + UMM_PRIVATE);
 fail_private:
-	cobalt_umm_free(&cobalt_kernel_ppd.umm, nkvdso);
-fail_vdso:
 	cobalt_umm_destroy(&cobalt_kernel_ppd.umm);
 
 	return ret;
@@ -308,7 +288,6 @@ void cobalt_memdev_cleanup(void)
 	rtdm_dev_unregister(&sysmem_device);
 	rtdm_dev_unregister(umm_devices + UMM_SHARED);
 	rtdm_dev_unregister(umm_devices + UMM_PRIVATE);
-	cobalt_umm_free(&cobalt_kernel_ppd.umm, nkvdso);
 	cobalt_umm_destroy(&cobalt_kernel_ppd.umm);
 }
 
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 1abc86f37b..23ed913bb2 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -44,7 +44,6 @@
 #include <cobalt/kernel/trace.h>
 #include <cobalt/kernel/stat.h>
 #include <cobalt/kernel/ppd.h>
-#include <cobalt/kernel/vdso.h>
 #include <cobalt/kernel/thread.h>
 #include <cobalt/uapi/signal.h>
 #include <cobalt/uapi/syscall.h>
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 59c45d0499..66dd1aec85 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -23,7 +23,6 @@
 #include <linux/unistd.h>
 #include <cobalt/uapi/corectl.h>
 #include <cobalt/kernel/tree.h>
-#include <cobalt/kernel/vdso.h>
 #include <cobalt/kernel/init.h>
 #include <pipeline/kevents.h>
 #include <pipeline/vdso_fallback.h>
@@ -331,8 +330,6 @@ static COBALT_SYSCALL(bind, lostage,
 	f->feat_abirev = XENOMAI_ABI_REV;
 	collect_arch_features(f);
 
-	f->vdso_offset = cobalt_umm_offset(&cobalt_ppd_get(1)->umm, nkvdso);
-
 	if (cobalt_copy_to_user(u_breq, &breq, sizeof(breq)))
 		return -EFAULT;
 
-- 
2.35.3


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

* [PATCH 14/20] testsuite/smokey/rtdm: Remove dead code
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (12 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 13/20] kernel/cobalt: Remove VDSO support Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 15/20] lib/cobalt: Refactor cobalt_read_tsc API to cobalt_read_ns Jan Kiszka
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

This was left unused behind by e945350051d4.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 testsuite/smokey/rtdm/rtdm.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/testsuite/smokey/rtdm/rtdm.c b/testsuite/smokey/rtdm/rtdm.c
index 6ad0d6d7ad..785132a147 100644
--- a/testsuite/smokey/rtdm/rtdm.c
+++ b/testsuite/smokey/rtdm/rtdm.c
@@ -18,18 +18,6 @@ smokey_test_plugin(rtdm,
 		   "Check core interface to RTDM services."
 );
 
-#define NS_PER_MS (1000000)
-
-static inline unsigned long long timer_get_tsc(void)
-{
-	return clockobj_get_tsc();
-}
-
-static inline unsigned long long timer_tsc2ns(unsigned long long tsc)
-{
-	return clockobj_tsc_to_ns(tsc);
-}
-
 static void check_inner(const char *fn, int line, const char *msg,
 			int status, int expected)
 {
-- 
2.35.3


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

* [PATCH 15/20] lib/cobalt: Refactor cobalt_read_tsc API to cobalt_read_ns
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (13 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 14/20] testsuite/smokey/rtdm: Remove dead code Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 16/20] lib/copperplate: Refactor clockobj_get_tsc API to clockobj_get_ns Jan Kiszka
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

As we are now only reading nanoseconds via cobalt_read_tsc, change the
API to make this clear, obsoleting cobalt_ticks_to_ns,
cobalt_ticks_to_ns_rounded and cobalt_ns_to_ticks at the same time.

Existing users are adjusted accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/sys/cobalt.h    |  2 +-
 include/cobalt/ticks.h         | 18 -----------------
 include/copperplate/clockobj.h | 30 +++++++++------------------
 lib/cobalt/internal.c          |  2 +-
 lib/copperplate/clockobj.c     |  4 ++--
 testsuite/smokey/tsc/tsc.c     | 37 +++++++---------------------------
 6 files changed, 21 insertions(+), 72 deletions(-)

diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h
index 39c9a8493a..ba629cbeba 100644
--- a/include/cobalt/sys/cobalt.h
+++ b/include/cobalt/sys/cobalt.h
@@ -133,7 +133,7 @@ void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th);
 
 void cobalt_assert_nrt(void);
 
-unsigned long long cobalt_read_tsc(void);
+unsigned long long cobalt_read_ns(void);
 
 extern int __cobalt_control_bind;
 
diff --git a/include/cobalt/ticks.h b/include/cobalt/ticks.h
index fe5a6ac21a..d9cde6323d 100644
--- a/include/cobalt/ticks.h
+++ b/include/cobalt/ticks.h
@@ -25,24 +25,6 @@
 extern "C" {
 #endif
 
-static inline
-xnsticks_t cobalt_ns_to_ticks(xnsticks_t ns)
-{
-	return ns;
-}
-
-static inline
-xnsticks_t cobalt_ticks_to_ns(xnsticks_t ticks)
-{
-	return ticks;
-}
-
-static inline
-xnsticks_t cobalt_ticks_to_ns_rounded(xnsticks_t ticks)
-{
-	return ticks;
-}
-
 unsigned long long cobalt_divrem_billion(unsigned long long value,
 					 unsigned long *rem);
 #ifdef __cplusplus
diff --git a/include/copperplate/clockobj.h b/include/copperplate/clockobj.h
index dde18bda87..b29c58bdb7 100644
--- a/include/copperplate/clockobj.h
+++ b/include/copperplate/clockobj.h
@@ -124,17 +124,7 @@ void __clockobj_ticks_to_timespec(struct clockobj *clkobj,
 static inline ticks_t clockobj_get_tsc(void)
 {
 	/* Guaranteed to be the source of CLOCK_COPPERPLATE. */
-	return cobalt_read_tsc();
-}
-
-static inline sticks_t clockobj_ns_to_tsc(sticks_t ns)
-{
-	return cobalt_ns_to_ticks(ns);
-}
-
-static inline sticks_t clockobj_tsc_to_ns(sticks_t tsc)
-{
-	return cobalt_ticks_to_ns(tsc);
+	return cobalt_read_ns();
 }
 
 static inline
@@ -150,6 +140,15 @@ void clockobj_ns_to_timespec(ticks_t ns, struct timespec *ts)
 
 ticks_t clockobj_get_tsc(void);
 
+static inline
+void clockobj_ns_to_timespec(ticks_t ns, struct timespec *ts)
+{
+	ts->tv_sec = ns / 1000000000ULL;
+	ts->tv_nsec = ns - (ts->tv_sec * 1000000000ULL);
+}
+
+#endif /* CONFIG_XENO_MERCURY */
+
 static inline sticks_t clockobj_ns_to_tsc(sticks_t ns)
 {
 	return ns;
@@ -160,15 +159,6 @@ static inline sticks_t clockobj_tsc_to_ns(sticks_t tsc)
 	return tsc;
 }
 
-static inline
-void clockobj_ns_to_timespec(ticks_t ns, struct timespec *ts)
-{
-	ts->tv_sec = ns / 1000000000ULL;
-	ts->tv_nsec = ns - (ts->tv_sec * 1000000000ULL);
-}
-
-#endif /* CONFIG_XENO_MERCURY */
-
 #ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
 
 static inline
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 74b5bd8350..b9f518ed16 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -576,7 +576,7 @@ void cobalt_assert_nrt(void)
 		pthread_kill(pthread_self(), SIGDEBUG);
 }
 
-unsigned long long cobalt_read_tsc(void)
+unsigned long long cobalt_read_ns(void)
 {
 	struct timespec ts;
 
diff --git a/lib/copperplate/clockobj.c b/lib/copperplate/clockobj.c
index b57bb46e7a..a9a8f8a25a 100644
--- a/lib/copperplate/clockobj.c
+++ b/lib/copperplate/clockobj.c
@@ -237,7 +237,7 @@ int clockobj_set_resolution(struct clockobj *clkobj, unsigned int resolution_ns)
 
 ticks_t clockobj_get_time(struct clockobj *clkobj)
 {
-	ticks_t ns = cobalt_ticks_to_ns_rounded(cobalt_read_tsc());
+	ticks_t ns = cobalt_read_ns();
 	return clockobj_ns_to_ticks(clkobj, ns);
 }
 
@@ -257,7 +257,7 @@ void clockobj_get_date(struct clockobj *clkobj, ticks_t *pticks)
 
 	read_lock_nocancel(&clkobj->lock);
 
-	ns = cobalt_ticks_to_ns(clockobj_get_tsc());
+	ns = clockobj_get_tsc();
 	/* Add offset to epoch. */
 	ns += (ticks_t)clkobj->offset.tv_sec * 1000000000ULL;
 	ns += clkobj->offset.tv_nsec;
diff --git a/testsuite/smokey/tsc/tsc.c b/testsuite/smokey/tsc/tsc.c
index f9ae82fec3..5cc6749761 100644
--- a/testsuite/smokey/tsc/tsc.c
+++ b/testsuite/smokey/tsc/tsc.c
@@ -49,30 +49,9 @@ smokey_test_plugin(tsc,
 		"Check that emulated tsc is monotonic"
 );
 
-
-static inline unsigned long long timer_get_tsc(void)
-{
-	/*
-	 * The additional function call clockobj_get_tsc() makes a big
-	 * difference on low end
-	 */
-	return cobalt_read_tsc();
-}
-
-static inline unsigned long long timer_tsc2ns(unsigned long long tsc)
-{
-	return clockobj_tsc_to_ns(tsc);
-}
-
-static inline unsigned long long timer_ns2tsc(unsigned long long ns)
-{
-	return clockobj_ns_to_tsc(ns);
-}
-
 static int run_tsc(struct smokey_test *t, int argc, char *const argv[])
 {
 	unsigned long long runtime, start, jump, tsc1, tsc2;
-	unsigned long long one_sec_tsc;
 	unsigned long long sum, g_sum;
 	unsigned long long loops, g_loops;
 	unsigned dt, min, max, g_min, g_max;
@@ -102,10 +81,8 @@ static int run_tsc(struct smokey_test *t, int argc, char *const argv[])
 
 	smokey_parse_args(t, argc, argv);
 
-	one_sec_tsc = timer_ns2tsc(ONE_BILLION);
-
-	runtime = timer_get_tsc();
-	margin = timer_tsc2ns(2000);
+	runtime = cobalt_read_ns();
+	margin = 2000;
 	if (margin < 80)
 		margin = 80;
 
@@ -123,15 +100,15 @@ static int run_tsc(struct smokey_test *t, int argc, char *const argv[])
 		max = 0;
 		sum = 0;
 		loops = 0;
-		tsc2 = start = timer_get_tsc();
+		tsc2 = start = cobalt_read_ns();
 		do {
-			tsc1 = timer_get_tsc();
+			tsc1 = cobalt_read_ns();
 			if (tsc1 < tsc2) {
 				fprintf(stderr, "%016Lx -> %016Lx\n",
 					tsc2, tsc1);
 				goto err1;
 			}
-			tsc2 = timer_get_tsc();
+			tsc2 = cobalt_read_ns();
 			if (tsc2 < tsc1) {
 				fprintf(stderr, "%016Lx -> %016Lx\n",
 					tsc1, tsc2);
@@ -149,7 +126,7 @@ static int run_tsc(struct smokey_test *t, int argc, char *const argv[])
 				max = dt;
 			sum += dt;
 			++loops;
-		} while (tsc2 - start < one_sec_tsc);
+		} while (tsc2 - start < ONE_BILLION);
 
 		smokey_trace("min: %u, max: %u, avg: %g",
 			min, max, (double)sum / loops);
@@ -164,7 +141,7 @@ static int run_tsc(struct smokey_test *t, int argc, char *const argv[])
 
 	smokey_trace("min: %u, max: %u, avg: %g -> %g us",
 		g_min, g_max, (double)g_sum / g_loops,
-		(double)timer_tsc2ns(g_sum) / (1000 * g_loops));
+		(double)g_sum / (1000 * g_loops));
 
 	return EXIT_SUCCESS;
 
-- 
2.35.3


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

* [PATCH 16/20] lib/copperplate: Refactor clockobj_get_tsc API to clockobj_get_ns
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (14 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 15/20] lib/cobalt: Refactor cobalt_read_tsc API to cobalt_read_ns Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only Jan Kiszka
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

As we are now only reading nanoseconds via clockobj_get_tsc, change the
API to make this clear, obsoleting clockobj_tsc_to_ns and
clockobj_ns_to_tsc at the same time.

Existing users are adjusted accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/copperplate/clockobj.h           | 23 ++++--------
 lib/copperplate/clockobj.c               |  6 ++--
 lib/copperplate/threadobj.c              |  4 +--
 lib/psos/tm.c                            |  2 +-
 testsuite/smokey/arith/arith.c           |  6 ++--
 testsuite/smokey/posix-cond/posix-cond.c | 46 ++++++++++--------------
 6 files changed, 33 insertions(+), 54 deletions(-)

diff --git a/include/copperplate/clockobj.h b/include/copperplate/clockobj.h
index b29c58bdb7..c06737e115 100644
--- a/include/copperplate/clockobj.h
+++ b/include/copperplate/clockobj.h
@@ -114,14 +114,13 @@ void __clockobj_ticks_to_timespec(struct clockobj *clkobj,
 
 /*
  * The Cobalt core exclusively deals with aperiodic timings, so a
- * Cobalt _tick_ is actually a _TSC_ unit. In contrast, Copperplate
- * deals with _TSC_ units and periodic _ticks_ which duration depend
- * on the clock resolution. Therefore, Cobalt ticks are strictly
- * equivalent to Copperplate TSC units, and Copperplate ticks are
- * periods of the reference clockobj which Cobalt does not know about.
+ * Cobalt _tick_ is actually a nanosecond unit. In contrast, Copperplate
+ * deals with both nanosecond units and periodic _ticks_ which duration
+ * depend on the clock resolution. Copperplate ticks are periods of the
+ * reference clockobj which Cobalt does not know about.
  */
 
-static inline ticks_t clockobj_get_tsc(void)
+static inline ticks_t clockobj_get_ns(void)
 {
 	/* Guaranteed to be the source of CLOCK_COPPERPLATE. */
 	return cobalt_read_ns();
@@ -138,7 +137,7 @@ void clockobj_ns_to_timespec(ticks_t ns, struct timespec *ts)
 
 #else /* CONFIG_XENO_MERCURY */
 
-ticks_t clockobj_get_tsc(void);
+ticks_t clockobj_get_ns(void);
 
 static inline
 void clockobj_ns_to_timespec(ticks_t ns, struct timespec *ts)
@@ -149,16 +148,6 @@ void clockobj_ns_to_timespec(ticks_t ns, struct timespec *ts)
 
 #endif /* CONFIG_XENO_MERCURY */
 
-static inline sticks_t clockobj_ns_to_tsc(sticks_t ns)
-{
-	return ns;
-}
-
-static inline sticks_t clockobj_tsc_to_ns(sticks_t tsc)
-{
-	return tsc;
-}
-
 #ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
 
 static inline
diff --git a/lib/copperplate/clockobj.c b/lib/copperplate/clockobj.c
index a9a8f8a25a..3a771e474b 100644
--- a/lib/copperplate/clockobj.c
+++ b/lib/copperplate/clockobj.c
@@ -257,7 +257,7 @@ void clockobj_get_date(struct clockobj *clkobj, ticks_t *pticks)
 
 	read_lock_nocancel(&clkobj->lock);
 
-	ns = clockobj_get_tsc();
+	ns = clockobj_get_ns();
 	/* Add offset to epoch. */
 	ns += (ticks_t)clkobj->offset.tv_sec * 1000000000ULL;
 	ns += clkobj->offset.tv_nsec;
@@ -270,7 +270,7 @@ void clockobj_get_date(struct clockobj *clkobj, ticks_t *pticks)
 
 #else /* CONFIG_XENO_MERCURY */
 
-ticks_t clockobj_get_tsc(void)
+ticks_t clockobj_get_ns(void)
 {
 	struct timespec now;
 	clock_gettime(CLOCK_COPPERPLATE, &now);
@@ -279,7 +279,7 @@ ticks_t clockobj_get_tsc(void)
 
 ticks_t clockobj_get_time(struct clockobj *clkobj)
 {
-	ticks_t ns = clockobj_get_tsc();
+	ticks_t ns = clockobj_get_ns();
 
 	if (clockobj_get_resolution(clkobj) > 1)
 		return ns / clockobj_get_resolution(clkobj);
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index db18f4ffa3..b97807c8a7 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -1693,8 +1693,8 @@ void threadobj_spin(ticks_t ns)
 {
 	ticks_t end;
 
-	end = clockobj_get_tsc() + clockobj_ns_to_tsc(ns);
-	while (clockobj_get_tsc() < end)
+	end = clockobj_get_ns() + ns;
+	while (clockobj_get_ns() < end)
 		cpu_relax();
 }
 
diff --git a/lib/psos/tm.c b/lib/psos/tm.c
index c315335236..de7d56d1ed 100644
--- a/lib/psos/tm.c
+++ b/lib/psos/tm.c
@@ -347,6 +347,6 @@ u_long tm_get(u_long *date_r, u_long *time_r, u_long *ticks_r)
 
 u_long tm_getm(unsigned long long *ns_r)
 {
-	*ns_r = clockobj_tsc_to_ns(clockobj_get_tsc());
+	*ns_r = clockobj_get_ns();
 	return SUCCESS;
 }
diff --git a/testsuite/smokey/arith/arith.c b/testsuite/smokey/arith/arith.c
index c927d1d122..edb87229a0 100644
--- a/testsuite/smokey/arith/arith.c
+++ b/testsuite/smokey/arith/arith.c
@@ -20,9 +20,9 @@ static volatile long long arg = 0x3ffffffffffffffULL;
 		  	ticks_t start, end;				\
 			unsigned long delta;				\
 									\
-			start = clockobj_get_tsc();			\
+			start = clockobj_get_ns();			\
 			result = (f);					\
-			end = clockobj_get_tsc();			\
+			end = clockobj_get_ns();			\
 			delta = end - start;				\
 									\
 			if (i == 0 || delta < (avg / i) * 4) {		\
@@ -32,7 +32,7 @@ static volatile long long arg = 0x3ffffffffffffffULL;
 		}							\
 		if (rejected < 10000) {					\
 			avg = xnarch_llimd(avg, 10000, 10000 - rejected); \
-			avg = clockobj_tsc_to_ns(avg) - calib;		\
+			avg -= calib;		\
 			smokey_trace("%s: 0x%016llx: %lld.%03llu ns,"	\
 				    " rejected %d/10000",		\
 				    display, result, avg / 10000,	\
diff --git a/testsuite/smokey/posix-cond/posix-cond.c b/testsuite/smokey/posix-cond/posix-cond.c
index e49c44727e..a664aab1bb 100644
--- a/testsuite/smokey/posix-cond/posix-cond.c
+++ b/testsuite/smokey/posix-cond/posix-cond.c
@@ -33,16 +33,6 @@ static unsigned long long timer_read(void)
 	return (unsigned long long)ts.tv_sec * NS_PER_S + ts.tv_nsec;
 }
 
-static inline unsigned long long timer_get_tsc(void)
-{
-	return clockobj_get_tsc();
-}
-
-static inline unsigned long long timer_tsc2ns(unsigned long long tsc)
-{
-	return clockobj_tsc_to_ns(tsc);
-}
-
 static void check_inner(const char *file, int line, const char *fn, const char *msg, int status, int expected)
 {
 	if (status == expected)
@@ -64,7 +54,7 @@ static void check_inner(const char *file, int line, const char *fn, const char *
 static void check_sleep_inner(const char *fn,
 		       const char *prefix, unsigned long long start)
 {
-	unsigned long long diff = timer_tsc2ns(timer_get_tsc() - start);
+	unsigned long long diff = clockobj_get_ns() - start;
 
 	if (diff < 10 * NS_PER_MS) {
 		fprintf(stderr, "%s waited %Ld.%03u us\n",
@@ -212,7 +202,7 @@ static void *cond_signaler(void *cookie)
 	unsigned long long start;
 	struct cond_mutex *cm = cookie;
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("mutex_lock", mutex_lock(cm->mutex), 0);
 	check_sleep("mutex_lock", start);
 	thread_msleep(10);
@@ -256,7 +246,7 @@ static void autoinit_simple_condwait(void)
 	      thread_spawn(&cond_signaler_tid, 2, cond_signaler, &cm), 0);
 	thread_msleep(11);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
 	thread_msleep(10);
@@ -287,7 +277,7 @@ static void simple_condwait(void)
 	      thread_spawn(&cond_signaler_tid, 2, cond_signaler, &cm), 0);
 	thread_msleep(11);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
 	thread_msleep(10);
@@ -310,7 +300,7 @@ static void relative_condwait(void)
 	check("cond_init", cond_init(&cond, 0), 0);
 	check("mutex_lock", mutex_lock(&mutex), 0);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait",
 	      cond_wait(&cond, &mutex, 10 * NS_PER_MS), -ETIMEDOUT);
 	check_sleep("cond_wait", start);
@@ -333,7 +323,7 @@ static void autoinit_absolute_condwait(void)
 				       PTHREAD_PRIO_NONE), 0);
 	check("mutex_lock", mutex_lock(&mutex), 0);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait",
 	      cond_wait_until(&cond, &mutex, timer_read() + 10 * NS_PER_MS),
 	      -ETIMEDOUT);
@@ -357,7 +347,7 @@ static void absolute_condwait(void)
 	check("cond_init", cond_init(&cond, 1), 0);
 	check("mutex_lock", mutex_lock(&mutex), 0);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait",
 	      cond_wait_until(&cond, &mutex, timer_read() + 10 * NS_PER_MS),
 	      -ETIMEDOUT);
@@ -373,7 +363,7 @@ static void *cond_killer(void *cookie)
 	unsigned long long start;
 	struct cond_mutex *cm = cookie;
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("mutex_lock", mutex_lock(cm->mutex), 0);
 	check_sleep("mutex_lock", start);
 	thread_msleep(10);
@@ -418,7 +408,7 @@ static void sig_norestart_condwait(void)
 	      thread_spawn(&cond_killer_tid, 2, cond_killer, &cm), 0);
 	thread_msleep(11);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	sig_seen = 0;
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
@@ -457,7 +447,7 @@ static void sig_restart_condwait(void)
 	      thread_spawn(&cond_killer_tid, 2, cond_killer, &cm), 0);
 	thread_msleep(11);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	sig_seen = 0;
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
@@ -473,7 +463,7 @@ static void *mutex_killer(void *cookie)
 	unsigned long long start;
 	struct cond_mutex *cm = cookie;
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("mutex_lock", mutex_lock(cm->mutex), 0);
 	check_sleep("mutex_lock", start);
 	check("cond_signal", cond_signal(cm->cond), 0);
@@ -513,7 +503,7 @@ static void sig_norestart_condwait_mutex(void)
 	thread_msleep(11);
 
 	sig_seen = 0;
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
 	check("sig_seen", sig_seen, 1);
@@ -554,7 +544,7 @@ static void sig_restart_condwait_mutex(void)
 	thread_msleep(11);
 
 	sig_seen = 0;
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
@@ -571,7 +561,7 @@ static void *double_killer(void *cookie)
 	unsigned long long start;
 	struct cond_mutex *cm = cookie;
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("mutex_lock", mutex_lock(cm->mutex), 0);
 	check_sleep("mutex_lock", start);
 	check("thread_kill 1", thread_kill(cm->tid, SIGRTMIN), 0);
@@ -611,7 +601,7 @@ static void sig_norestart_double(void)
 	thread_msleep(11);
 
 	sig_seen = 0;
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
 	check("sig_seen", sig_seen, 2);
@@ -652,7 +642,7 @@ static void sig_restart_double(void)
 	thread_msleep(11);
 
 	sig_seen = 0;
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 
 	check("cond_wait", cond_wait(&cond, &mutex, 0), 0);
 	check_sleep("cond_wait", start);
@@ -670,7 +660,7 @@ static void *cond_destroyer(void *cookie)
 	unsigned long long start;
 	struct cond_mutex *cm = cookie;
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 	check("mutex_lock", mutex_lock(cm->mutex), 0);
 	check_sleep("mutex_lock", start);
 	thread_msleep(10);
@@ -708,7 +698,7 @@ static void cond_destroy_whilewait(void)
 	      thread_spawn(&cond_destroyer_tid, 2, cond_destroyer, &cm), 0);
 	thread_msleep(11);
 
-	start = timer_get_tsc();
+	start = clockobj_get_ns();
 
 	check("cond_wait", cond_wait(&cond, &mutex, 10 * NS_PER_MS), -ETIMEDOUT);
 	check_sleep("cond_wait", start);
-- 
2.35.3


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

* [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (15 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 16/20] lib/copperplate: Refactor clockobj_get_tsc API to clockobj_get_ns Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-04  7:13   ` Florian Bezdeka
  2023-09-03 15:04 ` [PATCH 18/20] include/cobalt: Fix inclusion guard names Jan Kiszka
                   ` (2 subsequent siblings)
  19 siblings, 1 reply; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 scripts/Kconfig.frag | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/scripts/Kconfig.frag b/scripts/Kconfig.frag
index 7921286638..b76d25e535 100644
--- a/scripts/Kconfig.frag
+++ b/scripts/Kconfig.frag
@@ -1,10 +1,8 @@
 menuconfig XENOMAI
 	depends on X86_TSC || !X86
 	bool "Xenomai/cobalt"
-	select IPIPE if HAVE_IPIPE_SUPPORT
-	select IPIPE_WANT_APIREV_2 if IPIPE
-	select DOVETAIL if HAVE_DOVETAIL
-	select DOVETAIL_LEGACY_SYSCALL_RANGE if HAVE_DOVETAIL
+	select DOVETAIL
+	select DOVETAIL_LEGACY_SYSCALL_RANGE
 	default y
 	help
 	  Xenomai's Cobalt core is a real-time extension to the Linux
-- 
2.35.3


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

* [PATCH 18/20] include/cobalt: Fix inclusion guard names
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (16 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 19/20] ci: Update comment Jan Kiszka
  2023-09-03 15:04 ` [PATCH 20/20] cobalt/posix: " Jan Kiszka
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

Copy&pasted from their former I-pipe sibling.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/cobalt/kernel/dovetail/pipeline/tick.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/cobalt/kernel/dovetail/pipeline/tick.h b/include/cobalt/kernel/dovetail/pipeline/tick.h
index 372d8323fc..2670a7d339 100644
--- a/include/cobalt/kernel/dovetail/pipeline/tick.h
+++ b/include/cobalt/kernel/dovetail/pipeline/tick.h
@@ -2,8 +2,8 @@
  * SPDX-License-Identifier: GPL-2.0
  */
 
-#ifndef _COBALT_KERNEL_IPIPE_TICK_H
-#define _COBALT_KERNEL_IPIPE_TICK_H
+#ifndef _COBALT_KERNEL_DOVETAIL_TICK_H
+#define _COBALT_KERNEL_DOVETAIL_TICK_H
 
 int pipeline_install_tick_proxy(void);
 
@@ -13,4 +13,4 @@ struct xnsched;
 
 bool pipeline_must_force_program_tick(struct xnsched *sched);
 
-#endif /* !_COBALT_KERNEL_IPIPE_TICK_H */
+#endif /* !_COBALT_KERNEL_DOVETAIL_TICK_H */
-- 
2.35.3


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

* [PATCH 19/20] ci: Update comment
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (17 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 18/20] include/cobalt: Fix inclusion guard names Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  2023-09-03 15:04 ` [PATCH 20/20] cobalt/posix: " Jan Kiszka
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5c8e01f098..8c1cfa2dc9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -73,7 +73,7 @@ variables:
     - make -j $(nproc) ${KERNEL_DEFCONFIG}
     # Generic settings
     - ./scripts/config -d DEBUG_INFO
-    # I-pipe and Xenomai settings
+    # Dovetail and Xenomai settings
     - ./scripts/config -e DOVETAIL
     - ./scripts/config -e XENOMAI
     - ./scripts/config -e XENO_OPT_SCHED_CLASSES
-- 
2.35.3


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

* [PATCH 20/20] cobalt/posix: Update comment
  2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
                   ` (18 preceding siblings ...)
  2023-09-03 15:04 ` [PATCH 19/20] ci: Update comment Jan Kiszka
@ 2023-09-03 15:04 ` Jan Kiszka
  19 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-03 15:04 UTC (permalink / raw)
  To: xenomai

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

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 kernel/cobalt/posix/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 23ed913bb2..7cfaa723e6 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -638,8 +638,8 @@ int cobalt_map_user(struct xnthread *thread, __u32 __user *u_winoff)
 	 * ->map_thread() handler is invoked after the TCB is fully
 	 * built, and when we know for sure that current will go
 	 * through our task-exit handler, because it has a shadow
-	 * extension and I-pipe notifications will soon be enabled for
-	 * it.
+	 * extension and dovetail notifications will soon be enabled
+	 * for it.
 	 */
 	xnthread_run_handler(thread, map_thread);
 	pipeline_enable_kevents();
-- 
2.35.3


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

* Re: [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64
  2023-09-03 15:04 ` [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64 Jan Kiszka
@ 2023-09-04  7:12   ` Florian Bezdeka
  2023-09-04  7:36     ` Jan Kiszka
  0 siblings, 1 reply; 25+ messages in thread
From: Florian Bezdeka @ 2023-09-04  7:12 UTC (permalink / raw)
  To: Jan Kiszka, xenomai

On Sun, 2023-09-03 at 17:04 +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> The clock_settime64 syscall is theoretically still relevant, even with
> libc-based settime for standard clocks, but only for external clocks -
> which we do not have in-tree. But we can at least check that invalid
> parameters are detected and rejected
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  testsuite/smokey/y2038/syscall-tests.c | 30 --------------------------
>  1 file changed, 30 deletions(-)
> 
> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
> index 0c7de52161..3d4a9106bd 100644
> --- a/testsuite/smokey/y2038/syscall-tests.c
> +++ b/testsuite/smokey/y2038/syscall-tests.c
> @@ -278,18 +278,9 @@ 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;
> -
> -	if (!cobalt_use_legacy_tsc())
> -		return 0; // Not implemented, nothing to test, success
>  
>  	/* 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
> -	}

We could keep that. In case someone is running the testsuite against a
kernel not providing the syscall under test. Unlikely but possible.

>  	if (!smokey_assert(ret == -EFAULT))
>  		return ret ? ret : -EINVAL;
>  
> @@ -298,27 +289,6 @@ static int test_sc_cobalt_clock_settime64(void)
>  	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 = 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;
>  }
>  
> -- 
> 2.35.3
> 


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

* Re: [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only
  2023-09-03 15:04 ` [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only Jan Kiszka
@ 2023-09-04  7:13   ` Florian Bezdeka
  2023-09-04  7:36     ` Jan Kiszka
  0 siblings, 1 reply; 25+ messages in thread
From: Florian Bezdeka @ 2023-09-04  7:13 UTC (permalink / raw)
  To: Jan Kiszka, xenomai

On Sun, 2023-09-03 at 17:04 +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>

I think the subject is wrong. It's dovetail only.

> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  scripts/Kconfig.frag | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/Kconfig.frag b/scripts/Kconfig.frag
> index 7921286638..b76d25e535 100644
> --- a/scripts/Kconfig.frag
> +++ b/scripts/Kconfig.frag
> @@ -1,10 +1,8 @@
>  menuconfig XENOMAI
>  	depends on X86_TSC || !X86
>  	bool "Xenomai/cobalt"
> -	select IPIPE if HAVE_IPIPE_SUPPORT
> -	select IPIPE_WANT_APIREV_2 if IPIPE
> -	select DOVETAIL if HAVE_DOVETAIL
> -	select DOVETAIL_LEGACY_SYSCALL_RANGE if HAVE_DOVETAIL
> +	select DOVETAIL
> +	select DOVETAIL_LEGACY_SYSCALL_RANGE
>  	default y
>  	help
>  	  Xenomai's Cobalt core is a real-time extension to the Linux
> -- 
> 2.35.3
> 


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

* Re: [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64
  2023-09-04  7:12   ` Florian Bezdeka
@ 2023-09-04  7:36     ` Jan Kiszka
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-04  7:36 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai

On 04.09.23 09:12, Florian Bezdeka wrote:
> On Sun, 2023-09-03 at 17:04 +0200, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> The clock_settime64 syscall is theoretically still relevant, even with
>> libc-based settime for standard clocks, but only for external clocks -
>> which we do not have in-tree. But we can at least check that invalid
>> parameters are detected and rejected
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  testsuite/smokey/y2038/syscall-tests.c | 30 --------------------------
>>  1 file changed, 30 deletions(-)
>>
>> diff --git a/testsuite/smokey/y2038/syscall-tests.c b/testsuite/smokey/y2038/syscall-tests.c
>> index 0c7de52161..3d4a9106bd 100644
>> --- a/testsuite/smokey/y2038/syscall-tests.c
>> +++ b/testsuite/smokey/y2038/syscall-tests.c
>> @@ -278,18 +278,9 @@ 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;
>> -
>> -	if (!cobalt_use_legacy_tsc())
>> -		return 0; // Not implemented, nothing to test, success
>>  
>>  	/* 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
>> -	}
> 
> We could keep that. In case someone is running the testsuite against a
> kernel not providing the syscall under test. Unlikely but possible.

Not possible anymore due to ABI revision bump (and all the changes later
in this series as well).

Jan

> 
>>  	if (!smokey_assert(ret == -EFAULT))
>>  		return ret ? ret : -EINVAL;
>>  
>> @@ -298,27 +289,6 @@ static int test_sc_cobalt_clock_settime64(void)
>>  	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 = 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;
>>  }
>>  
>> -- 
>> 2.35.3
>>
> 

-- 
Siemens AG, Technology
Linux Expert Center


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

* Re: [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only
  2023-09-04  7:13   ` Florian Bezdeka
@ 2023-09-04  7:36     ` Jan Kiszka
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kiszka @ 2023-09-04  7:36 UTC (permalink / raw)
  To: Florian Bezdeka, xenomai

On 04.09.23 09:13, Florian Bezdeka wrote:
> On Sun, 2023-09-03 at 17:04 +0200, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> I think the subject is wrong. It's dovetail only.
> 

Indeed.

Thanks,
Jan

>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  scripts/Kconfig.frag | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/scripts/Kconfig.frag b/scripts/Kconfig.frag
>> index 7921286638..b76d25e535 100644
>> --- a/scripts/Kconfig.frag
>> +++ b/scripts/Kconfig.frag
>> @@ -1,10 +1,8 @@
>>  menuconfig XENOMAI
>>  	depends on X86_TSC || !X86
>>  	bool "Xenomai/cobalt"
>> -	select IPIPE if HAVE_IPIPE_SUPPORT
>> -	select IPIPE_WANT_APIREV_2 if IPIPE
>> -	select DOVETAIL if HAVE_DOVETAIL
>> -	select DOVETAIL_LEGACY_SYSCALL_RANGE if HAVE_DOVETAIL
>> +	select DOVETAIL
>> +	select DOVETAIL_LEGACY_SYSCALL_RANGE
>>  	default y
>>  	help
>>  	  Xenomai's Cobalt core is a real-time extension to the Linux
>> -- 
>> 2.35.3
>>
> 

-- 
Siemens AG, Technology
Linux Expert Center


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

end of thread, other threads:[~2023-09-04  7:36 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03 15:04 [PATCH 00/20] I-pipe house cleaning Jan Kiszka
2023-09-03 15:04 ` [PATCH 01/20] cobalt: Drop self element from lostage_signal Jan Kiszka
2023-09-03 15:04 ` [PATCH 02/20] drivers/udd: Drop self element from irqswitch_work Jan Kiszka
2023-09-03 15:04 ` [PATCH 03/20] cobalt: Drop not longer supported CONFIG_XENO_OPT_STATS_IRQS Jan Kiszka
2023-09-03 15:04 ` [PATCH 04/20] testsuite/smokey/y2038: Activate minimal clock_settime64 Jan Kiszka
2023-09-04  7:12   ` Florian Bezdeka
2023-09-04  7:36     ` Jan Kiszka
2023-09-03 15:04 ` [PATCH 05/20] testsuite/clocktest: Drop obsolete CLOCK_HOST_REALTIME and wallclock offset bits Jan Kiszka
2023-09-03 15:04 ` [PATCH 06/20] testsuite/smokey: Remove VDSO test Jan Kiszka
2023-09-03 15:04 ` [PATCH 07/20] lib/cobalt: Drop legacy_tsc code for I-pipe Jan Kiszka
2023-09-03 15:04 ` [PATCH 08/20] lib/cobalt: Drop tsc.h Jan Kiszka
2023-09-03 15:04 ` [PATCH 09/20] cobalt/uapi: " Jan Kiszka
2023-09-03 15:04 ` [PATCH 10/20] lib/cobalt: Drop VDSO support Jan Kiszka
2023-09-03 15:04 ` [PATCH 11/20] kernel/cobalt: Remove archcall syscall stub Jan Kiszka
2023-09-03 15:04 ` [PATCH 12/20] kernel/cobalt: Retire clock_freq field in cobalt_featinfo Jan Kiszka
2023-09-03 15:04 ` [PATCH 13/20] kernel/cobalt: Remove VDSO support Jan Kiszka
2023-09-03 15:04 ` [PATCH 14/20] testsuite/smokey/rtdm: Remove dead code Jan Kiszka
2023-09-03 15:04 ` [PATCH 15/20] lib/cobalt: Refactor cobalt_read_tsc API to cobalt_read_ns Jan Kiszka
2023-09-03 15:04 ` [PATCH 16/20] lib/copperplate: Refactor clockobj_get_tsc API to clockobj_get_ns Jan Kiszka
2023-09-03 15:04 ` [PATCH 17/20] scripts/Kconfig.frag: Switch to I-pipe only Jan Kiszka
2023-09-04  7:13   ` Florian Bezdeka
2023-09-04  7:36     ` Jan Kiszka
2023-09-03 15:04 ` [PATCH 18/20] include/cobalt: Fix inclusion guard names Jan Kiszka
2023-09-03 15:04 ` [PATCH 19/20] ci: Update comment Jan Kiszka
2023-09-03 15:04 ` [PATCH 20/20] cobalt/posix: " Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).