netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Karlsson <magnus.karlsson@intel.com>
To: magnus.karlsson@intel.com, bjorn.topel@intel.com, ast@kernel.org,
	daniel@iogearbox.net, netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, bruce.richardson@intel.com,
	ciara.loftus@intel.com, ilias.apalodimas@linaro.org,
	xiaolong.ye@intel.com, ferruh.yigit@intel.com,
	qi.z.zhang@intel.com, georgmueller@gmx.net
Subject: [PATCH bpf 0/2] libbpf: remove two dependencies on Linux kernel headers and improve performance as a bonus
Date: Tue,  9 Apr 2019 08:44:11 +0200	[thread overview]
Message-ID: <1554792253-27081-1-git-send-email-magnus.karlsson@intel.com> (raw)

This patch set removes two dependencies on Linux kernel headers
from the XDP socket code in libbpf. A number of people have pointed
out that these two dependencies make it hard to build the XDP socket
part of libbpf without any kernel header dependencies. The two removed
dependecies are:

* Remove the usage of likely and unlikely (compiler.h) in xsk.h. It
  has been reported that the use of these actually decreases the
  performance of the ring access code due to an increase in
  instruction cache misses, so let us just remove these.

* Remove the dependency on barrier.h as it brings in a lot of kernel
  headers. As the XDP socket code only uses two simple functions from
  it, we can reimplement these. As a bonus, the new implementation is
  faster as it uses the same barrier primitives as the kernel does
  when the same code is compiled there. Without this patch, the user
  land code uses lfence and sfence on x86, which are unecessarily
  harsh/thorough.

Do the ARM barriers look sane? Have not tested these.

/Magnus

Magnus Karlsson (2):
  libbpf: remove likely/unlikely in xsk.h
  libbpf: remove dependency on barrier.h in xsk.h

 tools/lib/bpf/xsk.h | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

--
2.7.4

             reply	other threads:[~2019-04-09  6:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  6:44 Magnus Karlsson [this message]
2019-04-09  6:44 ` [PATCH bpf 1/2] libbpf: remove likely/unlikely in xsk.h Magnus Karlsson
2019-04-09  6:44 ` [PATCH bpf 2/2] libbpf: remove dependency on barrier.h " Magnus Karlsson
2019-04-09  9:10   ` Daniel Borkmann
2019-04-09 11:29     ` Magnus Karlsson
2019-04-09 22:28       ` Georg Müller
2019-04-09 22:46         ` Daniel Borkmann
2019-09-04  5:32   ` Yauheni Kaliuta
2019-09-04  6:39     ` Magnus Karlsson
2019-09-04  6:56       ` Yauheni Kaliuta
2019-09-04 10:25         ` Magnus Karlsson
2019-09-04 12:19           ` Yauheni Kaliuta
2019-09-04 12:21             ` Magnus Karlsson

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=1554792253-27081-1-git-send-email-magnus.karlsson@intel.com \
    --to=magnus.karlsson@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=ferruh.yigit@intel.com \
    --cc=georgmueller@gmx.net \
    --cc=ilias.apalodimas@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=qi.z.zhang@intel.com \
    --cc=xiaolong.ye@intel.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).