]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r353747: vmm: remove a wmb() call
authorAndriy Gapon <avg@FreeBSD.org>
Wed, 13 Nov 2019 07:41:19 +0000 (07:41 +0000)
committerAndriy Gapon <avg@FreeBSD.org>
Wed, 13 Nov 2019 07:41:19 +0000 (07:41 +0000)
commit2c3413e7fa017fe0de45e062f3e7772ebc9af1d7
treeae2f4a7f4ab2fe3174c4972f97adb431af674047
parentc8d621fa07124c380626248019fd042a3b83e24c
MFC r353747: vmm: remove a wmb() call

After removing wmb(), vm_set_rendezvous_func() became super trivial, so
there was no point in keeping it.

The wmb (sfence on amd64, lock nop on i386) was not needed.  This can be
explained from several points of view.

First, wmb() is used for store-store ordering (although, the primitive
is undocumented).  There was no obvious subsequent store that needed the
barrier.

Second, x86 has a memory model with strong ordering including total
store order.  An explicit store barrier may be needed only when working
with special memory (device, special caching mode) or using special
instructions (non-temporal stores).  That was not the case for this
code.

Third, I believe that there is a misconception that sfence "flushes" the
store buffer in a sense that it speeds up the propagation of stores from
the store buffer to the global visibility.  I think that such
propagation always happens as fast as possible.  sfence only makes
subsequent stores wait for that propagation to complete.  So, sfence is
only useful for ordering of stores and only in the situations described
above.
sys/amd64/vmm/vmm.c