Hi,

here goes another implementation of shared irqs on the nucleus layer.
I have conducted a few tests and it seems to work. The test example is attached.

There were 2 main issues concerning synchronization:

1)  xnintr_attach() vs. xnintr_detach() (and each of them vs. itself)

    The problem is that we can't use the "nklock" (nor any other lock + irq off) as Gilles pointed out.

    A possible solution:

    o  something lick xnlock_get/put()
   
    There is no irqsave/restore -less interface of xnlock_get/put available. For pure locking scheme
    (without touching the irqs) the concept of _preemption_ (to prevent a thread from being preempted
    while in a locked section) must be introduced and, at the first glance, that would be quite difficult
    since it must be consistent across all domains (if only for the primary - that's easy).
   
    o  rthal_critical_enter/exit()
   
    This one is used currently.
   
   
2)  xnintr_attach/detach() vs. xnintr_irq_handler()

    The problem here is how to be sure that 1) the "xnintr_shirq_t" object is valid (when dynamically allocated)
    and 2) to be safe while iterating through the handlers list.
   
    Currently, 1) is allowed by the static xnintr_shirq_t xnshirqs[IPIPE_NR_IRQS]. Ok, it can be done lighter
    when a one-way-list is used instead of xnqueue_t.
   
    Beleive it or not, I have considered different ways to guarantee that a passed "cookie" param is valid
    (xnintr_detach() has not deleted it) and remains to be so while the xnintr_irq_handler() is running.
    And there are some obstacles there... I'll post them later if someone is interested since I'm short of time now :)
    ...
   

There are a few ugly things in code, namely __IPIPE_NR_IRQS and definitions of rthal_critical_enter/exit().
That code is compiled for the user-mode code also and the originals are not available. So consider it a temp
solution for test purposes, I guess it's easily fixable.

test/shirq.c - is a test module.

SHIRQ_VECTOR must be the one used by Linux, e.g. I have used 12 that's used by the trackball device.


--
Best regards,
Dmitry Adamushko

Attachment: shirq-2_intr.c.patch
Description: Binary data

Attachment: shirq-2_intr.h.patch
Description: Binary data

Attachment: shirq-2_module.c.patch
Description: Binary data

Attachment: test-shirq.tgz
Description: GNU Zip compressed data

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to