diff mbox series

[bpf-next] docs: bpf: Clarify BPF_CMPXCHG wording

Message ID 20210210142853.82203-1-iii@linux.ibm.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series [bpf-next] docs: bpf: Clarify BPF_CMPXCHG wording | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 11 maintainers not CCed: corbet@lwn.net yhs@fb.com davem@davemloft.net kafai@fb.com netdev@vger.kernel.org songliubraving@fb.com kpsingh@kernel.org john.fastabend@gmail.com kuba@kernel.org linux-doc@vger.kernel.org andrii@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Ilya Leoshkevich Feb. 10, 2021, 2:28 p.m. UTC
Based on [1], BPF_CMPXCHG should always load the old value into R0. The
phrasing in bpf.rst is somewhat ambiguous in this regard, improve it to
make this aspect crystal clear.

  [1] https://lore.kernel.org/bpf/CAADnVQJFcFwxEz=wnV=hkie-EDwa8s5JGbBQeFt1TGux1OihJw@mail.gmail.com/

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 Documentation/networking/filter.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexei Starovoitov Feb. 12, 2021, 6:24 a.m. UTC | #1
On Wed, Feb 10, 2021 at 6:29 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> Based on [1], BPF_CMPXCHG should always load the old value into R0. The
> phrasing in bpf.rst is somewhat ambiguous in this regard, improve it to
> make this aspect crystal clear.
>
>   [1] https://lore.kernel.org/bpf/CAADnVQJFcFwxEz=wnV=hkie-EDwa8s5JGbBQeFt1TGux1OihJw@mail.gmail.com/
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

Applied.
diff mbox series

Patch

diff --git a/Documentation/networking/filter.rst b/Documentation/networking/filter.rst
index b3f457802836..251c6bd73d15 100644
--- a/Documentation/networking/filter.rst
+++ b/Documentation/networking/filter.rst
@@ -1076,8 +1076,8 @@  off``. ::
     BPF_CMPXCHG
 
 This atomically compares the value addressed by ``dst_reg + off`` with
-``R0``. If they match it is replaced with ``src_reg``, The value that was there
-before is loaded back to ``R0``.
+``R0``. If they match it is replaced with ``src_reg``. In either case, the
+value that was there before is zero-extended and loaded back to ``R0``.
 
 Note that 1 and 2 byte atomic operations are not supported.