docs: bpf: Fixup atomics markup
This fixes up the markup to fix a warning, be more consistent with use of monospace, and use the correct .rst syntax for <em> (* instead of _). Signed-off-by: Brendan Jackman <jackmanb@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Link: https://lore.kernel.org/bpf/20210120133946.2107897-2-jackmanb@google.com
This commit is contained in:
parent
636d549f91
commit
53fe5418fe
@ -1066,12 +1066,12 @@ memory location addresed by ``dst_reg + off`` is atomically modified, with
|
|||||||
immediate, then these operations also overwrite ``src_reg`` with the
|
immediate, then these operations also overwrite ``src_reg`` with the
|
||||||
value that was in memory before it was modified.
|
value that was in memory before it was modified.
|
||||||
|
|
||||||
The more special operations are:
|
The more special operations are::
|
||||||
|
|
||||||
BPF_XCHG
|
BPF_XCHG
|
||||||
|
|
||||||
This atomically exchanges ``src_reg`` with the value addressed by ``dst_reg +
|
This atomically exchanges ``src_reg`` with the value addressed by ``dst_reg +
|
||||||
off``.
|
off``. ::
|
||||||
|
|
||||||
BPF_CMPXCHG
|
BPF_CMPXCHG
|
||||||
|
|
||||||
@ -1081,18 +1081,19 @@ before is loaded back to ``R0``.
|
|||||||
|
|
||||||
Note that 1 and 2 byte atomic operations are not supported.
|
Note that 1 and 2 byte atomic operations are not supported.
|
||||||
|
|
||||||
Except ``BPF_ADD`` _without_ ``BPF_FETCH`` (for legacy reasons), all 4 byte
|
Except ``BPF_ADD`` *without* ``BPF_FETCH`` (for legacy reasons), all 4 byte
|
||||||
atomic operations require alu32 mode. Clang enables this mode by default in
|
atomic operations require alu32 mode. Clang enables this mode by default in
|
||||||
architecture v3 (``-mcpu=v3``). For older versions it can be enabled with
|
architecture v3 (``-mcpu=v3``). For older versions it can be enabled with
|
||||||
``-Xclang -target-feature -Xclang +alu32``.
|
``-Xclang -target-feature -Xclang +alu32``.
|
||||||
|
|
||||||
You may encounter BPF_XADD - this is a legacy name for BPF_ATOMIC, referring to
|
You may encounter ``BPF_XADD`` - this is a legacy name for ``BPF_ATOMIC``,
|
||||||
the exclusive-add operation encoded when the immediate field is zero.
|
referring to the exclusive-add operation encoded when the immediate field is
|
||||||
|
zero.
|
||||||
|
|
||||||
eBPF has one 16-byte instruction: BPF_LD | BPF_DW | BPF_IMM which consists
|
eBPF has one 16-byte instruction: ``BPF_LD | BPF_DW | BPF_IMM`` which consists
|
||||||
of two consecutive ``struct bpf_insn`` 8-byte blocks and interpreted as single
|
of two consecutive ``struct bpf_insn`` 8-byte blocks and interpreted as single
|
||||||
instruction that loads 64-bit immediate value into a dst_reg.
|
instruction that loads 64-bit immediate value into a dst_reg.
|
||||||
Classic BPF has similar instruction: BPF_LD | BPF_W | BPF_IMM which loads
|
Classic BPF has similar instruction: ``BPF_LD | BPF_W | BPF_IMM`` which loads
|
||||||
32-bit immediate value into a register.
|
32-bit immediate value into a register.
|
||||||
|
|
||||||
eBPF verifier
|
eBPF verifier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user