[openib-general] [PATCH] use mmiowb after doorbell ring

Michael S. Tsirkin mst at mellanox.co.il
Tue Oct 17 12:33:07 PDT 2006


Quoting r. Roland Dreier <rdreier at cisco.com>:
> Subject: Re: [PATCH] use mmiowb after doorbell ring
> 
>     Michael> kernel code does rmb rather than mb there.
> 
> OK, but that's an optimization rather than a correctness issue: mb is
> stronger than rmb.

Very strange. Let's consider amd64: libibverbs has

#elif defined(__x86_64__)

#define mb()    asm volatile("" ::: "memory")

So its just a compiler barrier there.

While linux has asm-x86_64/system.h

#define rmb()  asm volatile("lfence":::"memory")

So rmb seems to be stronger than mb: it will prevent the CPU from reordering
reads while mb won't.
Hmm?

-- 
MST




More information about the general mailing list