lkml.org 
[lkml]   [2012]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] bitops: add _local bitops
    On Wed, May 09, 2012 at 07:03:37AM -0700, H. Peter Anvin wrote:
    > On 05/09/2012 06:45 AM, Michael S. Tsirkin wrote:
    > > kvm needs to update some hypervisor variables atomically
    > > in a sense that the operation can't be interrupted
    > > in the middle. However the hypervisor always runs
    > > on the same CPU so it does not need any memory
    > > barrier or lock prefix.
    > >
    > > At Peter Anvin's suggestion, add _local bitops for this purpose:
    > > define them as non-atomics for x86 and (for now) atomics
    > > for everyone else.
    > >
    > > Uses are not restricted to virtualization: they
    > > might be useful to communicate with an interrupt
    > > handler if we know that it's running on the same CPU.
    > >
    > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    >
    > I don't think you can use the x86 nonatomics as-is, because they don't
    > contain optimization barriers.
    >
    > -hpa

    By the way, clear_bit on x86 does not seem to contain
    an optimization barrier - is my reading correct?
    Lock prefix does not affect the compiler, right?


    \
     
     \ /
      Last update: 2012-05-09 18:41    [W:0.052 / U:0.960 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site