Commit c8f865c5 authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/pipe: drop dependency on APCs

This patch starts a series aiming at dropping the (functionally
redundant) APC interface entirely.

APCs are a relic from the Dark Ages, with no upside compared to open
coded requests triggering virtual/synthetic IRQs to be handled by the
root domain. As a matter of fact, an APC does run as a client handler
of a synthetic IRQ under the hood.

With this change, all APCs will not be multiplexed over a single
synthetic IRQ anymore but each deferred procedure is going to be
assigned its own synthetic IRQ channel, which is hardly a problem
since we only have a couple of APCs to deal with, much fewer than the
number of synthetic IRQs available to us.

As a result, /proc/xenomai/apc will not be available for inspecting
the trigger count of synthetic interrupts used by the core
anymore. Since the I-pipe is on its way out, having this obscure
feature dropped in this context seems acceptable. However, the related
information will still be available to Dovetail-based builds directly
from /proc/interrupts, as synthetic IRQs are (mostly) regular
interrupts there.

Start with using a virtual/synthetic IRQ for kicking the wakeup
procedure for message pipes, dropping the dependency on APCs.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent b5108585
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <cobalt/kernel/sched.h> #include <cobalt/kernel/sched.h>
#include <cobalt/kernel/heap.h> #include <cobalt/kernel/heap.h>
#include <cobalt/kernel/pipe.h> #include <cobalt/kernel/pipe.h>
#include <cobalt/kernel/apc.h>
static int xnpipe_asyncsig = SIGIO; static int xnpipe_asyncsig = SIGIO;
...@@ -47,7 +46,7 @@ static LIST_HEAD(xnpipe_sleepq); ...@@ -47,7 +46,7 @@ static LIST_HEAD(xnpipe_sleepq);
static LIST_HEAD(xnpipe_asyncq); static LIST_HEAD(xnpipe_asyncq);
int xnpipe_wakeup_apc; static int xnpipe_wakeup_virq;
static struct class *xnpipe_class; static struct class *xnpipe_class;
...@@ -146,7 +145,7 @@ static inline void xnpipe_dequeue_all(struct xnpipe_state *state, int mask) ...@@ -146,7 +145,7 @@ static inline void xnpipe_dequeue_all(struct xnpipe_state *state, int mask)
__sigpending; \ __sigpending; \
}) })
static void xnpipe_wakeup_proc(void *cookie) static void xnpipe_wakeup_proc(unsigned int virq, void *arg)
{ {
struct xnpipe_state *state; struct xnpipe_state *state;
unsigned long rbits; unsigned long rbits;
...@@ -224,7 +223,7 @@ out: ...@@ -224,7 +223,7 @@ out:
static inline void xnpipe_schedule_request(void) /* hw IRQs off */ static inline void xnpipe_schedule_request(void) /* hw IRQs off */
{ {
__xnapc_schedule(xnpipe_wakeup_apc); ipipe_post_irq_root(xnpipe_wakeup_virq);
} }
static inline ssize_t xnpipe_flush_bufq(void (*fn)(void *buf, void *xstate), static inline ssize_t xnpipe_flush_bufq(void (*fn)(void *buf, void *xstate),
...@@ -1153,14 +1152,22 @@ int xnpipe_mount(void) ...@@ -1153,14 +1152,22 @@ int xnpipe_mount(void)
if (register_chrdev(XNPIPE_DEV_MAJOR, "rtpipe", &xnpipe_fops)) { if (register_chrdev(XNPIPE_DEV_MAJOR, "rtpipe", &xnpipe_fops)) {
printk(XENO_ERR printk(XENO_ERR
"unable to reserve major #%d for message pipe support\n", "unable to reserve major #%d for message pipes\n",
XNPIPE_DEV_MAJOR); XNPIPE_DEV_MAJOR);
return -EBUSY; return -EBUSY;
} }
xnpipe_wakeup_apc = xnpipe_wakeup_virq = ipipe_alloc_virq();
xnapc_alloc("pipe_wakeup", &xnpipe_wakeup_proc, NULL); if (xnpipe_wakeup_virq == 0) {
printk(XENO_ERR
"unable to reserve synthetic IRQ for message pipes\n");
return -EBUSY;
}
ipipe_request_irq(ipipe_root_domain,
xnpipe_wakeup_virq,
xnpipe_wakeup_proc,
NULL, NULL);
return 0; return 0;
} }
...@@ -1168,7 +1175,10 @@ void xnpipe_umount(void) ...@@ -1168,7 +1175,10 @@ void xnpipe_umount(void)
{ {
int i; int i;
xnapc_free(xnpipe_wakeup_apc); ipipe_free_irq(ipipe_root_domain,
xnpipe_wakeup_virq);
ipipe_free_virq(xnpipe_wakeup_virq);
unregister_chrdev(XNPIPE_DEV_MAJOR, "rtpipe"); unregister_chrdev(XNPIPE_DEV_MAJOR, "rtpipe");
for (i = 0; i < XNPIPE_NDEVS; i++) for (i = 0; i < XNPIPE_NDEVS; i++)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment