[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Self-modifying test case for mttcg
From: |
Andrew Jones |
Subject: |
Re: [Qemu-devel] Self-modifying test case for mttcg |
Date: |
Wed, 22 Jul 2015 15:44:12 +0200 |
User-agent: |
Mutt/1.5.23.1 (2014-03-12) |
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