On 12/8/07, Paul Brook <[EMAIL PROTECTED]> wrote: > On Saturday 08 December 2007, Jamie Lokier wrote: > > Paul Brook wrote: > > > > virtio makes things a bit trickier though. There's a shared ring queue > > > > between the host and guest. The ring queue is lock-less and depends on > > > > the ability to atomically increment ring queue indices to be SMP safe. > > > > Using a copy-API wouldn't be a problem for QEMU since the host and > > > > guest are always running in lock-step. A copy API is actually needed > > > > to deal with differing host/guest alignment and endianness. > > > > > > That seems a rather poor design choice, as many architectures don't have > > > an atomic increment instruction. Oh well. > > > > Most have compare-and-swap or load-locked/store-conditional > > instructions, though, which can be used to implement atomic increment. > > Yes, but your "hardware" implementation has to make sure it interacts with > those properly. It's certainly possible to implement lockless lists without > requiring atomic increment. Most high-end hardware manages it and that > doesn't even have coherent DMA.
If we start adding locks for IO, could we use the same locking model more widely or make it generic so that it would support a SMP host as well?