qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] linux-user: always start with parallel_cpus set


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] linux-user: always start with parallel_cpus set to true
Date: Wed, 4 Jan 2017 21:21:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

Le 04/01/2017 à 19:39, Alex Bennée a écrit :
> 
> Laurent Vivier <address@hidden> writes:
> 
>> We always need real atomics, as we can have shared memory between
>> processes.
>>
>> A good test case is the example from futex(2), futex_demo.c:
>>
>> the use case is
>>
>>     mmap(...);
>>     fork();
>>
>>     Parent and Child:
>>
>>     while(...)
>>         __sync_bool_compare_and_swap(...)
>>         ...
>>         futex(...)
>>
>> In this case we need real atomics in __sync_bool_compare_and_swap(),
>> but as parallel_cpus is set to 0, we don't have.
>>
>> We also revert "b67cb68 linux-user: enable parallel code generation on clone"
>> as parallel_cpus in unconditionally set now.
>>
>> Of course, this doesn't fix atomics that are emulated using
>> cpu_loop_exit_atomic() as we can't stop virtual CPUs from another
>> processes.
> 
> This seems a bit of a hit for something that might never get called.
> Could we not move b67cb68 out of the thread fork leg and do it for any
> fork? After all the tb_flush will ensure that all code by both parent
> and child will be using full atomics at that point?

Yes, but we can have also two processes that are neither parents nor
children trying to communicate through shared memory. We can't know...

Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]