[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations |
Date: |
Sun, 18 Nov 2012 12:04:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 |
On 11/15/2012 09:47 AM, liu ping fan wrote:
> On Wed, Nov 14, 2012 at 5:47 PM, Paolo Bonzini <address@hidden> wrote:
>> Il 14/11/2012 10:38, liu ping fan ha scritto:
>>> On Tue, Nov 13, 2012 at 6:11 PM, Paolo Bonzini <address@hidden> wrote:
>>>>>> Il 05/11/2012 06:38, Liu Ping Fan ha scritto:
>>>>>>> From: Liu Ping Fan <address@hidden>
>>>>>>>
>>>>>>> If out of global lock, we will be challenged by SMP in low level,
>>>>>>> so need atomic ops.
>>>>>>>
>>>>>>> This file is a wrapper of GCC atomic builtin.
>>>>>>
>>>>>> I still object to this.
>>>>>>
>>>>>> I know it enforces type-safety, but it is incomplete. It doesn't
>>>>>
>>>>> Although it is incomplete, but the rest cases are rarely used. Linux
>>>>> faces such issue, and the "int" version is enough, so I think we can
>>>>> borrow experience from there.
>>>>
>>>> One of the two places that use __sync_* require 64-bit accesses. My
>>> Yes, these two places are not easy to fix.
>>
>> Which shows that Linux's atomic_t is not suited for QEMU, in my opinion.
>>
>>>> RCU prototype required pointer-sized access, which you cannot make type-
>>> But I think that your RCU prototype should rely on atomic of CPU, not
>>> gcc‘s atomic.
>>
>> What's the difference? gcc's atomic produces the same instructions as
>> hand-written assembly (or should).
>>
> Probably I made a mistake here, in vhost, log =
> __sync_fetch_and_and(from, 0) is used to fetch 64bits atomically in
> the case 32bits qemu running on 64bits linux. Right? But how can
> we read 32bits twice in atomic? Seem that no instruction like "_lock
> xchg" for this ops. So I guess _sync_fetch_and_and() based on
> something like spinlock.
>
> And I think the broken issue is caused by vhost thread updates log,
> while qemu read out it not atomicly, Right?
For the log, 32-bit sync_fetch_and_and() is sufficient. We only need to
ensure no bits are lost, we don't need 64-bit atomicity.
--
error compiling committee.c: too many arguments to function
- [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, (continued)
- [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Liu Ping Fan, 2012/11/05
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Paolo Bonzini, 2012/11/12
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, liu ping fan, 2012/11/13
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Paolo Bonzini, 2012/11/13
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, liu ping fan, 2012/11/14
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Paolo Bonzini, 2012/11/14
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, liu ping fan, 2012/11/15
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Paolo Bonzini, 2012/11/15
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Richard Henderson, 2012/11/15
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, liu ping fan, 2012/11/21
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations,
Avi Kivity <=
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, liu ping fan, 2012/11/21
- Re: [Qemu-devel] [PATCH v6 1/8] atomic: introduce atomic operations, Paolo Bonzini, 2012/11/13
[Qemu-devel] [PATCH v6 2/8] qom: apply atomic on object's refcount, Liu Ping Fan, 2012/11/05
[Qemu-devel] [PATCH v6 3/8] hotplug: introduce qdev_unplug_complete() to remove device from views, Liu Ping Fan, 2012/11/05
[Qemu-devel] [PATCH v6 4/8] pci: remove pci device from mem view when unplug, Liu Ping Fan, 2012/11/05
[Qemu-devel] [PATCH v6 5/8] memory: introduce local lock for address space, Liu Ping Fan, 2012/11/05
[Qemu-devel] [PATCH v6 6/8] memory: make mmio dispatch able to be out of biglock, Liu Ping Fan, 2012/11/05