mbox series

[bpf-next,v2,0/2] load-acquire/store-release barriers for AF_XDP rings

Message ID 20210305094113.413544-1-bjorn.topel@gmail.com (mailing list archive)
Headers show
Series load-acquire/store-release barriers for AF_XDP rings | expand

Message

Björn Töpel March 5, 2021, 9:41 a.m. UTC
This two-patch series introduces load-acquire/store-release barriers
for the AF_XDP rings.

For most contemporary architectures, this is more effective than a
SPSC ring based on smp_{r,w,}mb() barriers. More importantly,
load-acquire/store-release semantics make the ring code easier to
follow.

This is effectively the change done in commit 6c43c091bdc5
("documentation: Update circular buffer for
load-acquire/store-release"), but for the AF_XDP rings.

Both libbpf and the kernel-side are updated.

Full details are outlined in the commits!

Thanks to the LKMM-folks (Paul/Alan/Will) for helping me out in this
complicated matter!

@Andrii I kept the barriers in libbpf_util.h to separate userfacing
        APIs (xsk.h) from internals.

@Toke I kept "barriers" but reworded. Acquire/release are also
      barriers.

@Will I'd really appreciate if you could take a look this change.

Changelog

v1[1]->v2: 
* Expanded the commit message for patch 1, and included the LKMM
  litmus tests. Hopefully this clear things up. (Daniel)

* Clarified why the smp_mb()/smp_load_acquire() is not needed in (A);
  control dependency with load to store. (Toke)

[1] https://lore.kernel.org/bpf/20210301104318.263262-1-bjorn.topel@gmail.com/

Thanks,
Björn


Björn Töpel (2):
  xsk: update rings for load-acquire/store-release barriers
  libbpf, xsk: add libbpf_smp_store_release libbpf_smp_load_acquire

 net/xdp/xsk_queue.h         | 30 +++++++---------
 tools/lib/bpf/libbpf_util.h | 72 +++++++++++++++++++++++++------------
 tools/lib/bpf/xsk.h         | 17 +++------
 3 files changed, 68 insertions(+), 51 deletions(-)


base-commit: bce8623135fbe54bd86797df72cb85bfe4118b6e

Comments

Toke Høiland-Jørgensen March 5, 2021, 1:50 p.m. UTC | #1
Björn Töpel <bjorn.topel@gmail.com> writes:

> This two-patch series introduces load-acquire/store-release barriers
> for the AF_XDP rings.
>
> For most contemporary architectures, this is more effective than a
> SPSC ring based on smp_{r,w,}mb() barriers. More importantly,
> load-acquire/store-release semantics make the ring code easier to
> follow.
>
> This is effectively the change done in commit 6c43c091bdc5
> ("documentation: Update circular buffer for
> load-acquire/store-release"), but for the AF_XDP rings.
>
> Both libbpf and the kernel-side are updated.
>
> Full details are outlined in the commits!
>
> Thanks to the LKMM-folks (Paul/Alan/Will) for helping me out in this
> complicated matter!
>
> @Andrii I kept the barriers in libbpf_util.h to separate userfacing
>         APIs (xsk.h) from internals.
>
> @Toke I kept "barriers" but reworded. Acquire/release are also
>       barriers.

Right, that text is better - thanks!

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
patchwork-bot+netdevbpf@kernel.org March 7, 2021, 3:40 a.m. UTC | #2
Hello:

This series was applied to bpf/bpf-next.git (refs/heads/master):

On Fri,  5 Mar 2021 10:41:11 +0100 you wrote:
> This two-patch series introduces load-acquire/store-release barriers
> for the AF_XDP rings.
> 
> For most contemporary architectures, this is more effective than a
> SPSC ring based on smp_{r,w,}mb() barriers. More importantly,
> load-acquire/store-release semantics make the ring code easier to
> follow.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2,1/2] xsk: update rings for load-acquire/store-release barriers
    https://git.kernel.org/bpf/bpf-next/c/057e8fb782c1
  - [bpf-next,v2,2/2] libbpf, xsk: add libbpf_smp_store_release libbpf_smp_load_acquire
    https://git.kernel.org/bpf/bpf-next/c/60d0e5fdbdf6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html