[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Self-modifying test case for mttcg
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] Self-modifying test case for mttcg |
Date: |
Wed, 22 Jul 2015 15:06:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
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.
Paolo