Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1355242

Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()
Date 2016-03-10 17:10 +0100
Message-ID <rbbjZ-119-21@gated-at.bofh.it> (permalink)
References (5 earlier) <rarKb-2CK-27@gated-at.bofh.it> <rba4y-8hd-11@gated-at.bofh.it> <rbaHg-q8-21@gated-at.bofh.it> <rbaQX-vD-39@gated-at.bofh.it> <rbb0B-AW-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 10/03/2016 16:45, Xiao Guangrong wrote:
>>
>>> Compared to smp_load_acquire(), smp_mb() adds an ordering between stores
>>> and loads.
>>
>> Here, the ordering is load-store, hence...
> 
> Yes, this is why i put smp_mb() in the code. :)

Here is a table of barriers:


    '. after|                   |
before '.   |    load           |    store
__________'.|___________________|________________________
            |                   |
            |  smp_rmb          | smp_load_acquire
load        |  smp_load_acquire | smp_store_release    XX
            |  smp_mb           | smp_mb
____________|___________________|________________________
            |                   |
            |                   | smp_wmb
store       |  smp_mb           | smp_store_release
            |                   | smp_mb
            |                   |

Your case is the one marked with XX, so a smp_load_acquire() is
enough---and it's preferrable, because it's cheaper than smp_mb() and
more self-documenting.

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page() Lan Tianyu <tianyu.lan@intel.com> - 2016-03-08 10:00 +0100
  Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Paolo Bonzini <pbonzini@redhat.com> - 2016-03-08 16:30 +0100
    Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page() Lan Tianyu <tianyu.lan@intel.com> - 2016-03-09 08:40 +0100
      Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Paolo Bonzini <pbonzini@redhat.com> - 2016-03-10 18:10 +0100
        Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-10 19:20 +0100
    Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-10 15:50 +0100
      Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Paolo Bonzini <pbonzini@redhat.com> - 2016-03-10 16:30 +0100
        Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Paolo Bonzini <pbonzini@redhat.com> - 2016-03-10 16:40 +0100
          Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-10 16:50 +0100
            Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Paolo Bonzini <pbonzini@redhat.com> - 2016-03-10 17:10 +0100
              Re: [PATCH] KVM: Remove redundant smp_mb() in the  kvm_mmu_commit_zap_page() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-10 19:20 +0100
        Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page() Lan Tianyu <tianyu.lan@intel.com> - 2016-03-11 02:40 +0100

csiph-web