LWN.net Logo

when things are exposed to userspace, the bock based api is needed more

when things are exposed to userspace, the bock based api is needed more

Posted Jan 24, 2013 3:06 UTC (Thu) by dlang (✭ supporter ✭, #313)
Parent article: GPIO in the kernel: future directions

When userspace attempts to bit-bang multiple lines at the same time, you have the added problem that the userspace app may be preempted (potentially for a significant period of time), and this makes reliable operation much harder.

It also means that the reliability degrades significantly as the load goes up. This will mean that it may never fail when the developer is testing it, but in teh real-world with higher load (and much longer operational periods) failures are almost guaranteed to take place.

If you try to group together GPIO lines that are on different hardware, you aren't going to be perfectly reliable, but in most cases, the GPIO lines really are grouped on the hardware level, non-uncommonly, to the point where some layer is reading the state of a bank of lines, modifying it based on what's requested, and writing the new state out to all the lines at once.

P.S. has anyone made a shim layer to allow you to use a parallel port as a set of GPIO lines?


(Log in to post comments)

when things are exposed to userspace, the bock based api is needed more

Posted Jan 25, 2013 18:29 UTC (Fri) by zlynx (subscriber, #2285) [Link]

The timing and preemption problem is why I used SCHED_FIFO when I wrote a user-space front-panel LCD driver for an embedded system, long ago.

The program runs SCHED_OTHER as normal, then escalates into SCHED_FIFO at prio 95 (something like that) to program the data ports, then falls back.

I know that kernel interrupts and similar things may interfere but it was never a problem in practice. The LCD's timing requirements were not overly strict, just that you couldn't go away and ignore it for tens of milliseconds.

when things are exposed to userspace, the bock based api is needed more

Posted Jan 25, 2013 19:59 UTC (Fri) by dlang (✭ supporter ✭, #313) [Link]

am I correct in thinking that the grouping capability would ease things and make it so that this could be done without SCHED_FIFO?

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds