0 Replies Latest reply on Dec 13, 2010 9:07 AM by merijn

    Inter-core interrupt and process notifying code

    merijn

      For some experimentation with interrupt driven message passing I have written some (grossly experimental) code to generate interrupts and a kernel module for notifying userspace processes when an interrupt occurs. Since I saw some questions about this I figured I'd share my code here.

       

      The patch is against the trunk of the latest revision on http://marcbug.scc-dc.com/svn/repository/trunk/, it changes the following things:

       

      linuxkernel/linux-2.6.16-mcemu/.config.RCK:

      Changed to allow loadable kernel modules on the SCC cores.

       

      linuxkernel/linux-2.6.16-mcemu/drivers/net/rckmb.c:

      The noIrq parameter of the rckmb driver was changed to not only switch between IRQ driven and polling mode, but to also free and re-obtain its IRQ. This means IRQ 4 can be freed from use by the driver by overwriting the zero in /sys/module/rckmb/parameters/noIrq with a non-zero integer (as a string).

       

      The patch also creates a new directory "rckos/async-scc" this directory contains a Makefile to build a kernel module async-scc.ko and a testing program irq. The kernel module can be loaded using "insmod" from the /shared network dir. The module exposes 3 module parameters, all can be set by writing an int (as string) to their respective filesystem entries:

       

      /sys/module/async_scc/parameters/irq:

      The IRQ the module should install an interrupt handler for. CAUTION: Default to 4 which is normally taken by rckmb, you should switch rckmb's interrupt handling off as described above. This IRQ remains changeable after loading the module.

       

      /sys/module/async_scc/parameters/pid:

      Whenever the IRQ set above is triggered the process specified by PID gets signalled.

       

      /sys/module/async_scc/parameters/signal:

      The signal to deliver to the user process, defaults to SIGUSR1, can be any signal.

       

      The "irq" program takes one argument (core number) and then triggers IRQ 4 on that core.

       

      Build instructions are simple, apply the patch, build linux image as usual and load it on the cores. All the code is GPL, questions/comments/feedback are welcome.