INTR_FAST and selwakeup

I stumbled over this problem a couple of years ago, ignored it, was punished for my carelessness, came out with hackerish solution and now I know “The Right Way” to solve this issue. So, the headache starts when you’re trying to wakeup userland application polling on a descriptor from INTR_FAST IRQ handler (for 7.X and later that would be interrupt filter). INTR_FAST/interrupt filter routines are usually used for timing-critical tasks and run in IRQ dispatcher context, so no operations that may cause context switch are allowed in this code. Unfortunately selwakeup(9) tries to acquire sellock that leads to a possible context switch and leaves us in a total mess. My solution was handmade kernel thread that has been running through list of channels and performed all dirty work, not the cleanest and easiest to maintain code. “Zaptel-bsd take 2” utilizes taskqueue(9) interface to work around IRQ handler limitations. There is handler routine: ...

November 25, 2007 · 1 min · 211 words · Oleksandr Tymoshenko

Module/kernel parameters

Sometimes it’s desirable to pass some arguments to module to customize its behavior, e.g.: to set/unset verbosity level of debug output, set operation mode etc… Linux modules can get this information from insmod utility, but kldload is not capable of doing such kind of things. What a pity. But don’t get desperate - tunables to the rescue! Just like an ordinary command shell (bash, csh, sh) kernel has its own environment, the set of <name, value> pairs. You can get, set, test, unset these variables using getenv, setenv, testenv, unsetenv functions in the kernel and kenv(2) syscall or kenv(1) command in userland. So if you want to set verbosity level for module, you would do something like this: ...

November 20, 2007 · 2 min · 286 words · Oleksandr Tymoshenko

Introduction

Hello. My name is Oleksandr Tymoshenko. I’m a software developer. My involvement in FreeBSD project started in 1998 by making static entries in ARP table really static. Though patch hasn’t made out of my university’s network it was “the beginning of a beautiful friendship”. My first significant contribution to FreeBSD community (or so I’d like to think) was porting of Zaptel drivers from Linux to FreeBSD. About two years ago I happened to work with a MIPS board and got some interest to the architecture. Since then I’ve been doing my best trying to bring FreeBSD to this platform and, actually, succeeded to some extent with a help from developers crowd. ...

October 29, 2007 · 1 min · 156 words · Oleksandr Tymoshenko