On Wed, Jul 22, 2015 at 03:06:03PM +0200, Paolo Bonzini wrote: > > > On 22/07/2015 14:38, Andrew Jones wrote: > > I took a quick look at this and see issues with the test code. First, > > you're spinning on a stack variable with this, > > > > /* Wait for our turn */ > > while(next_cpu != cpu); > > > > next_cpu needs to be global, and incremented atomically. I haven't gotten > > around to adding atomic_add/inc yet, but it would easy, and I'm happy to > > do it, even yet this week. > > You can just use __sync_fetch_and_add(&next_cpu, 1) too, so we don't end > up with too much arch-specific code.
Ah yes, I should take more advantage of gcc-builtins in general. drew