Hacker News new | ask | show | jobs
by Animats 3745 days ago
A callback-oriented kernel call mechanism. Hmm. The callback-oriented framework people should love this. It looks like you have to keep polling the shared page to see when your system call is done, though.

It's painful to realize that, after a context switch, modern CPUs can need 11,000 cycles to get back to full speed, with the right stuff in the caches and pipelines. Maybe we need CPUs which handle context switches better.

3 comments

A lot of that is dumping cache and then trying to refill it after the context switch. Regarding context switches, one of the things that they suggested is to pin one core to stay in the system context and just handle servicing syscalls, etc. Given a modern server can have up to a few hundred logical cores, that's not as big of a thing to ask for as it was even a few years ago. Even "cheap" servers these days have 8-16, so pinning there might even make sense as well.
That's what I did in some of my designs. It was more about covert channel mitigation by ensuring the secrets and untrusted stuff used seperate CPU's. Side benefit was performance benefit of less cache flushes. It works.
This isn't something I've used, but the low latency people on the Mechanical Sympathy mailing list seem to talk a lot about pinning cores to particular processes. This paper seems to have a lot of the same underlying considerations.
Huh? On x86, a syscall/sysret pair takes a couple hundred cycles, doesn't serialize, and doesn't zap caches.

It's the other ugly state changes that hurt a lot. Switching address spaces burns a few hundred cycles and zaps the TLB (fix coming in Linux 3.7, maybe). Interrupts are a few thousand cycles.

It is something to take into account if you're utilizing PV based virtualization in Xen, however - system calls will require a context switch.
x86 already somewhat does its just not implemented in any OS kernel as of now. The kernel calling the program (async syscalls) has been mainstream within exokernels since their inception.