All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Hongzhan" <hongzhan.chen@intel.com>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	"Xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: [PATCH v3][wip/dovetail] cobalt/sched: init RESCHEDULE_OOB_IPI and register interrupt handler
Date: Wed, 28 Oct 2020 08:07:45 +0000	[thread overview]
Message-ID: <MWHPR11MB17109943F4C74CFDF7F1B009F2170@MWHPR11MB1710.namprd11.prod.outlook.com> (raw)

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


             reply	other threads:[~2020-10-28  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  8:07 Chen, Hongzhan [this message]
2020-10-28  8:22 ` [PATCH v3][wip/dovetail] cobalt/sched: init RESCHEDULE_OOB_IPI and register interrupt handler Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR11MB17109943F4C74CFDF7F1B009F2170@MWHPR11MB1710.namprd11.prod.outlook.com \
    --to=hongzhan.chen@intel.com \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.