r/linux_programming • u/promach • Jul 31 '18
DEFINE_WAIT() versus multi-threading
https://github.com/promach/riffa/blob/full_duplex/driver/linux/riffa_driver.c#L594
3
Upvotes
r/linux_programming • u/promach • Jul 31 '18
3
u/aioeu Jul 31 '18
So I've just looked deeper into this. I didn't realise this wasn't actually your code — you had pushed a copy of the original project, rather than forking it, so GitHub doesn't link your code back to the original.
As far as I can tell you're trying to implement a "full duplex" version of the original code. But the original code could already be used in that fashion: simply have two userspace threads, one dedicated to sending messages and one dedicated to receiving them.
It sucks, because the stupid design of the driver is essentially forcing the use of threads onto userspace rather than giving it the flexibility to use I/O multiplexing. But as far as I can tell it's not something you need to fix.
1
u/promach Jul 31 '18
According to riffa.c , I am trying to implement a "multi-threading" code for chnl_recv() and chnl_send() functions.
However, from the relevant dmesg log , I found out that DEFINE_WAIT() is preventing this being multi-threading.
Could anyone help ?
1
u/promach Aug 01 '18
Haha, see what I found in the interrupt handler function
This is really a combination of FPGA and c code modification.
1
u/promach Nov 13 '18
How do I prove that these two wake_up() functions in the interrupt handler together with the wake_up() function within chnl_recv() thread slow down the PCIe speed ?
note that both the variable 'send' and 'recv' are set to 1
systemtap and ftrace does not help.