* [PATCH v3][wip/dovetail] cobalt/sched: init RESCHEDULE_OOB_IPI and register interrupt handler
@ 2020-10-28 8:07 Chen, Hongzhan
2020-10-28 8:22 ` Jan Kiszka
0 siblings, 1 reply; 2+ messages in thread
From: Chen, Hongzhan @ 2020-10-28 8:07 UTC (permalink / raw)
To: Jan Kiszka, Xenomai@xenomai.org
create and register RESCHEDULE_OOB_IPI interrupt handler
Signed-off-by: hongzha1 <hongzhan.chen@intel.com>
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index f39becb90..36eff09d4 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -30,6 +30,13 @@
#define CREATE_TRACE_POINTS
#include <trace/events/cobalt-core.h>
+struct xn_machine_cpudata {
+};
+
+DEFINE_PER_CPU(struct xn_machine_cpudata, xn_machine_cpudata);
+
+static void xnsched_destroy(struct xnsched *sched);
+
/**
* @ingroup cobalt_core
* @defgroup cobalt_core_sched Thread scheduling control
@@ -224,10 +231,18 @@ static void xnsched_init(struct xnsched *sched, int cpu)
#endif /* CONFIG_XENO_OPT_WATCHDOG */
}
+static irqreturn_t reschedule_interrupt(int irq, void *dev_id)
+{
+ __xnsched_run_handler();
+
+ return IRQ_HANDLED;
+}
+
void xnsched_init_all(void)
{
struct xnsched *sched;
int cpu;
+ int ret;
for_each_online_cpu(cpu) {
sched = &per_cpu(nksched, cpu);
@@ -235,12 +250,22 @@ void xnsched_init_all(void)
}
#ifdef CONFIG_SMP
-#warning TODO
-/* ipipe_request_irq(&xnsched_realtime_domain,
- IPIPE_RESCHEDULE_IPI,
- (ipipe_irq_handler_t)__xnsched_run_handler,
- NULL, NULL);*/
+ ret = __request_percpu_irq(RESCHEDULE_OOB_IPI,
+ reschedule_interrupt,
+ IRQF_OOB,
+ "Xenomai reschedule",
+ &xn_machine_cpudata);
+ if (ret)
+ goto cleanup_sched;
#endif
+ return;
+
+cleanup_sched:
+ for_each_online_cpu(cpu) {
+ sched = xnsched_struct(cpu);
+ xnsched_destroy(sched);
+ }
+
}
static void xnsched_destroy(struct xnsched *sched)
@@ -262,8 +287,7 @@ void xnsched_destroy_all(void)
spl_t s;
#ifdef CONFIG_SMP
-#warning TODO
-// ipipe_free_irq(&xnsched_realtime_domain, IPIPE_RESCHEDULE_IPI);
+ free_percpu_irq(RESCHEDULE_OOB_IPI, &xn_machine_cpudata);
#endif
xnlock_get_irqsave(&nklock, s);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3][wip/dovetail] cobalt/sched: init RESCHEDULE_OOB_IPI and register interrupt handler
2020-10-28 8:07 [PATCH v3][wip/dovetail] cobalt/sched: init RESCHEDULE_OOB_IPI and register interrupt handler Chen, Hongzhan
@ 2020-10-28 8:22 ` Jan Kiszka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2020-10-28 8:22 UTC (permalink / raw)
To: Chen, Hongzhan, Xenomai@xenomai.org
On 28.10.20 09:07, Chen, Hongzhan wrote:
> create and register RESCHEDULE_OOB_IPI interrupt handler
>
> Signed-off-by: hongzha1 <hongzhan.chen@intel.com>
>
> diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
> index f39becb90..36eff09d4 100644
> --- a/kernel/cobalt/sched.c
> +++ b/kernel/cobalt/sched.c
> @@ -30,6 +30,13 @@
> #define CREATE_TRACE_POINTS
> #include <trace/events/cobalt-core.h>
>
> +struct xn_machine_cpudata {
> +};
> +
> +DEFINE_PER_CPU(struct xn_machine_cpudata, xn_machine_cpudata);
> +
> +static void xnsched_destroy(struct xnsched *sched);
> +
> /**
> * @ingroup cobalt_core
> * @defgroup cobalt_core_sched Thread scheduling control
> @@ -224,10 +231,18 @@ static void xnsched_init(struct xnsched *sched, int cpu)
> #endif /* CONFIG_XENO_OPT_WATCHDOG */
> }
>
> +static irqreturn_t reschedule_interrupt(int irq, void *dev_id)
> +{
> + __xnsched_run_handler();
> +
> + return IRQ_HANDLED;
> +}
> +
> void xnsched_init_all(void)
> {
> struct xnsched *sched;
> int cpu;
> + int ret;
>
> for_each_online_cpu(cpu) {
> sched = &per_cpu(nksched, cpu);
> @@ -235,12 +250,22 @@ void xnsched_init_all(void)
> }
>
> #ifdef CONFIG_SMP
> -#warning TODO
> -/* ipipe_request_irq(&xnsched_realtime_domain,
> - IPIPE_RESCHEDULE_IPI,
> - (ipipe_irq_handler_t)__xnsched_run_handler,
> - NULL, NULL);*/
> + ret = __request_percpu_irq(RESCHEDULE_OOB_IPI,
> + reschedule_interrupt,
> + IRQF_OOB,
> + "Xenomai reschedule",
> + &xn_machine_cpudata);
> + if (ret)
> + goto cleanup_sched;
> #endif
> + return;
> +
> +cleanup_sched:
> + for_each_online_cpu(cpu) {
> + sched = xnsched_struct(cpu);
> + xnsched_destroy(sched);
> + }
> +
> }
>
> static void xnsched_destroy(struct xnsched *sched)
> @@ -262,8 +287,7 @@ void xnsched_destroy_all(void)
> spl_t s;
>
> #ifdef CONFIG_SMP
> -#warning TODO
> -// ipipe_free_irq(&xnsched_realtime_domain, IPIPE_RESCHEDULE_IPI);
> + free_percpu_irq(RESCHEDULE_OOB_IPI, &xn_machine_cpudata);
> #endif
>
> xnlock_get_irqsave(&nklock, s);
>
Please update all your pending patches accordingly and send them in one
series.
Thanks,
Jan
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-28 8:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 8:07 [PATCH v3][wip/dovetail] cobalt/sched: init RESCHEDULE_OOB_IPI and register interrupt handler Chen, Hongzhan
2020-10-28 8:22 ` 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.