Skip to content

Category: Linux

Real-time Linux Kernel drivers – revisited for new CPU-card

Two years ago I was looking at writing a Linux kernel driver with a real-time 10ms loop for a new x86-based CPU card at work. After a bit of back and forth (and some much-needed stress-testing) I ended up with an implementation that worked pretty well, and more or less guaranteed that our 10ms loop would also run with the specified period.

Now I’ve spent the last months working on a new CPU card, and thought that I’d better run the old stress-tests on it also, to make sure that we still have the real-time performance that we’re expecting.

Leave a Comment

Real-time Linux Kernel drivers – Part 3, the better and best implementations

– continued from part 2.

My first attempt at creating a 100 Hz real-time Linux kernel loop did not work as expected. After getting some good pointers from the linux-rt-users mailing list, and doing some further investigations myself, I decided to reimplement the loop using usleep_range() (further described here). This function basically just sleeps for a specified time (given a minimum and a maximum time to sleep), and thus does not need to have callbacks or similar specified. It should therefore be straight-forward to just create a new thread calling usleep_range() after each iteration, and then schedule it with the real-time scheduler.

4 Comments

Real-time Linux Kernel drivers – Part 1, the backstory

At work I recently had to create a set of real-time Linux drivers for our custom hardware board. I’ve found it to be an interesting experience that I’d like to share – especially since it took some help from the PREEMPT_RT community to get the real-time stuff working correctly.

I’ll divide the story into a few parts, starting with a quick description of the setup.

Leave a Comment