netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: bjorn.topel@gmail.com, bpf@vger.kernel.org, toke@redhat.com,
	toshiaki.makita1@gmail.com
Cc: netdev@vger.kernel.org, john.fastabend@gmail.com, ast@kernel.org,
	daniel@iogearbox.net
Subject: [bpf-next PATCH v2 0/2] xdp devmap improvements cleanup
Date: Sat, 11 Jan 2020 18:36:59 -0800	[thread overview]
Message-ID: <157879606461.8200.2816751890292483534.stgit@john-Precision-5820-Tower> (raw)

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

             reply	other threads:[~2020-01-12  2:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-12  2:36 John Fastabend [this message]
2020-01-12  2:37 ` [bpf-next PATCH v2 1/2] bpf: xdp, update devmap comments to reflect napi/rcu usage John Fastabend
2020-01-12  7:47   ` Maciej Fijalkowski
2020-01-14  3:27     ` John Fastabend
2020-01-12 11:21   ` Toke Høiland-Jørgensen
2020-01-12  2:37 ` [bpf-next PATCH v2 2/2] bpf: xdp, remove no longer required rcu_read_{un}lock() John Fastabend
2020-01-12  6:49   ` Maciej Fijalkowski
2020-01-14  3:25     ` John Fastabend
2020-01-14  0:31       ` Maciej Fijalkowski
2020-01-12 11:22   ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157879606461.8200.2816751890292483534.stgit@john-Precision-5820-Tower \
    --to=john.fastabend@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.com \
    --cc=toshiaki.makita1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).