Thread (10 messages) flat view 10 messages, 3 authors, 2020-01-14
STALE2399d

Revision v2 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[bpf-next PATCH v2 0/2] xdp devmap improvements cleanup

From: John Fastabend <john.fastabend@gmail.com>
Date: 2020-01-12 02:37:16
Also in: bpf

Couple cleanup patches to recently posted series[0] from Bjorn to
cleanup and optimize the devmap usage. Patches have commit ids
the cleanup applies to.

Toshiaki, noted that virtio_net depends on rcu_lock being held
when calling xdp flush routines. This is specific to virtio_net
dereferencing xdp program to determine if xdp is enabled or not.
More typical pattern is to look at a flag set by the driver, at
least in the case of real hardware drivers. veth has a similar
requirement where it derferences the peer netdev priv structure
requiring the rcu_read_lock. I believe its better to put the
rcu_read_lock()/unlock() pair where its actually used in the
driver. FWIW in other xdp paths we expect driver writers to
place rcu_read_lock/unlock pairs where they are needed as well
so this keeps that expectation. Also it improves readability
making it obvious why the rcu_read_lock and unlock pair is
needed. In the virtio case we can probably do some further
cleanup and remove it altogether if we want. For more details
see patch 2/2.

[0] https://www.spinics.net/lists/netdev/msg620639.html

v2: Place rcu_read_{un}lock pair in virtio_net and veth drivers
    so we don't break this requirement when removing rcu read
    lock from devmap.

---

John Fastabend (2):
      bpf: xdp, update devmap comments to reflect napi/rcu usage
      bpf: xdp, remove no longer required rcu_read_{un}lock()


 drivers/net/veth.c       |    6 +++++-
 drivers/net/virtio_net.c |    8 ++++++--
 kernel/bpf/devmap.c      |   26 ++++++++++++++------------
 3 files changed, 25 insertions(+), 15 deletions(-)

--
Signature
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help