All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: Alexei Starovoitov <ast@fb.com>,
	"David S . Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, <netdev@vger.kernel.org>,
	<kernel-team@fb.com>
Subject: Re: [PATCH net-next 1/6] bpf: introduce BPF_PROG_TEST_RUN command
Date: Fri, 31 Mar 2017 10:53:50 +0800	[thread overview]
Message-ID: <9105ab34-8fee-fab4-96fe-3bfe7f3a84b7@huawei.com> (raw)
In-Reply-To: <20170331013157.3298003-2-ast@fb.com>



On 2017/3/31 9:31, Alexei Starovoitov wrote:
> development and testing of networking bpf programs is quite cumbersome.
> Despite availability of user space bpf interpreters the kernel is
> the ultimate authority and execution environment.
> Current test frameworks for TC include creation of netns, veth,
> qdiscs and use of various packet generators just to test functionality
> of a bpf program. XDP testing is even more complicated, since
> qemu needs to be started with gro/gso disabled and precise queue
> configuration, transferring of xdp program from host into guest,
> attaching to virtio/eth0 and generating traffic from the host
> while capturing the results from the guest.
>
> Moreover analyzing performance bottlenecks in XDP program is
> impossible in virtio environment, since cost of running the program
> is tiny comparing to the overhead of virtio packet processing,
> so performance testing can only be done on physical nic
> with another server generating traffic.
>
> Furthermore ongoing changes to user space control plane of production
> applications cannot be run on the test servers leaving bpf programs
> stubbed out for testing.
>
> Last but not least, the upstream llvm changes are validated by the bpf
> backend testsuite which has no ability to test the code generated.
>
> To improve this situation introduce BPF_PROG_TEST_RUN command
> to test and performance benchmark bpf programs.
>
> Joint work with Daniel Borkmann.
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
> Acked-by: Martin KaFai Lau <kafai@fb.com>
> ---
>   include/linux/bpf.h      |   7 ++
>   include/uapi/linux/bpf.h |  12 ++++
>   kernel/bpf/syscall.c     |  27 +++++++-
>   net/Makefile             |   2 +-
>   net/bpf/Makefile         |   1 +
>   net/bpf/test_run.c       | 172 +++++++++++++++++++++++++++++++++++++++++++++++
>   net/core/filter.c        |   5 ++
>   7 files changed, 223 insertions(+), 3 deletions(-)
>   create mode 100644 net/bpf/Makefile
>   create mode 100644 net/bpf/test_run.c
>

[SNIP]

> diff --git a/net/Makefile b/net/Makefile
> index 9b681550e3a3..9086ffbb5085 100644
> --- a/net/Makefile
> +++ b/net/Makefile
> @@ -12,7 +12,7 @@ obj-$(CONFIG_NET)		+= $(tmp-y)
>   
>   # LLC has to be linked before the files in net/802/
>   obj-$(CONFIG_LLC)		+= llc/
> -obj-$(CONFIG_NET)		+= ethernet/ 802/ sched/ netlink/
> +obj-$(CONFIG_NET)		+= ethernet/ 802/ sched/ netlink/ bpf/
>   obj-$(CONFIG_NETFILTER)		+= netfilter/
>   obj-$(CONFIG_INET)		+= ipv4/
>   obj-$(CONFIG_XFRM)		+= xfrm/
> diff --git a/net/bpf/Makefile b/net/bpf/Makefile
> new file mode 100644
> index 000000000000..27b2992a0692
> --- /dev/null
> +++ b/net/bpf/Makefile
> @@ -0,0 +1 @@
> +obj-y	:= test_run.o

I suggest using a CONFIG option to enable/disable code in
test_run.o to reduce attack plane.

Thank you.

  reply	other threads:[~2017-03-31  2:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  1:31 [PATCH net-next 0/6] bpf: program testing framework Alexei Starovoitov
2017-03-31  1:31 ` [PATCH net-next 1/6] bpf: introduce BPF_PROG_TEST_RUN command Alexei Starovoitov
2017-03-31  2:53   ` Wangnan (F) [this message]
2017-03-31  2:57     ` Alexei Starovoitov
2017-03-31  3:12       ` Wangnan (F)
2017-03-31  3:24         ` Alexei Starovoitov
2017-03-31  3:37           ` Wangnan (F)
2017-03-31  1:31 ` [PATCH net-next 2/6] tools/lib/bpf: add support for " Alexei Starovoitov
2017-03-31  3:15   ` Wangnan (F)
2017-03-31  3:26     ` Alexei Starovoitov
2017-03-31  1:31 ` [PATCH net-next 3/6] selftests/bpf: add a test for overlapping packet range checks Alexei Starovoitov
2017-03-31  1:31 ` [PATCH net-next 4/6] tools/lib/bpf: expose bpf_program__set_type() Alexei Starovoitov
2017-03-31  2:33   ` Wangnan (F)
2017-03-31  2:37     ` Alexei Starovoitov
2017-03-31  2:48       ` Wangnan (F)
2017-03-31  2:56         ` Alexei Starovoitov
2017-03-31  1:31 ` [PATCH net-next 5/6] selftests/bpf: add a test for basic XDP functionality Alexei Starovoitov
2017-03-31  1:31 ` [PATCH net-next 6/6] selftests/bpf: add l4 load balancer test based on sched_cls Alexei Starovoitov

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=9105ab34-8fee-fab4-96fe-3bfe7f3a84b7@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.