qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [patch uq/master 2/2] kvm-all.c: define smp_wmb and use


From: Michael S. Tsirkin
Subject: [Qemu-devel] Re: [patch uq/master 2/2] kvm-all.c: define smp_wmb and use it for coalesced mmio
Date: Mon, 22 Feb 2010 16:57:39 +0200
User-agent: Mutt/1.5.19 (2009-01-05)

On Mon, Feb 22, 2010 at 04:57:29PM +0200, Avi Kivity wrote:
> On 02/22/2010 04:45 PM, Marcelo Tosatti wrote:
>> On Mon, Feb 22, 2010 at 04:23:32PM +0200, Avi Kivity wrote:
>>    
>>> On 02/22/2010 03:59 PM, Marcelo Tosatti wrote:
>>>      
>>>> Cc: "Michael S. Tsirkin"<address@hidden>
>>>> Signed-off-by: Marcelo Tosatti<address@hidden>
>>>>
>>>> Index: qemu/kvm-all.c
>>>> ===================================================================
>>>> --- qemu.orig/kvm-all.c
>>>> +++ qemu/kvm-all.c
>>>> @@ -718,6 +718,9 @@ static int kvm_handle_io(uint16_t port,
>>>>       return 1;
>>>>   }
>>>>
>>>> +/* FIXME: arch dependant, x86 version */
>>>> +#define smp_wmb()   asm volatile("" ::: "memory")
>>>> +
>>>>        
>>> sfence?
>>>      
>> There is no need (for this case). Older read cannot be reordered with
>> write, writes are not reordered with other writes, writes by a single
>> processor are observed in the same order by all processors.
>>    
>
> Well, Linux does use sfence.

At least on 64 bit it doesnt.

>  Perhaps it's only needed for WC writes  
> (movnti and friends), but better be careful here.
>
>>> what about other arches?
>>>      
>> They need to be fixed? PPC needs an instruction apparently.
>>
>> Is there any objection to including this patch?
>>    
>
> I imagine all arches need an instruction.  For reads as well.
>
> Note, gcc has a __sync_synchronize() builtin that compiles to mfence on  
> x86.  We might use that as a baseline for both rmb and wmb, and let each  
> arch override it incrementally.

This it what my patch did. Note it only works well for recent gcc.

> -- 
> error compiling committee.c: too many arguments to function




reply via email to

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