2004-06-19 10:31:12

by Margit Schubert-While

[permalink] [raw]
Subject: wmb versus smp_wmb

As the $SUBJECT implies, when should one use
wmb() versus smp_wmb() ?
Thanks
Margit



2004-06-19 11:10:35

by Francois Romieu

[permalink] [raw]
Subject: Re: wmb versus smp_wmb

Margit Schubert-While <[email protected]> :
> As the $SUBJECT implies, when should one use
> wmb() versus smp_wmb() ?

If the code which must see the variable(s) modified before the
wmb() can run on a separate CPU, then it should be a smp_wmb().

For instance host H1 wants to update A then B and host H2 needs to
be sure that if it reads the updated value of B, then it reads
the updated value of A as well. B could be an event that uses a
different channel instead of a memory update.

Usually (for me :o) ), the issue between the two (or more) CPUs is
complicated by the fact that there is some device behind a PCI bus
whose behavior depends on the same data as well.

Suggested reading: Schimmel + Aspirin recommended use.

--
Ueimor