• Michael S. Tsirkin's avatar
    asm-generic: add __smp_xxx wrappers · a9e4252a
    Michael S. Tsirkin authored
    On !SMP, most architectures define their
    barriers as compiler barriers.
    On SMP, most need an actual barrier.
    
    Make it possible to remove the code duplication for
    !SMP by defining low-level __smp_xxx barriers
    which do not depend on the value of SMP, then
    use them from asm-generic conditionally.
    
    Besides reducing code duplication, these low level APIs will also be
    useful for virtualization, where a barrier is sometimes needed even if
    !SMP since we might be talking to another kernel on the same SMP system.
    
    Both virtio and Xen drivers will benefit.
    
    The smp_xxx variants should use __smp_XXX ones or barrier() depending on
    SMP, identically for all architectures.
    
    We keep ifndef guards around them for now - once/if all
    architectures are converted to use the generic
    code, we'll be able to remove these.
    Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    a9e4252a
barrier.h 3.89 KB