Subject: Re: "fast" syscalls?
To: Jed Davis <email@example.com>
From: Manuel Bouyer <firstname.lastname@example.org>
Date: 03/22/2006 00:09:08
On Tue, Mar 21, 2006 at 05:30:23PM -0500, Jed Davis wrote:
> Brett Lymn <email@example.com> writes:
> > You may want to look at some of the audio drivers which allow you to
> > mmap a buffer into userland. From memory they handle the
> > userland/kernel interaction by updating the head/tail pointers in a
> > circular queue, userland updates one pointer and the kernel updates
> > the other... when they pointers are equal the queue is empty.
> > Unfortunately, it still needs an ioctl to kick the process along but
> > the bulk data transfer is handled more efficiently.
> Virtual devices under Xen work a lot like that -- shared mapping of a
> ring buffer, incrementing produces/consumer indices, and virtual
> interrupts used by each side to kick the other. The relevant code,
> alas, isn't the clearest thing out there, and requirement of memory
> barriers (since the producer and consumer domains could be running
> concurrently on different CPUs in a MP machine) probably doesn't help.
This has improved in Xen3, where a generic ring API has been designed, and
the rings are accessed though macros. This makes things clearer.
Manuel Bouyer <firstname.lastname@example.org>
NetBSD: 26 ans d'experience feront toujours la difference