All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly
@ 2021-02-20 12:45 Philippe Gerum
  2021-02-20 12:45 ` [PATCH 2/8] cobalt/tick: dovetail: add placeholders for tick management Philippe Gerum
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

Since the low-level tick management code is pipeline specific, we may
flatten the call stack by using the underlying pipeline API directly.

At this chance, fix a uniprocessor build issue with IPIs.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 .../kernel/dovetail/pipeline/pipeline.h       | 23 ++++++++++++++++++-
 .../cobalt/kernel/ipipe/pipeline/pipeline.h   | 20 ++++++++--------
 include/cobalt/kernel/timer.h                 | 11 ---------
 kernel/cobalt/ipipe/tick.c                    | 11 ++++++---
 kernel/cobalt/sched.c                         |  4 ----
 kernel/cobalt/timer.c                         | 10 --------
 6 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/include/cobalt/kernel/dovetail/pipeline/pipeline.h b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
index 4b8f6b259..a2e025e35 100644
--- a/include/cobalt/kernel/dovetail/pipeline/pipeline.h
+++ b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
@@ -74,7 +74,28 @@ static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
 	TODO();
 }
 
-#endif
+#else  /* !CONFIG_SMP */
+
+static inline int pipeline_request_resched_ipi(void (*handler)(void))
+{
+	return 0;
+}
+
+
+static inline void pipeline_free_resched_ipi(void)
+{
+}
+
+static inline int pipeline_request_timer_ipi(void (*handler)(void))
+{
+	return 0;
+}
+
+static inline void pipeline_free_timer_ipi(void)
+{
+}
+
+#endif	/* CONFIG_SMP */
 
 static inline void pipeline_prepare_panic(void)
 {
diff --git a/include/cobalt/kernel/ipipe/pipeline/pipeline.h b/include/cobalt/kernel/ipipe/pipeline/pipeline.h
index fb0465fb2..ceba7e3b0 100644
--- a/include/cobalt/kernel/ipipe/pipeline/pipeline.h
+++ b/include/cobalt/kernel/ipipe/pipeline/pipeline.h
@@ -51,26 +51,24 @@ static inline void pipeline_send_resched_ipi(const struct cpumask *dest)
 	ipipe_send_ipi(IPIPE_RESCHEDULE_IPI, *dest);
 }
 
-static inline int pipeline_request_timer_ipi(void (*handler)(void))
+static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
 {
-	return ipipe_request_irq(&cobalt_pipeline.domain,
-				IPIPE_HRTIMER_IPI,
-				(ipipe_irq_handler_t)handler,
-				NULL, NULL);
+	ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
 }
 
-static inline void pipeline_free_timer_ipi(void)
+#else  /* !CONFIG_SMP */
+
+static inline int pipeline_request_resched_ipi(void (*handler)(void))
 {
-	return ipipe_free_irq(&cobalt_pipeline.domain,
-			IPIPE_HRTIMER_IPI);
+	return 0;
 }
 
-static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
+
+static inline void pipeline_free_resched_ipi(void)
 {
-	ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
 }
 
-#endif
+#endif	/* CONFIG_SMP */
 
 static inline void pipeline_prepare_panic(void)
 {
diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
index 691be7a3b..703a13506 100644
--- a/include/cobalt/kernel/timer.h
+++ b/include/cobalt/kernel/timer.h
@@ -517,10 +517,6 @@ void xntimer_migrate(struct xntimer *timer, struct xnsched *sched)
 		__xntimer_migrate(timer, sched);
 }
 
-int xntimer_setup_ipi(void);
-
-void xntimer_release_ipi(void);
-
 void __xntimer_set_affinity(struct xntimer *timer,
 			    struct xnsched *sched);
 
@@ -539,13 +535,6 @@ static inline void xntimer_migrate(struct xntimer *timer,
 	timer->sched = sched;
 }
 
-static inline int xntimer_setup_ipi(void)
-{
-	return 0;
-}
-
-static inline void xntimer_release_ipi(void) { }
-
 static inline void xntimer_set_affinity(struct xntimer *timer,
 					struct xnsched *sched)
 {
diff --git a/kernel/cobalt/ipipe/tick.c b/kernel/cobalt/ipipe/tick.c
index da1563a66..b80e56dc7 100644
--- a/kernel/cobalt/ipipe/tick.c
+++ b/kernel/cobalt/ipipe/tick.c
@@ -187,7 +187,10 @@ int pipeline_install_tick_proxy(void)
 	nkclock.wallclock_offset =
 		ktime_to_ns(ktime_get_real()) - xnclock_read_monotonic(&nkclock);
 
-	ret = xntimer_setup_ipi();
+	ret = ipipe_request_irq(&cobalt_pipeline.domain,
+				IPIPE_HRTIMER_IPI,
+				(ipipe_irq_handler_t)xnintr_core_clock_handler,
+				NULL, NULL);
 	if (ret)
 		return ret;
 
@@ -244,7 +247,8 @@ fail:
 		ipipe_timer_stop(_cpu);
 	}
 
-	xntimer_release_ipi();
+	ipipe_free_irq(&cobalt_pipeline.domain,
+		       IPIPE_HRTIMER_IPI);
 
 	return ret;
 }
@@ -270,7 +274,8 @@ void pipeline_uninstall_tick_proxy(void)
 	for_each_realtime_cpu(cpu)
 		ipipe_timer_stop(cpu);
 
-	xntimer_release_ipi();
+	ipipe_free_irq(&cobalt_pipeline.domain,
+		       IPIPE_HRTIMER_IPI);
 
 #ifdef CONFIG_XENO_OPT_STATS_IRQS
 	xnintr_destroy(&nktimer);
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 8a5621642..7873fd652 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -235,9 +235,7 @@ void xnsched_init_all(void)
 		xnsched_init(sched, cpu);
 	}
 
-#ifdef CONFIG_SMP
 	pipeline_request_resched_ipi(__xnsched_run_handler);
-#endif
 }
 
 static void xnsched_destroy(struct xnsched *sched)
@@ -258,9 +256,7 @@ void xnsched_destroy_all(void)
 	int cpu;
 	spl_t s;
 
-#ifdef CONFIG_SMP
 	pipeline_free_resched_ipi();
-#endif
 
 	xnlock_get_irqsave(&nklock, s);
 
diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
index 7f5033c87..f9aa457ce 100644
--- a/kernel/cobalt/timer.c
+++ b/kernel/cobalt/timer.c
@@ -574,16 +574,6 @@ void __xntimer_set_affinity(struct xntimer *timer, struct xnsched *sched)
 }
 EXPORT_SYMBOL_GPL(__xntimer_set_affinity);
 
-int xntimer_setup_ipi(void)
-{
-	return pipeline_request_timer_ipi(xnintr_core_clock_handler);
-}
-
-void xntimer_release_ipi(void)
-{
-	pipeline_free_timer_ipi();
-}
-
 #endif /* CONFIG_SMP */
 
 /**
-- 
2.26.2



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

* [PATCH 2/8] cobalt/tick: dovetail: add placeholders for tick management
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-02-20 12:45 ` [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management Philippe Gerum
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 .../cobalt/kernel/dovetail/pipeline/tick.h    | 12 ++++++
 kernel/cobalt/dovetail/Makefile               |  2 +-
 kernel/cobalt/dovetail/tick.c                 | 39 +++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 include/cobalt/kernel/dovetail/pipeline/tick.h
 create mode 100644 kernel/cobalt/dovetail/tick.c

diff --git a/include/cobalt/kernel/dovetail/pipeline/tick.h b/include/cobalt/kernel/dovetail/pipeline/tick.h
new file mode 100644
index 000000000..409581a3c
--- /dev/null
+++ b/include/cobalt/kernel/dovetail/pipeline/tick.h
@@ -0,0 +1,12 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef _COBALT_KERNEL_IPIPE_TICK_H
+#define _COBALT_KERNEL_IPIPE_TICK_H
+
+int pipeline_install_tick_proxy(void);
+
+void pipeline_uninstall_tick_proxy(void);
+
+#endif /* !_COBALT_KERNEL_IPIPE_TICK_H */
diff --git a/kernel/cobalt/dovetail/Makefile b/kernel/cobalt/dovetail/Makefile
index 24320b3f2..84788f9ce 100644
--- a/kernel/cobalt/dovetail/Makefile
+++ b/kernel/cobalt/dovetail/Makefile
@@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/kernel
 
 obj-y +=	pipeline.o
 
-pipeline-y :=	init.o kevents.o sched.o
+pipeline-y :=	init.o kevents.o sched.o tick.o
diff --git a/kernel/cobalt/dovetail/tick.c b/kernel/cobalt/dovetail/tick.c
new file mode 100644
index 000000000..01927f708
--- /dev/null
+++ b/kernel/cobalt/dovetail/tick.c
@@ -0,0 +1,39 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2001,2002,2003,2007,2012 Philippe Gerum <rpm@xenomai.org>.
+ * Copyright (C) 2004 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
+ */
+
+#include <linux/tick.h>
+#include <cobalt/kernel/intr.h>
+#include <pipeline/tick.h>
+
+int pipeline_install_tick_proxy(void)
+{
+	int ret;
+
+	ret = pipeline_request_timer_ipi(xnintr_core_clock_handler);
+	if (ret)
+		return ret;
+
+	/* Install the proxy tick device */
+	TODO();	ret = 0;
+	if (ret)
+		goto fail_proxy;
+
+	return 0;
+
+fail_proxy:
+	pipeline_free_timer_ipi();
+
+	return ret;
+}
+
+void pipeline_uninstall_tick_proxy(void)
+{
+	/* Uninstall the proxy tick device. */
+	TODO();
+
+	pipeline_free_timer_ipi();
+}
-- 
2.26.2



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

* [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
  2021-02-20 12:45 ` [PATCH 2/8] cobalt/tick: dovetail: add placeholders for tick management Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-03-08 11:22   ` Jan Kiszka
  2021-02-20 12:45 ` [PATCH 4/8] cobalt/wrapper: dovetail: add empty placeholder Philippe Gerum
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 .../cobalt/kernel/dovetail/pipeline/trace.h   | 123 ++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 include/cobalt/kernel/dovetail/pipeline/trace.h

diff --git a/include/cobalt/kernel/dovetail/pipeline/trace.h b/include/cobalt/kernel/dovetail/pipeline/trace.h
new file mode 100644
index 000000000..819b8a713
--- /dev/null
+++ b/include/cobalt/kernel/dovetail/pipeline/trace.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2006 Jan Kiszka <jan.kiszka@web.de>.
+ *
+ * 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_DOVETAIL_TRACE_H
+#define _COBALT_KERNEL_DOVETAIL_TRACE_H
+
+#include <linux/types.h>
+#include <linux/kconfig.h>
+#include <cobalt/uapi/kernel/trace.h>
+
+static inline int xntrace_max_begin(unsigned long v)
+{
+//#chz: NTD
+	//ipipe_trace_begin(v);
+	return 0;
+}
+
+static inline int xntrace_max_end(unsigned long v)
+{
+//#chz: NTD
+	//ipipe_trace_end(v);
+	return 0;
+}
+
+static inline int xntrace_max_reset(void)
+{
+//#chz: NTD
+	//ipipe_trace_max_reset();
+	return 0;
+}
+
+static inline int xntrace_user_start(void)
+{
+//#chz: NTD
+	//return ipipe_trace_frozen_reset();
+	return 0;
+}
+
+static inline int xntrace_user_stop(unsigned long v)
+{
+//#chz: NTD
+	//ipipe_trace_freeze(v);
+	return 0;
+}
+
+static inline int xntrace_user_freeze(unsigned long v, int once)
+{
+	int ret = 0;
+//#chz: NTD
+/*
+	if (!once)
+		ret = ipipe_trace_frozen_reset();
+
+	ipipe_trace_freeze(v);
+*/
+	return ret;
+}
+
+static inline int xntrace_special(unsigned char id, unsigned long v)
+{
+//#chz: NTD
+//	ipipe_trace_special(id, v);
+	return 0;
+}
+
+static inline int xntrace_special_u64(unsigned char id,
+					unsigned long long v)
+{
+//#chz: NTD
+//	ipipe_trace_special(id, (unsigned long)(v >> 32));
+//	ipipe_trace_special(id, (unsigned long)(v & 0xFFFFFFFF));
+	return 0;
+}
+
+static inline int xntrace_pid(pid_t pid, short prio)
+{
+//#chz: NTD
+//	ipipe_trace_pid(pid, prio);
+	return 0;
+}
+
+static inline int xntrace_tick(unsigned long delay_ticks)
+{
+//#chz: NTD
+//	ipipe_trace_event(0, delay_ticks);
+	return 0;
+}
+
+static inline int xntrace_panic_freeze(void)
+{
+//#chz: NTD
+//	ipipe_trace_panic_freeze();
+	return 0;
+}
+
+static inline int xntrace_panic_dump(void)
+{
+//#chz: NTD
+//	ipipe_trace_panic_dump();
+	return 0;
+}
+
+static inline bool xntrace_enabled(void)
+{
+	return IS_ENABLED(CONFIG_DOVETAIL_TRACE);
+}
+
+#endif /* !_COBALT_KERNEL_DOVETAIL_TRACE_H */
-- 
2.26.2



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

* [PATCH 4/8] cobalt/wrapper: dovetail: add empty placeholder
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
  2021-02-20 12:45 ` [PATCH 2/8] cobalt/tick: dovetail: add placeholders for tick management Philippe Gerum
  2021-02-20 12:45 ` [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-02-20 12:45 ` [PATCH 5/8] cobalt/syscall: dovetail: implement syscall hooks Philippe Gerum
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/dovetail/pipeline/wrappers.h | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 include/cobalt/kernel/dovetail/pipeline/wrappers.h

diff --git a/include/cobalt/kernel/dovetail/pipeline/wrappers.h b/include/cobalt/kernel/dovetail/pipeline/wrappers.h
new file mode 100644
index 000000000..133aacac3
--- /dev/null
+++ b/include/cobalt/kernel/dovetail/pipeline/wrappers.h
@@ -0,0 +1,9 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ */
+#ifndef _COBALT_KERNEL_DOVETAIL_WRAPPERS_H
+#define _COBALT_KERNEL_DOVETAIL_WRAPPERS_H
+
+/* No wrapper needed so far. */
+
+#endif /* !_COBALT_KERNEL_DOVETAIL_WRAPPERS_H */
-- 
2.26.2



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

* [PATCH 5/8] cobalt/syscall: dovetail: implement syscall hooks
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
                   ` (2 preceding siblings ...)
  2021-02-20 12:45 ` [PATCH 4/8] cobalt/wrapper: dovetail: add empty placeholder Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-02-20 12:45 ` [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions Philippe Gerum
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

Dovetail interposes on the in-band syscall entry, passing the request
on to Cobalt via different handlers depending on the calling context:

- via handle_oob_syscall() when the current thread is running
  out-of-band, and the request is not an in-band (i.e. regular Linux)
  system call, therefore shall be handled by Xenomai. This is the fast
  path.

- via handle_pipelined_syscall() in all other cases, e.g. when current
  is running in-band, and/or the system call shall be handled by the
  in-band kernel eventually (useful for relaxing the current thread in
  the process if out-of-band on entry).

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/dovetail/Makefile  |  2 +-
 kernel/cobalt/dovetail/syscall.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 kernel/cobalt/dovetail/syscall.c

diff --git a/kernel/cobalt/dovetail/Makefile b/kernel/cobalt/dovetail/Makefile
index 84788f9ce..1ecbd97a9 100644
--- a/kernel/cobalt/dovetail/Makefile
+++ b/kernel/cobalt/dovetail/Makefile
@@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/kernel
 
 obj-y +=	pipeline.o
 
-pipeline-y :=	init.o kevents.o sched.o tick.o
+pipeline-y :=	init.o kevents.o sched.o tick.o syscall.o
diff --git a/kernel/cobalt/dovetail/syscall.c b/kernel/cobalt/dovetail/syscall.c
new file mode 100644
index 000000000..cec6c0244
--- /dev/null
+++ b/kernel/cobalt/dovetail/syscall.c
@@ -0,0 +1,26 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>
+ * Copyright (C) 2005 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
+ */
+
+#include <linux/irqstage.h>
+#include <pipeline/pipeline.h>
+#include <pipeline/kevents.h>
+#include <cobalt/kernel/assert.h>
+#include <xenomai/posix/syscall.h>
+
+int handle_pipelined_syscall(struct irq_stage *stage, struct pt_regs *regs)
+{
+	if (unlikely(running_inband()))
+		return handle_root_syscall(regs);
+
+	return handle_head_syscall(stage == &inband_stage, regs);
+}
+
+void handle_oob_syscall(struct pt_regs *regs)
+{
+	int ret = handle_head_syscall(false, regs);
+	XENO_BUG_ON(COBALT, ret == KEVENT_PROPAGATE);
+}
-- 
2.26.2



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

* [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
                   ` (3 preceding siblings ...)
  2021-02-20 12:45 ` [PATCH 5/8] cobalt/syscall: dovetail: implement syscall hooks Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-02-21  0:59   ` chensong
  2021-03-08 11:26   ` Jan Kiszka
  2021-02-20 12:45 ` [PATCH 7/8] drivers/net: Kconfig: fix help stanzas in configuration blocks Philippe Gerum
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

In order to intimately connect Cobalt to the kernel, Dovetail allows
us to extend the latter with data and procedures we need:

- we can embed our own context information into a set of critical
  kernel data structures. This information should be defined as a set
  of core-specific types, such as struct oob_thread_state which is
  going to be part of struct thread_info.

- we can define preparation and finalization handlers for out-of-band
  IRQ handling, which Dovetail should invoke right after entering the
  outer interrupt frame, then right before leaving it respectively.

Add the couple of interface headers we need to connect those elements
to the kernel.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/include/dovetail/irq.h         | 52 ++++++++++++++++++++
 kernel/cobalt/include/dovetail/thread_info.h | 33 +++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 kernel/cobalt/include/dovetail/irq.h
 create mode 100644 kernel/cobalt/include/dovetail/thread_info.h

diff --git a/kernel/cobalt/include/dovetail/irq.h b/kernel/cobalt/include/dovetail/irq.h
new file mode 100644
index 000000000..66d020fde
--- /dev/null
+++ b/kernel/cobalt/include/dovetail/irq.h
@@ -0,0 +1,52 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2017 Philippe Gerum  <rpm@xenomai.org>
+ */
+
+#ifndef _COBALT_DOVETAIL_IRQ_H
+#define _COBALT_DOVETAIL_IRQ_H
+
+#ifdef CONFIG_XENOMAI
+
+#include <cobalt/kernel/sched.h>
+
+/* hard irqs off. */
+static inline void irq_enter_pipeline(void)
+{
+	struct xnsched *sched = xnsched_current();
+
+	sched->lflags |= XNINIRQ;
+}
+
+/* hard irqs off. */
+static inline void irq_exit_pipeline(void)
+{
+	struct xnsched *sched = xnsched_current();
+
+	sched->lflags &= ~XNINIRQ;
+
+	/*
+	 * CAUTION: Switching stages as a result of rescheduling may
+	 * re-enable irqs, shut them off before returning if so.
+	 */
+	if ((sched->status|sched->lflags) & XNRESCHED) {
+		xnsched_run();
+		if (!hard_irqs_disabled())
+			hard_local_irq_disable();
+	}
+}
+
+#else  /* !CONFIG_XENOMAI */
+
+static inline void irq_enter_pipeline(void)
+{
+}
+
+static inline void irq_exit_pipeline(void)
+{
+}
+
+#endif	/* !CONFIG_XENOMAI */
+
+#endif /* !_COBALT_DOVETAIL_IRQ_H */
diff --git a/kernel/cobalt/include/dovetail/thread_info.h b/kernel/cobalt/include/dovetail/thread_info.h
new file mode 100644
index 000000000..69b89de35
--- /dev/null
+++ b/kernel/cobalt/include/dovetail/thread_info.h
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2012 Philippe Gerum <rpm@xenomai.org>.
+ * Copyright (c) Siemens AG, 2020
+ *
+ * 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, Inc., 675 Mass Ave, Cambridge MA 02139,
+ * USA; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef _COBALT_DOVETAIL_THREAD_INFO_H
+#define _COBALT_DOVETAIL_THREAD_INFO_H
+
+struct xnthread;
+struct cobalt_process;
+
+struct oob_thread_state {
+	/* Core thread backlink. */
+	struct xnthread *thread;
+	/* User process backlink. NULL for core threads. */
+	struct cobalt_process *process;
+};
+
+#endif /* !_COBALT_DOVETAIL_THREAD_INFO_H */
-- 
2.26.2



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

* [PATCH 7/8] drivers/net: Kconfig: fix help stanzas in configuration blocks
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
                   ` (4 preceding siblings ...)
  2021-02-20 12:45 ` [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-02-20 12:45 ` [PATCH 8/8] cobalt/assert: remove extraneous header inclusion Philippe Gerum
  2021-03-08 11:48 ` [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Jan Kiszka
  7 siblings, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

The Kconfig parser became stricter, help stanzas must be introduced by
the naked "help" keyword, period. Let's drop all decorations.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/drivers/net/Kconfig                   |  2 +-
 kernel/drivers/net/addons/Kconfig            |  6 +++---
 kernel/drivers/net/drivers/Kconfig           |  6 +++---
 kernel/drivers/net/stack/Kconfig             |  6 +++---
 kernel/drivers/net/stack/ipv4/Kconfig        | 14 +++++++-------
 kernel/drivers/net/stack/ipv4/tcp/Kconfig    |  4 ++--
 kernel/drivers/net/stack/ipv4/udp/Kconfig    |  2 +-
 kernel/drivers/net/stack/packet/Kconfig      |  2 +-
 kernel/drivers/net/stack/rtcfg/Kconfig       |  4 ++--
 kernel/drivers/net/stack/rtmac/Kconfig       |  2 +-
 kernel/drivers/net/stack/rtmac/nomac/Kconfig |  2 +-
 kernel/drivers/net/stack/rtmac/tdma/Kconfig  |  4 ++--
 12 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/kernel/drivers/net/Kconfig b/kernel/drivers/net/Kconfig
index ac3bced25..2e8032464 100644
--- a/kernel/drivers/net/Kconfig
+++ b/kernel/drivers/net/Kconfig
@@ -10,7 +10,7 @@ if XENO_DRIVERS_NET
 config XENO_DRIVERS_RTNET_CHECKED
     bool "Internal Bug Checks"
     default n
-    ---help---
+    help
     Switch on if you face crashes when RTnet is running or if you suspect
     any other RTnet-related issues. This feature will add a few sanity
     checks at critical points that will produce warnings on the kernel
diff --git a/kernel/drivers/net/addons/Kconfig b/kernel/drivers/net/addons/Kconfig
index baa6cbcb9..e92f6d8ca 100644
--- a/kernel/drivers/net/addons/Kconfig
+++ b/kernel/drivers/net/addons/Kconfig
@@ -6,7 +6,7 @@ config XENO_DRIVERS_NET_ADDON_RTCAP
     select ETHERNET
     tristate "Real-Time Capturing Support"
     default n
-    ---help---
+    help
     This feature allows to capture real-time packets traversing the RTnet
     stack. It can both be used to sniff passively on a network (in this
     case you may want to enable the promisc mode of your real-time NIC via
@@ -22,7 +22,7 @@ config XENO_DRIVERS_NET_ADDON_PROXY
     select ETHERNET
     tristate "IP protocol proxy for Linux"
     default n
-    ---help---
+    help
     Enables a forward-to-Linux module for all IP protocols that are not
     handled by the IPv4 implemenation of RTnet (TCP, UDP, etc.). Only use
     when you know what you are doing - it can easily break your real-time
@@ -34,7 +34,7 @@ config XENO_DRIVERS_NET_ADDON_PROXY_ARP
     depends on XENO_DRIVERS_NET_ADDON_PROXY
     bool "Enable ARP handling via protocol proxy"
     default n
-    ---help---
+    help
     Enables ARP support for the IP protocol proxy. Incoming ARP replies
     are then delivered to both, the RTnet and the Linux network stack,
     but only answered by Linux. The IP protocol proxy gets attached to
diff --git a/kernel/drivers/net/drivers/Kconfig b/kernel/drivers/net/drivers/Kconfig
index b2df1110f..6889a500d 100644
--- a/kernel/drivers/net/drivers/Kconfig
+++ b/kernel/drivers/net/drivers/Kconfig
@@ -24,7 +24,7 @@ config XENO_DRIVERS_NET_DRV_EEPRO100_CMDTIMEOUT
     int "Command Timeout"
     depends on XENO_DRIVERS_NET_DRV_EEPRO100
     default 20
-    ---help---
+    help
     Timeout in microseconds of transmission or configuration commands that
     are issued in real-time contexts.
 
@@ -32,7 +32,7 @@ config XENO_DRIVERS_NET_DRV_EEPRO100_DBG
     depends on XENO_DRIVERS_NET && PCI
     bool "Enable debugging and instrumentation"
     depends on XENO_DRIVERS_NET_DRV_EEPRO100
-    ---help---
+    help
     This option switches on internal debugging code of the EEPRO/100 driver.
     It also enables the collection of worst-case command delays in real-time
     contexts in order to reduce the command timeout (which, effectively, will
@@ -127,7 +127,7 @@ config XENO_DRIVERS_NET_DRV_MACB
     depends on XENO_DRIVERS_NET
     select AT91_PROGRAMMABLE_CLOCKS if ARCH_AT91
     tristate "Cadence MACB/GEM devices"
-    ---help---
+    help
     Driver for internal MAC-controller on AT91SAM926x microcontrollers.
     Porting by Cristiano Mantovani and Stefano Banzi (Marposs SpA).
 
diff --git a/kernel/drivers/net/stack/Kconfig b/kernel/drivers/net/stack/Kconfig
index 830cec5ad..996536cc5 100644
--- a/kernel/drivers/net/stack/Kconfig
+++ b/kernel/drivers/net/stack/Kconfig
@@ -7,7 +7,7 @@ config XENO_DRIVERS_NET_RX_FIFO_SIZE
     int "Size of central RX-FIFO"
     depends on XENO_DRIVERS_NET
     default 32
-    ---help---
+    help
     Size of FIFO between NICs and stack manager task. Must be power
     of two! Effectively, only CONFIG_RTNET_RX_FIFO_SIZE-1 slots will
     be usable.
@@ -15,7 +15,7 @@ config XENO_DRIVERS_NET_RX_FIFO_SIZE
 config XENO_DRIVERS_NET_ETH_P_ALL
     depends on XENO_DRIVERS_NET
     bool "Support for ETH_P_ALL"
-    ---help---
+    help
     Enables core support for registering listeners on all layer 3
     protocols (ETH_P_ALL). Internally this is currently realised by
     clone-copying incoming frames for those listners, future versions
@@ -26,7 +26,7 @@ config XENO_DRIVERS_NET_ETH_P_ALL
 config XENO_DRIVERS_NET_RTWLAN
     depends on XENO_DRIVERS_NET
     bool "Real-Time WLAN"
-    ---help---
+    help
     Enables core support for real-time wireless LAN. RT-WLAN is based
     on low-level access to 802.11-compliant adapters and is currently
     in an experimental stage.
diff --git a/kernel/drivers/net/stack/ipv4/Kconfig b/kernel/drivers/net/stack/ipv4/Kconfig
index 8fb3c1acc..d5a6cd6d7 100644
--- a/kernel/drivers/net/stack/ipv4/Kconfig
+++ b/kernel/drivers/net/stack/ipv4/Kconfig
@@ -2,7 +2,7 @@ config XENO_DRIVERS_NET_RTIPV4
     depends on XENO_DRIVERS_NET
     tristate "Real-Time IPv4"
     default y
-    ---help---
+    help
     Enables the real-time capable IPv4 support of RTnet. The protocol is
     implemented as a separate module. Supplementing tools (rtroute,
     rtping) and examples are provided as well. Moreover, RTcfg will
@@ -15,7 +15,7 @@ config XENO_DRIVERS_NET_RTIPV4_ICMP
     bool "ICMP support"
     depends on XENO_DRIVERS_NET_RTIPV4
     default y
-    ---help---
+    help
     Enables ICMP support of the RTnet Real-Time IPv4 protocol.
 
     When the RTnet-Proxy is enabled while this feature is disabled, ICMP
@@ -25,7 +25,7 @@ config XENO_DRIVERS_NET_RTIPV4_HOST_ROUTES
     int "Maximum host routing table entries"
     depends on XENO_DRIVERS_NET_RTIPV4
     default 32
-    ---help---
+    help
     Each IPv4 supporting interface and each remote host that is directly
     reachable via via some output interface requires a host routing table
     entry. If you run larger networks with may hosts per subnet, you may
@@ -34,7 +34,7 @@ config XENO_DRIVERS_NET_RTIPV4_HOST_ROUTES
 config XENO_DRIVERS_NET_RTIPV4_NETROUTING
     bool "IP Network Routing"
     depends on XENO_DRIVERS_NET_RTIPV4
-    ---help---
+    help
     Enables routing across IPv4 real-time networks. You will only require
     this feature in complex networks, while switching it off for flat,
     single-segment networks improves code size and the worst-case routing
@@ -46,7 +46,7 @@ config XENO_DRIVERS_NET_RTIPV4_NET_ROUTES
     int "Maximum network routing table entries"
     depends on XENO_DRIVERS_NET_RTIPV4_NETROUTING
     default 16
-    ---help---
+    help
     Each route describing a target network reachable via a router
     requires an entry in the network routing table. If you run very
     complex realtime networks, you may have to increase this limit. Must
@@ -55,7 +55,7 @@ config XENO_DRIVERS_NET_RTIPV4_NET_ROUTES
 config XENO_DRIVERS_NET_RTIPV4_ROUTER
     bool "IP Router"
     depends on XENO_DRIVERS_NET_RTIPV4
-    ---help---
+    help
     When switched on, the RTnet station will be able to forward IPv4
     packets that are not directed to the station itself. Typically used in
     combination with CONFIG_RTNET_RTIPV4_NETROUTING.
@@ -67,7 +67,7 @@ config XENO_DRIVERS_NET_RTIPV4_DEBUG
     depends on XENO_DRIVERS_NET_RTIPV4
     default n
     
-    ---help---
+    help
     Enables debug message output of the RTipv4 layer. Typically, you
     may want to turn this on for tracing issues in packet delivery.
 
diff --git a/kernel/drivers/net/stack/ipv4/tcp/Kconfig b/kernel/drivers/net/stack/ipv4/tcp/Kconfig
index 5b1182d72..a69d34679 100644
--- a/kernel/drivers/net/stack/ipv4/tcp/Kconfig
+++ b/kernel/drivers/net/stack/ipv4/tcp/Kconfig
@@ -1,7 +1,7 @@
 config XENO_DRIVERS_NET_RTIPV4_TCP
     tristate "TCP support"
     depends on XENO_DRIVERS_NET_RTIPV4
-    ---help---
+    help
     Enables TCP support of the RTnet Real-Time IPv4 protocol.
 
     When the RTnet IPv4 is enabled while this feature is disabled, TCP
@@ -10,7 +10,7 @@ config XENO_DRIVERS_NET_RTIPV4_TCP
 config XENO_DRIVERS_NET_RTIPV4_TCP_ERROR_INJECTION
     bool "TCP error injection"
     depends on XENO_DRIVERS_NET_RTIPV4_TCP
-    ---help---
+    help
     Enables error injection for incoming TCP packets. This can be used
     to test both protocol as well as application behavior under error
     conditions. The per-socket error rate is 0 by default and can be
diff --git a/kernel/drivers/net/stack/ipv4/udp/Kconfig b/kernel/drivers/net/stack/ipv4/udp/Kconfig
index 77779a1a1..a23279411 100644
--- a/kernel/drivers/net/stack/ipv4/udp/Kconfig
+++ b/kernel/drivers/net/stack/ipv4/udp/Kconfig
@@ -2,5 +2,5 @@ config XENO_DRIVERS_NET_RTIPV4_UDP
     tristate "UDP support"
     depends on XENO_DRIVERS_NET_RTIPV4
     default y
-    ---help---
+    help
     Enables UDP support of the RTnet Real-Time IPv4 protocol.
diff --git a/kernel/drivers/net/stack/packet/Kconfig b/kernel/drivers/net/stack/packet/Kconfig
index 1424ffb6b..4c83b73c2 100644
--- a/kernel/drivers/net/stack/packet/Kconfig
+++ b/kernel/drivers/net/stack/packet/Kconfig
@@ -2,7 +2,7 @@ config XENO_DRIVERS_NET_RTPACKET
     depends on XENO_DRIVERS_NET
     tristate "Real-Time Packet Socket Support"
     default y
-    ---help---
+    help
     Enables real-time packet sockets for RTnet. This support is
     implemented in a separate module. When loaded, application programs
     can send and received so-called "cooked" packets directly at OSI layer
diff --git a/kernel/drivers/net/stack/rtcfg/Kconfig b/kernel/drivers/net/stack/rtcfg/Kconfig
index d5af3b826..38c484046 100644
--- a/kernel/drivers/net/stack/rtcfg/Kconfig
+++ b/kernel/drivers/net/stack/rtcfg/Kconfig
@@ -2,7 +2,7 @@ config XENO_DRIVERS_NET_RTCFG
     depends on XENO_DRIVERS_NET
     tristate "RTcfg Service"
     default y
-    ---help---
+    help
     The Real-Time Configuration service configures and monitors nodes in
     a RTnet network. It works both with plain MAC as well as with IPv4
     addresses (in case CONFIG_RTNET_RTIPV4 has been switched on). RTcfg
@@ -18,6 +18,6 @@ config XENO_DRIVERS_NET_RTCFG_DEBUG
     bool "RTcfg Debugging"
     depends on XENO_DRIVERS_NET_RTCFG
     default n
-    ---help---
+    help
     Enables debug message output of the RTcfg state machines. Switch on if
     you have to trace some problem related to RTcfg.
diff --git a/kernel/drivers/net/stack/rtmac/Kconfig b/kernel/drivers/net/stack/rtmac/Kconfig
index 604cb4bc1..a97b316b0 100644
--- a/kernel/drivers/net/stack/rtmac/Kconfig
+++ b/kernel/drivers/net/stack/rtmac/Kconfig
@@ -2,7 +2,7 @@ menuconfig XENO_DRIVERS_NET_RTMAC
     depends on XENO_DRIVERS_NET
     tristate "RTmac Layer"
     default y
-    ---help---
+    help
     The Real-Time Media Access Control layer allows to extend the RTnet
     stack with software-based access control mechanisms (also called
     disciplines) for nondeterministic transport media. Disciplines can be
diff --git a/kernel/drivers/net/stack/rtmac/nomac/Kconfig b/kernel/drivers/net/stack/rtmac/nomac/Kconfig
index 868673935..e706d4a96 100644
--- a/kernel/drivers/net/stack/rtmac/nomac/Kconfig
+++ b/kernel/drivers/net/stack/rtmac/nomac/Kconfig
@@ -2,7 +2,7 @@ config XENO_DRIVERS_NET_NOMAC
     tristate "NoMAC discipline for RTmac"
     depends on XENO_DRIVERS_NET_RTMAC
     default n
-    ---help---
+    help
     This no-operation RTmac discipline is intended to act as a template
     for new implementations. However, it can be compiled and used (see
     nomaccfg management tool), but don't expect any improved determinism
diff --git a/kernel/drivers/net/stack/rtmac/tdma/Kconfig b/kernel/drivers/net/stack/rtmac/tdma/Kconfig
index b56f8251a..4444661f2 100644
--- a/kernel/drivers/net/stack/rtmac/tdma/Kconfig
+++ b/kernel/drivers/net/stack/rtmac/tdma/Kconfig
@@ -2,7 +2,7 @@ config XENO_DRIVERS_NET_TDMA
     tristate "TDMA discipline for RTmac"
     depends on XENO_DRIVERS_NET_RTMAC
     default y
-    ---help---
+    help
     The Time Division Multiple Access discipline is the default RTmac
     protocol for Ethernet networks. It consists of a master synchronising
     the access of the slaves to the media by periodically issuing frames.
@@ -16,6 +16,6 @@ config XENO_DRIVERS_NET_TDMA_MASTER
     bool "TDMA master support"
     depends on XENO_DRIVERS_NET_TDMA
     default y
-    ---help---
+    help
     Enables TDMA master and backup master support for the node. This can
     be switched of to reduce the memory footprint of pure slave nodes.
-- 
2.26.2



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

* [PATCH 8/8] cobalt/assert: remove extraneous header inclusion
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
                   ` (5 preceding siblings ...)
  2021-02-20 12:45 ` [PATCH 7/8] drivers/net: Kconfig: fix help stanzas in configuration blocks Philippe Gerum
@ 2021-02-20 12:45 ` Philippe Gerum
  2021-03-08 11:28   ` Jan Kiszka
  2021-03-08 11:48 ` [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Jan Kiszka
  7 siblings, 1 reply; 19+ messages in thread
From: Philippe Gerum @ 2021-02-20 12:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

From: Philippe Gerum <rpm@xenomai.org>

In the same move, fix places which depend on such inclusion but fail
to pull the related headers directly.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/cobalt/kernel/assert.h | 3 ---
 kernel/cobalt/heap.c           | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
index 8d004476b..abe044100 100644
--- a/include/cobalt/kernel/assert.h
+++ b/include/cobalt/kernel/assert.h
@@ -20,9 +20,6 @@
 #define _COBALT_KERNEL_ASSERT_H
 
 #include <linux/kconfig.h>
-#include <pipeline/pipeline.h>
-#include <cobalt/kernel/trace.h>
-#include <cobalt/kernel/ancillaries.h>
 
 #define XENO_INFO	KERN_INFO    "[Xenomai] "
 #define XENO_WARNING	KERN_WARNING "[Xenomai] "
diff --git a/kernel/cobalt/heap.c b/kernel/cobalt/heap.c
index 5d14a4739..9e184d4c3 100644
--- a/kernel/cobalt/heap.c
+++ b/kernel/cobalt/heap.c
@@ -27,6 +27,7 @@
 #include <cobalt/kernel/assert.h>
 #include <cobalt/kernel/heap.h>
 #include <cobalt/kernel/vfile.h>
+#include <cobalt/kernel/ancillaries.h>
 
 /**
  * @ingroup cobalt_core
-- 
2.26.2



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

* Re: [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions
  2021-02-20 12:45 ` [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions Philippe Gerum
@ 2021-02-21  0:59   ` chensong
  2021-02-25 13:28     ` Philippe Gerum
  2021-03-08 11:26   ` Jan Kiszka
  1 sibling, 1 reply; 19+ messages in thread
From: chensong @ 2021-02-21  0:59 UTC (permalink / raw)
  To: Philippe Gerum, Jan Kiszka; +Cc: xenomai



On 2021年02月20日 20:45, Philippe Gerum via Xenomai wrote:
> From: Philippe Gerum <rpm@xenomai.org>
>
> In order to intimately connect Cobalt to the kernel, Dovetail allows
> us to extend the latter with data and procedures we need:
>
> - we can embed our own context information into a set of critical
>    kernel data structures. This information should be defined as a set
>    of core-specific types, such as struct oob_thread_state which is
>    going to be part of struct thread_info.
>
> - we can define preparation and finalization handlers for out-of-band
>    IRQ handling, which Dovetail should invoke right after entering the
>    outer interrupt frame, then right before leaving it respectively.
>
> Add the couple of interface headers we need to connect those elements
> to the kernel.
>
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>   kernel/cobalt/include/dovetail/irq.h         | 52 ++++++++++++++++++++
>   kernel/cobalt/include/dovetail/thread_info.h | 33 +++++++++++++
>   2 files changed, 85 insertions(+)
>   create mode 100644 kernel/cobalt/include/dovetail/irq.h
>   create mode 100644 kernel/cobalt/include/dovetail/thread_info.h
>
> diff --git a/kernel/cobalt/include/dovetail/irq.h b/kernel/cobalt/include/dovetail/irq.h
> new file mode 100644
> index 000000000..66d020fde
> --- /dev/null
> +++ b/kernel/cobalt/include/dovetail/irq.h
> @@ -0,0 +1,52 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0
> + *
> + * Copyright (C) 2017 Philippe Gerum  <rpm@xenomai.org>
> + */
> +
> +#ifndef _COBALT_DOVETAIL_IRQ_H
> +#define _COBALT_DOVETAIL_IRQ_H
> +
> +#ifdef CONFIG_XENOMAI
> +
> +#include <cobalt/kernel/sched.h>
> +
> +/* hard irqs off. */
> +static inline void irq_enter_pipeline(void)
> +{
> +	struct xnsched *sched = xnsched_current();
> +
> +	sched->lflags |= XNINIRQ;
> +}
> +
> +/* hard irqs off. */

should be "hard irqs on"?

> +static inline void irq_exit_pipeline(void)
> +{
> +	struct xnsched *sched = xnsched_current();
> +
> +	sched->lflags &= ~XNINIRQ;
> +
> +	/*
> +	 * CAUTION: Switching stages as a result of rescheduling may
> +	 * re-enable irqs, shut them off before returning if so.
> +	 */
> +	if ((sched->status|sched->lflags) & XNRESCHED) {
> +		xnsched_run();
> +		if (!hard_irqs_disabled())
> +			hard_local_irq_disable();
> +	}
> +}
> +
> +#else  /* !CONFIG_XENOMAI */
> +
> +static inline void irq_enter_pipeline(void)
> +{
> +}
> +
> +static inline void irq_exit_pipeline(void)
> +{
> +}
> +
> +#endif	/* !CONFIG_XENOMAI */
> +
> +#endif /* !_COBALT_DOVETAIL_IRQ_H */
> diff --git a/kernel/cobalt/include/dovetail/thread_info.h b/kernel/cobalt/include/dovetail/thread_info.h
> new file mode 100644
> index 000000000..69b89de35
> --- /dev/null
> +++ b/kernel/cobalt/include/dovetail/thread_info.h
> @@ -0,0 +1,33 @@
> +/**
> + * Copyright (C) 2012 Philippe Gerum <rpm@xenomai.org>.
> + * Copyright (c) Siemens AG, 2020
> + *
> + * 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, Inc., 675 Mass Ave, Cambridge MA 02139,
> + * USA; either version 2 of the License, or (at your option) any later
> + * version.
> + *
> + * This program 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 this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> + */
> +#ifndef _COBALT_DOVETAIL_THREAD_INFO_H
> +#define _COBALT_DOVETAIL_THREAD_INFO_H
> +
> +struct xnthread;
> +struct cobalt_process;
> +
> +struct oob_thread_state {
> +	/* Core thread backlink. */
> +	struct xnthread *thread;
> +	/* User process backlink. NULL for core threads. */
> +	struct cobalt_process *process;
> +};
> +
> +#endif /* !_COBALT_DOVETAIL_THREAD_INFO_H */
>


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

* Re: [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions
  2021-02-21  0:59   ` chensong
@ 2021-02-25 13:28     ` Philippe Gerum
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-02-25 13:28 UTC (permalink / raw)
  To: chensong; +Cc: Jan Kiszka, xenomai


chensong <chensong@kylinos.cn> writes:

> On 2021年02月20日 20:45, Philippe Gerum via Xenomai wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>>
>> In order to intimately connect Cobalt to the kernel, Dovetail allows
>> us to extend the latter with data and procedures we need:
>>
>> - we can embed our own context information into a set of critical
>>    kernel data structures. This information should be defined as a set
>>    of core-specific types, such as struct oob_thread_state which is
>>    going to be part of struct thread_info.
>>
>> - we can define preparation and finalization handlers for out-of-band
>>    IRQ handling, which Dovetail should invoke right after entering the
>>    outer interrupt frame, then right before leaving it respectively.
>>
>> Add the couple of interface headers we need to connect those elements
>> to the kernel.
>>
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>   kernel/cobalt/include/dovetail/irq.h         | 52 ++++++++++++++++++++
>>   kernel/cobalt/include/dovetail/thread_info.h | 33 +++++++++++++
>>   2 files changed, 85 insertions(+)
>>   create mode 100644 kernel/cobalt/include/dovetail/irq.h
>>   create mode 100644 kernel/cobalt/include/dovetail/thread_info.h
>>
>> diff --git a/kernel/cobalt/include/dovetail/irq.h b/kernel/cobalt/include/dovetail/irq.h
>> new file mode 100644
>> index 000000000..66d020fde
>> --- /dev/null
>> +++ b/kernel/cobalt/include/dovetail/irq.h
>> @@ -0,0 +1,52 @@
>> +/*
>> + * SPDX-License-Identifier: GPL-2.0
>> + *
>> + * Copyright (C) 2017 Philippe Gerum  <rpm@xenomai.org>
>> + */
>> +
>> +#ifndef _COBALT_DOVETAIL_IRQ_H
>> +#define _COBALT_DOVETAIL_IRQ_H
>> +
>> +#ifdef CONFIG_XENOMAI
>> +
>> +#include <cobalt/kernel/sched.h>
>> +
>> +/* hard irqs off. */
>> +static inline void irq_enter_pipeline(void)
>> +{
>> +	struct xnsched *sched = xnsched_current();
>> +
>> +	sched->lflags |= XNINIRQ;
>> +}
>> +
>> +/* hard irqs off. */
>
> should be "hard irqs on"?
>

The comment is ok, the interrupt pipeline always calls the exit handler
with hard irqs off.

-- 
Philippe.


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

* Re: [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management
  2021-02-20 12:45 ` [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management Philippe Gerum
@ 2021-03-08 11:22   ` Jan Kiszka
  2021-03-08 12:31     ` Philippe Gerum
  2021-03-11 15:53     ` Philippe Gerum
  0 siblings, 2 replies; 19+ messages in thread
From: Jan Kiszka @ 2021-03-08 11:22 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 20.02.21 13:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  .../cobalt/kernel/dovetail/pipeline/trace.h   | 123 ++++++++++++++++++
>  1 file changed, 123 insertions(+)
>  create mode 100644 include/cobalt/kernel/dovetail/pipeline/trace.h
> 
> diff --git a/include/cobalt/kernel/dovetail/pipeline/trace.h b/include/cobalt/kernel/dovetail/pipeline/trace.h
> new file mode 100644
> index 000000000..819b8a713
> --- /dev/null
> +++ b/include/cobalt/kernel/dovetail/pipeline/trace.h
> @@ -0,0 +1,123 @@
> +/*
> + * Copyright (C) 2006 Jan Kiszka <jan.kiszka@web.de>.
> + *

Should likely be updated when filled.

> + * 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.

And this can then be done shorter.

Both just remarks for future patches, no blockers.

> + */
> +#ifndef _COBALT_KERNEL_DOVETAIL_TRACE_H
> +#define _COBALT_KERNEL_DOVETAIL_TRACE_H
> +
> +#include <linux/types.h>
> +#include <linux/kconfig.h>
> +#include <cobalt/uapi/kernel/trace.h>
> +
> +static inline int xntrace_max_begin(unsigned long v)
> +{
> +//#chz: NTD
> +	//ipipe_trace_begin(v);
> +	return 0;
> +}
> +
> +static inline int xntrace_max_end(unsigned long v)
> +{
> +//#chz: NTD
> +	//ipipe_trace_end(v);
> +	return 0;
> +}
> +
> +static inline int xntrace_max_reset(void)
> +{
> +//#chz: NTD
> +	//ipipe_trace_max_reset();
> +	return 0;
> +}
> +
> +static inline int xntrace_user_start(void)
> +{
> +//#chz: NTD
> +	//return ipipe_trace_frozen_reset();
> +	return 0;
> +}
> +
> +static inline int xntrace_user_stop(unsigned long v)
> +{
> +//#chz: NTD
> +	//ipipe_trace_freeze(v);
> +	return 0;
> +}
> +
> +static inline int xntrace_user_freeze(unsigned long v, int once)
> +{
> +	int ret = 0;
> +//#chz: NTD
> +/*
> +	if (!once)
> +		ret = ipipe_trace_frozen_reset();
> +
> +	ipipe_trace_freeze(v);
> +*/
> +	return ret;
> +}
> +
> +static inline int xntrace_special(unsigned char id, unsigned long v)
> +{
> +//#chz: NTD
> +//	ipipe_trace_special(id, v);
> +	return 0;
> +}
> +
> +static inline int xntrace_special_u64(unsigned char id,
> +					unsigned long long v)
> +{
> +//#chz: NTD
> +//	ipipe_trace_special(id, (unsigned long)(v >> 32));
> +//	ipipe_trace_special(id, (unsigned long)(v & 0xFFFFFFFF));
> +	return 0;
> +}
> +
> +static inline int xntrace_pid(pid_t pid, short prio)
> +{
> +//#chz: NTD
> +//	ipipe_trace_pid(pid, prio);
> +	return 0;
> +}
> +
> +static inline int xntrace_tick(unsigned long delay_ticks)
> +{
> +//#chz: NTD
> +//	ipipe_trace_event(0, delay_ticks);
> +	return 0;
> +}
> +
> +static inline int xntrace_panic_freeze(void)
> +{
> +//#chz: NTD
> +//	ipipe_trace_panic_freeze();
> +	return 0;
> +}
> +
> +static inline int xntrace_panic_dump(void)
> +{
> +//#chz: NTD
> +//	ipipe_trace_panic_dump();
> +	return 0;
> +}
> +
> +static inline bool xntrace_enabled(void)
> +{
> +	return IS_ENABLED(CONFIG_DOVETAIL_TRACE);
> +}
> +
> +#endif /* !_COBALT_KERNEL_DOVETAIL_TRACE_H */
> 

Jan

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


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

* Re: [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions
  2021-02-20 12:45 ` [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions Philippe Gerum
  2021-02-21  0:59   ` chensong
@ 2021-03-08 11:26   ` Jan Kiszka
  1 sibling, 0 replies; 19+ messages in thread
From: Jan Kiszka @ 2021-03-08 11:26 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 20.02.21 13:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> In order to intimately connect Cobalt to the kernel, Dovetail allows
> us to extend the latter with data and procedures we need:
> 
> - we can embed our own context information into a set of critical
>   kernel data structures. This information should be defined as a set
>   of core-specific types, such as struct oob_thread_state which is
>   going to be part of struct thread_info.
> 
> - we can define preparation and finalization handlers for out-of-band
>   IRQ handling, which Dovetail should invoke right after entering the
>   outer interrupt frame, then right before leaving it respectively.
> 
> Add the couple of interface headers we need to connect those elements
> to the kernel.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  kernel/cobalt/include/dovetail/irq.h         | 52 ++++++++++++++++++++
>  kernel/cobalt/include/dovetail/thread_info.h | 33 +++++++++++++
>  2 files changed, 85 insertions(+)
>  create mode 100644 kernel/cobalt/include/dovetail/irq.h
>  create mode 100644 kernel/cobalt/include/dovetail/thread_info.h
> 
> diff --git a/kernel/cobalt/include/dovetail/irq.h b/kernel/cobalt/include/dovetail/irq.h
> new file mode 100644
> index 000000000..66d020fde
> --- /dev/null
> +++ b/kernel/cobalt/include/dovetail/irq.h
> @@ -0,0 +1,52 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0
> + *
> + * Copyright (C) 2017 Philippe Gerum  <rpm@xenomai.org>
> + */
> +
> +#ifndef _COBALT_DOVETAIL_IRQ_H
> +#define _COBALT_DOVETAIL_IRQ_H
> +
> +#ifdef CONFIG_XENOMAI
> +
> +#include <cobalt/kernel/sched.h>
> +
> +/* hard irqs off. */
> +static inline void irq_enter_pipeline(void)
> +{
> +	struct xnsched *sched = xnsched_current();
> +
> +	sched->lflags |= XNINIRQ;
> +}
> +
> +/* hard irqs off. */
> +static inline void irq_exit_pipeline(void)
> +{
> +	struct xnsched *sched = xnsched_current();
> +
> +	sched->lflags &= ~XNINIRQ;
> +
> +	/*
> +	 * CAUTION: Switching stages as a result of rescheduling may
> +	 * re-enable irqs, shut them off before returning if so.
> +	 */
> +	if ((sched->status|sched->lflags) & XNRESCHED) {
> +		xnsched_run();
> +		if (!hard_irqs_disabled())
> +			hard_local_irq_disable();
> +	}
> +}
> +
> +#else  /* !CONFIG_XENOMAI */
> +
> +static inline void irq_enter_pipeline(void)
> +{
> +}
> +
> +static inline void irq_exit_pipeline(void)
> +{
> +}
> +
> +#endif	/* !CONFIG_XENOMAI */
> +
> +#endif /* !_COBALT_DOVETAIL_IRQ_H */
> diff --git a/kernel/cobalt/include/dovetail/thread_info.h b/kernel/cobalt/include/dovetail/thread_info.h
> new file mode 100644
> index 000000000..69b89de35
> --- /dev/null
> +++ b/kernel/cobalt/include/dovetail/thread_info.h
> @@ -0,0 +1,33 @@
> +/**
> + * Copyright (C) 2012 Philippe Gerum <rpm@xenomai.org>.
> + * Copyright (c) Siemens AG, 2020
> + *
> + * 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, Inc., 675 Mass Ave, Cambridge MA 02139,
> + * USA; either version 2 of the License, or (at your option) any later
> + * version.
> + *
> + * This program 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 this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Also a stale copyright header.

> + */
> +#ifndef _COBALT_DOVETAIL_THREAD_INFO_H
> +#define _COBALT_DOVETAIL_THREAD_INFO_H
> +
> +struct xnthread;
> +struct cobalt_process;
> +
> +struct oob_thread_state {
> +	/* Core thread backlink. */
> +	struct xnthread *thread;
> +	/* User process backlink. NULL for core threads. */
> +	struct cobalt_process *process;
> +};
> +
> +#endif /* !_COBALT_DOVETAIL_THREAD_INFO_H */
> 

Jan

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


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

* Re: [PATCH 8/8] cobalt/assert: remove extraneous header inclusion
  2021-02-20 12:45 ` [PATCH 8/8] cobalt/assert: remove extraneous header inclusion Philippe Gerum
@ 2021-03-08 11:28   ` Jan Kiszka
  0 siblings, 0 replies; 19+ messages in thread
From: Jan Kiszka @ 2021-03-08 11:28 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 20.02.21 13:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> In the same move, fix places which depend on such inclusion but fail
> to pull the related headers directly.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  include/cobalt/kernel/assert.h | 3 ---
>  kernel/cobalt/heap.c           | 1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
> index 8d004476b..abe044100 100644
> --- a/include/cobalt/kernel/assert.h
> +++ b/include/cobalt/kernel/assert.h
> @@ -20,9 +20,6 @@
>  #define _COBALT_KERNEL_ASSERT_H
>  
>  #include <linux/kconfig.h>
> -#include <pipeline/pipeline.h>
> -#include <cobalt/kernel/trace.h>
> -#include <cobalt/kernel/ancillaries.h>
>  
>  #define XENO_INFO	KERN_INFO    "[Xenomai] "
>  #define XENO_WARNING	KERN_WARNING "[Xenomai] "
> diff --git a/kernel/cobalt/heap.c b/kernel/cobalt/heap.c
> index 5d14a4739..9e184d4c3 100644
> --- a/kernel/cobalt/heap.c
> +++ b/kernel/cobalt/heap.c
> @@ -27,6 +27,7 @@
>  #include <cobalt/kernel/assert.h>
>  #include <cobalt/kernel/heap.h>
>  #include <cobalt/kernel/vfile.h>
> +#include <cobalt/kernel/ancillaries.h>
>  
>  /**
>   * @ingroup cobalt_core
> 

Thanks, all 8 applied to next, testing now.

Please make sure to address my minor remarks when touching the
placeholder files in upcoming patches.

Jan

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


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

* Re: [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly
  2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
                   ` (6 preceding siblings ...)
  2021-02-20 12:45 ` [PATCH 8/8] cobalt/assert: remove extraneous header inclusion Philippe Gerum
@ 2021-03-08 11:48 ` Jan Kiszka
  2021-03-08 12:01   ` Jan Kiszka
  7 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2021-03-08 11:48 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 20.02.21 13:45, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> Since the low-level tick management code is pipeline specific, we may
> flatten the call stack by using the underlying pipeline API directly.
> 
> At this chance, fix a uniprocessor build issue with IPIs.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  .../kernel/dovetail/pipeline/pipeline.h       | 23 ++++++++++++++++++-
>  .../cobalt/kernel/ipipe/pipeline/pipeline.h   | 20 ++++++++--------
>  include/cobalt/kernel/timer.h                 | 11 ---------
>  kernel/cobalt/ipipe/tick.c                    | 11 ++++++---
>  kernel/cobalt/sched.c                         |  4 ----
>  kernel/cobalt/timer.c                         | 10 --------
>  6 files changed, 39 insertions(+), 40 deletions(-)
> 
> diff --git a/include/cobalt/kernel/dovetail/pipeline/pipeline.h b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
> index 4b8f6b259..a2e025e35 100644
> --- a/include/cobalt/kernel/dovetail/pipeline/pipeline.h
> +++ b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
> @@ -74,7 +74,28 @@ static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
>  	TODO();
>  }
>  
> -#endif
> +#else  /* !CONFIG_SMP */
> +
> +static inline int pipeline_request_resched_ipi(void (*handler)(void))
> +{
> +	return 0;
> +}
> +
> +
> +static inline void pipeline_free_resched_ipi(void)
> +{
> +}
> +
> +static inline int pipeline_request_timer_ipi(void (*handler)(void))
> +{
> +	return 0;
> +}
> +
> +static inline void pipeline_free_timer_ipi(void)
> +{
> +}
> +
> +#endif	/* CONFIG_SMP */
>  
>  static inline void pipeline_prepare_panic(void)
>  {
> diff --git a/include/cobalt/kernel/ipipe/pipeline/pipeline.h b/include/cobalt/kernel/ipipe/pipeline/pipeline.h
> index fb0465fb2..ceba7e3b0 100644
> --- a/include/cobalt/kernel/ipipe/pipeline/pipeline.h
> +++ b/include/cobalt/kernel/ipipe/pipeline/pipeline.h
> @@ -51,26 +51,24 @@ static inline void pipeline_send_resched_ipi(const struct cpumask *dest)
>  	ipipe_send_ipi(IPIPE_RESCHEDULE_IPI, *dest);
>  }
>  
> -static inline int pipeline_request_timer_ipi(void (*handler)(void))
> +static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
>  {
> -	return ipipe_request_irq(&cobalt_pipeline.domain,
> -				IPIPE_HRTIMER_IPI,
> -				(ipipe_irq_handler_t)handler,
> -				NULL, NULL);
> +	ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
>  }
>  
> -static inline void pipeline_free_timer_ipi(void)
> +#else  /* !CONFIG_SMP */
> +
> +static inline int pipeline_request_resched_ipi(void (*handler)(void))
>  {
> -	return ipipe_free_irq(&cobalt_pipeline.domain,
> -			IPIPE_HRTIMER_IPI);
> +	return 0;
>  }
>  
> -static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
> +
> +static inline void pipeline_free_resched_ipi(void)
>  {
> -	ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
>  }
>  
> -#endif
> +#endif	/* CONFIG_SMP */
>  
>  static inline void pipeline_prepare_panic(void)
>  {
> diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
> index 691be7a3b..703a13506 100644
> --- a/include/cobalt/kernel/timer.h
> +++ b/include/cobalt/kernel/timer.h
> @@ -517,10 +517,6 @@ void xntimer_migrate(struct xntimer *timer, struct xnsched *sched)
>  		__xntimer_migrate(timer, sched);
>  }
>  
> -int xntimer_setup_ipi(void);
> -
> -void xntimer_release_ipi(void);
> -
>  void __xntimer_set_affinity(struct xntimer *timer,
>  			    struct xnsched *sched);
>  
> @@ -539,13 +535,6 @@ static inline void xntimer_migrate(struct xntimer *timer,
>  	timer->sched = sched;
>  }
>  
> -static inline int xntimer_setup_ipi(void)
> -{
> -	return 0;
> -}
> -
> -static inline void xntimer_release_ipi(void) { }
> -
>  static inline void xntimer_set_affinity(struct xntimer *timer,
>  					struct xnsched *sched)
>  {
> diff --git a/kernel/cobalt/ipipe/tick.c b/kernel/cobalt/ipipe/tick.c
> index da1563a66..b80e56dc7 100644
> --- a/kernel/cobalt/ipipe/tick.c
> +++ b/kernel/cobalt/ipipe/tick.c
> @@ -187,7 +187,10 @@ int pipeline_install_tick_proxy(void)
>  	nkclock.wallclock_offset =
>  		ktime_to_ns(ktime_get_real()) - xnclock_read_monotonic(&nkclock);
>  
> -	ret = xntimer_setup_ipi();
> +	ret = ipipe_request_irq(&cobalt_pipeline.domain,
> +				IPIPE_HRTIMER_IPI,
> +				(ipipe_irq_handler_t)xnintr_core_clock_handler,
> +				NULL, NULL);

This seems to be built also for !SMP. PowerPC defines IPIPE_HRTIMER_IPI
only in the SMP case and exposes this. Is wrapping request/free irq
enough, or is there more dead code?

Jan

>  	if (ret)
>  		return ret;
>  
> @@ -244,7 +247,8 @@ fail:
>  		ipipe_timer_stop(_cpu);
>  	}
>  
> -	xntimer_release_ipi();
> +	ipipe_free_irq(&cobalt_pipeline.domain,
> +		       IPIPE_HRTIMER_IPI);
>  
>  	return ret;
>  }
> @@ -270,7 +274,8 @@ void pipeline_uninstall_tick_proxy(void)
>  	for_each_realtime_cpu(cpu)
>  		ipipe_timer_stop(cpu);
>  
> -	xntimer_release_ipi();
> +	ipipe_free_irq(&cobalt_pipeline.domain,
> +		       IPIPE_HRTIMER_IPI);
>  
>  #ifdef CONFIG_XENO_OPT_STATS_IRQS
>  	xnintr_destroy(&nktimer);
> diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
> index 8a5621642..7873fd652 100644
> --- a/kernel/cobalt/sched.c
> +++ b/kernel/cobalt/sched.c
> @@ -235,9 +235,7 @@ void xnsched_init_all(void)
>  		xnsched_init(sched, cpu);
>  	}
>  
> -#ifdef CONFIG_SMP
>  	pipeline_request_resched_ipi(__xnsched_run_handler);
> -#endif
>  }
>  
>  static void xnsched_destroy(struct xnsched *sched)
> @@ -258,9 +256,7 @@ void xnsched_destroy_all(void)
>  	int cpu;
>  	spl_t s;
>  
> -#ifdef CONFIG_SMP
>  	pipeline_free_resched_ipi();
> -#endif
>  
>  	xnlock_get_irqsave(&nklock, s);
>  
> diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
> index 7f5033c87..f9aa457ce 100644
> --- a/kernel/cobalt/timer.c
> +++ b/kernel/cobalt/timer.c
> @@ -574,16 +574,6 @@ void __xntimer_set_affinity(struct xntimer *timer, struct xnsched *sched)
>  }
>  EXPORT_SYMBOL_GPL(__xntimer_set_affinity);
>  
> -int xntimer_setup_ipi(void)
> -{
> -	return pipeline_request_timer_ipi(xnintr_core_clock_handler);
> -}
> -
> -void xntimer_release_ipi(void)
> -{
> -	pipeline_free_timer_ipi();
> -}
> -
>  #endif /* CONFIG_SMP */
>  
>  /**
> 

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


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

* Re: [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly
  2021-03-08 11:48 ` [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Jan Kiszka
@ 2021-03-08 12:01   ` Jan Kiszka
  0 siblings, 0 replies; 19+ messages in thread
From: Jan Kiszka @ 2021-03-08 12:01 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 08.03.21 12:48, Jan Kiszka wrote:
> On 20.02.21 13:45, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>>
>> Since the low-level tick management code is pipeline specific, we may
>> flatten the call stack by using the underlying pipeline API directly.
>>
>> At this chance, fix a uniprocessor build issue with IPIs.
>>
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  .../kernel/dovetail/pipeline/pipeline.h       | 23 ++++++++++++++++++-
>>  .../cobalt/kernel/ipipe/pipeline/pipeline.h   | 20 ++++++++--------
>>  include/cobalt/kernel/timer.h                 | 11 ---------
>>  kernel/cobalt/ipipe/tick.c                    | 11 ++++++---
>>  kernel/cobalt/sched.c                         |  4 ----
>>  kernel/cobalt/timer.c                         | 10 --------
>>  6 files changed, 39 insertions(+), 40 deletions(-)
>>
>> diff --git a/include/cobalt/kernel/dovetail/pipeline/pipeline.h b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
>> index 4b8f6b259..a2e025e35 100644
>> --- a/include/cobalt/kernel/dovetail/pipeline/pipeline.h
>> +++ b/include/cobalt/kernel/dovetail/pipeline/pipeline.h
>> @@ -74,7 +74,28 @@ static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
>>  	TODO();
>>  }
>>  
>> -#endif
>> +#else  /* !CONFIG_SMP */
>> +
>> +static inline int pipeline_request_resched_ipi(void (*handler)(void))
>> +{
>> +	return 0;
>> +}
>> +
>> +
>> +static inline void pipeline_free_resched_ipi(void)
>> +{
>> +}
>> +
>> +static inline int pipeline_request_timer_ipi(void (*handler)(void))
>> +{
>> +	return 0;
>> +}
>> +
>> +static inline void pipeline_free_timer_ipi(void)
>> +{
>> +}
>> +
>> +#endif	/* CONFIG_SMP */
>>  
>>  static inline void pipeline_prepare_panic(void)
>>  {
>> diff --git a/include/cobalt/kernel/ipipe/pipeline/pipeline.h b/include/cobalt/kernel/ipipe/pipeline/pipeline.h
>> index fb0465fb2..ceba7e3b0 100644
>> --- a/include/cobalt/kernel/ipipe/pipeline/pipeline.h
>> +++ b/include/cobalt/kernel/ipipe/pipeline/pipeline.h
>> @@ -51,26 +51,24 @@ static inline void pipeline_send_resched_ipi(const struct cpumask *dest)
>>  	ipipe_send_ipi(IPIPE_RESCHEDULE_IPI, *dest);
>>  }
>>  
>> -static inline int pipeline_request_timer_ipi(void (*handler)(void))
>> +static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
>>  {
>> -	return ipipe_request_irq(&cobalt_pipeline.domain,
>> -				IPIPE_HRTIMER_IPI,
>> -				(ipipe_irq_handler_t)handler,
>> -				NULL, NULL);
>> +	ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
>>  }
>>  
>> -static inline void pipeline_free_timer_ipi(void)
>> +#else  /* !CONFIG_SMP */
>> +
>> +static inline int pipeline_request_resched_ipi(void (*handler)(void))
>>  {
>> -	return ipipe_free_irq(&cobalt_pipeline.domain,
>> -			IPIPE_HRTIMER_IPI);
>> +	return 0;
>>  }
>>  
>> -static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
>> +
>> +static inline void pipeline_free_resched_ipi(void)
>>  {
>> -	ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
>>  }
>>  
>> -#endif
>> +#endif	/* CONFIG_SMP */
>>  
>>  static inline void pipeline_prepare_panic(void)
>>  {
>> diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h
>> index 691be7a3b..703a13506 100644
>> --- a/include/cobalt/kernel/timer.h
>> +++ b/include/cobalt/kernel/timer.h
>> @@ -517,10 +517,6 @@ void xntimer_migrate(struct xntimer *timer, struct xnsched *sched)
>>  		__xntimer_migrate(timer, sched);
>>  }
>>  
>> -int xntimer_setup_ipi(void);
>> -
>> -void xntimer_release_ipi(void);
>> -
>>  void __xntimer_set_affinity(struct xntimer *timer,
>>  			    struct xnsched *sched);
>>  
>> @@ -539,13 +535,6 @@ static inline void xntimer_migrate(struct xntimer *timer,
>>  	timer->sched = sched;
>>  }
>>  
>> -static inline int xntimer_setup_ipi(void)
>> -{
>> -	return 0;
>> -}
>> -
>> -static inline void xntimer_release_ipi(void) { }
>> -
>>  static inline void xntimer_set_affinity(struct xntimer *timer,
>>  					struct xnsched *sched)
>>  {
>> diff --git a/kernel/cobalt/ipipe/tick.c b/kernel/cobalt/ipipe/tick.c
>> index da1563a66..b80e56dc7 100644
>> --- a/kernel/cobalt/ipipe/tick.c
>> +++ b/kernel/cobalt/ipipe/tick.c
>> @@ -187,7 +187,10 @@ int pipeline_install_tick_proxy(void)
>>  	nkclock.wallclock_offset =
>>  		ktime_to_ns(ktime_get_real()) - xnclock_read_monotonic(&nkclock);
>>  
>> -	ret = xntimer_setup_ipi();
>> +	ret = ipipe_request_irq(&cobalt_pipeline.domain,
>> +				IPIPE_HRTIMER_IPI,
>> +				(ipipe_irq_handler_t)xnintr_core_clock_handler,
>> +				NULL, NULL);
> 
> This seems to be built also for !SMP. PowerPC defines IPIPE_HRTIMER_IPI
> only in the SMP case and exposes this. Is wrapping request/free irq
> enough, or is there more dead code?
> 

It fixed the build, so I've done that now in this patch.

Jan

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


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

* Re: [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management
  2021-03-08 11:22   ` Jan Kiszka
@ 2021-03-08 12:31     ` Philippe Gerum
  2021-03-11 15:53     ` Philippe Gerum
  1 sibling, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-03-08 12:31 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


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

> On 20.02.21 13:45, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  .../cobalt/kernel/dovetail/pipeline/trace.h   | 123 ++++++++++++++++++
>>  1 file changed, 123 insertions(+)
>>  create mode 100644 include/cobalt/kernel/dovetail/pipeline/trace.h
>> 
>> diff --git a/include/cobalt/kernel/dovetail/pipeline/trace.h b/include/cobalt/kernel/dovetail/pipeline/trace.h
>> new file mode 100644
>> index 000000000..819b8a713
>> --- /dev/null
>> +++ b/include/cobalt/kernel/dovetail/pipeline/trace.h
>> @@ -0,0 +1,123 @@
>> +/*
>> + * Copyright (C) 2006 Jan Kiszka <jan.kiszka@web.de>.
>> + *
>
> Should likely be updated when filled.
>
>> + * 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.
>
> And this can then be done shorter.
>
> Both just remarks for future patches, no blockers.

I moved to SPDX tags for libevl and the EVL core. I believe this is the
way to go.

-- 
Philippe.


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

* Re: [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management
  2021-03-08 11:22   ` Jan Kiszka
  2021-03-08 12:31     ` Philippe Gerum
@ 2021-03-11 15:53     ` Philippe Gerum
  2021-03-11 15:55       ` Jan Kiszka
  1 sibling, 1 reply; 19+ messages in thread
From: Philippe Gerum @ 2021-03-11 15:53 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


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

> On 20.02.21 13:45, Philippe Gerum wrote:
>> From: Philippe Gerum <rpm@xenomai.org>
>> 
>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>> ---
>>  .../cobalt/kernel/dovetail/pipeline/trace.h   | 123 ++++++++++++++++++
>>  1 file changed, 123 insertions(+)
>>  create mode 100644 include/cobalt/kernel/dovetail/pipeline/trace.h
>> 
>> diff --git a/include/cobalt/kernel/dovetail/pipeline/trace.h b/include/cobalt/kernel/dovetail/pipeline/trace.h
>> new file mode 100644
>> index 000000000..819b8a713
>> --- /dev/null
>> +++ b/include/cobalt/kernel/dovetail/pipeline/trace.h
>> @@ -0,0 +1,123 @@
>> +/*
>> + * Copyright (C) 2006 Jan Kiszka <jan.kiszka@web.de>.
>> + *
>
> Should likely be updated when filled.
>

I'm refraining from modifying others' copyright stanzas. When splitting
an existing file, I most often duplicate the copyright notice of the
original one into the resulting files "as is".

-- 
Philippe.


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

* Re: [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management
  2021-03-11 15:53     ` Philippe Gerum
@ 2021-03-11 15:55       ` Jan Kiszka
  2021-03-11 16:18         ` Philippe Gerum
  0 siblings, 1 reply; 19+ messages in thread
From: Jan Kiszka @ 2021-03-11 15:55 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 11.03.21 16:53, Philippe Gerum wrote:
> 
> Jan Kiszka <jan.kiszka@siemens.com> writes:
> 
>> On 20.02.21 13:45, Philippe Gerum wrote:
>>> From: Philippe Gerum <rpm@xenomai.org>
>>>
>>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>>> ---
>>>  .../cobalt/kernel/dovetail/pipeline/trace.h   | 123 ++++++++++++++++++
>>>  1 file changed, 123 insertions(+)
>>>  create mode 100644 include/cobalt/kernel/dovetail/pipeline/trace.h
>>>
>>> diff --git a/include/cobalt/kernel/dovetail/pipeline/trace.h b/include/cobalt/kernel/dovetail/pipeline/trace.h
>>> new file mode 100644
>>> index 000000000..819b8a713
>>> --- /dev/null
>>> +++ b/include/cobalt/kernel/dovetail/pipeline/trace.h
>>> @@ -0,0 +1,123 @@
>>> +/*
>>> + * Copyright (C) 2006 Jan Kiszka <jan.kiszka@web.de>.
>>> + *
>>
>> Should likely be updated when filled.
>>
> 
> I'm refraining from modifying others' copyright stanzas. When splitting
> an existing file, I most often duplicate the copyright notice of the
> original one into the resulting files "as is".
> 

By the time you drop in your implementation and remove mine from the
stubs, just update this because latest then the copyright changed.

Jan

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


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

* Re: [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management
  2021-03-11 15:55       ` Jan Kiszka
@ 2021-03-11 16:18         ` Philippe Gerum
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Gerum @ 2021-03-11 16:18 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


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

> On 11.03.21 16:53, Philippe Gerum wrote:
>> 
>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>> 
>>> On 20.02.21 13:45, Philippe Gerum wrote:
>>>> From: Philippe Gerum <rpm@xenomai.org>
>>>>
>>>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>>>> ---
>>>>  .../cobalt/kernel/dovetail/pipeline/trace.h   | 123 ++++++++++++++++++
>>>>  1 file changed, 123 insertions(+)
>>>>  create mode 100644 include/cobalt/kernel/dovetail/pipeline/trace.h
>>>>
>>>> diff --git a/include/cobalt/kernel/dovetail/pipeline/trace.h b/include/cobalt/kernel/dovetail/pipeline/trace.h
>>>> new file mode 100644
>>>> index 000000000..819b8a713
>>>> --- /dev/null
>>>> +++ b/include/cobalt/kernel/dovetail/pipeline/trace.h
>>>> @@ -0,0 +1,123 @@
>>>> +/*
>>>> + * Copyright (C) 2006 Jan Kiszka <jan.kiszka@web.de>.
>>>> + *
>>>
>>> Should likely be updated when filled.
>>>
>> 
>> I'm refraining from modifying others' copyright stanzas. When splitting
>> an existing file, I most often duplicate the copyright notice of the
>> original one into the resulting files "as is".
>> 
>
> By the time you drop in your implementation and remove mine from the
> stubs, just update this because latest then the copyright changed.
>

Well, I did this out of courtesy because you actually defined the
original API, which is where the value is (how this API operates is
pretty much accessory). And that API stays. Anyway, I may update the
notice next time I work on this code, this is not an issue.

-- 
Philippe.


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

end of thread, other threads:[~2021-03-11 16:18 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-20 12:45 [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Philippe Gerum
2021-02-20 12:45 ` [PATCH 2/8] cobalt/tick: dovetail: add placeholders for tick management Philippe Gerum
2021-02-20 12:45 ` [PATCH 3/8] cobalt/trace: dovetail: add placeholders for trace management Philippe Gerum
2021-03-08 11:22   ` Jan Kiszka
2021-03-08 12:31     ` Philippe Gerum
2021-03-11 15:53     ` Philippe Gerum
2021-03-11 15:55       ` Jan Kiszka
2021-03-11 16:18         ` Philippe Gerum
2021-02-20 12:45 ` [PATCH 4/8] cobalt/wrapper: dovetail: add empty placeholder Philippe Gerum
2021-02-20 12:45 ` [PATCH 5/8] cobalt/syscall: dovetail: implement syscall hooks Philippe Gerum
2021-02-20 12:45 ` [PATCH 6/8] cobalt/dovetail: provide core-specific context extensions Philippe Gerum
2021-02-21  0:59   ` chensong
2021-02-25 13:28     ` Philippe Gerum
2021-03-08 11:26   ` Jan Kiszka
2021-02-20 12:45 ` [PATCH 7/8] drivers/net: Kconfig: fix help stanzas in configuration blocks Philippe Gerum
2021-02-20 12:45 ` [PATCH 8/8] cobalt/assert: remove extraneous header inclusion Philippe Gerum
2021-03-08 11:28   ` Jan Kiszka
2021-03-08 11:48 ` [PATCH 1/8] cobalt/tick: use the underlying pipeline timer API directly Jan Kiszka
2021-03-08 12:01   ` Jan Kiszka

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