mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@fb.com>
To: "David S . Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <daniel@iogearbox.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <kernel-team@fb.com>
Subject: [PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid
Date: Tue, 8 Mar 2016 15:07:53 -0800	[thread overview]
Message-ID: <1457478474-1614041-2-git-send-email-ast@fb.com> (raw)
In-Reply-To: <1457478474-1614041-1-git-send-email-ast@fb.com>

increase stress by also calling bpf_get_stackid() from
various *spin* functions

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 samples/bpf/spintest_kern.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/samples/bpf/spintest_kern.c b/samples/bpf/spintest_kern.c
index ef8ac33bb2e9..4b27619d91a4 100644
--- a/samples/bpf/spintest_kern.c
+++ b/samples/bpf/spintest_kern.c
@@ -8,6 +8,7 @@
 #include <linux/netdevice.h>
 #include <linux/version.h>
 #include <uapi/linux/bpf.h>
+#include <uapi/linux/perf_event.h>
 #include "bpf_helpers.h"
 
 struct bpf_map_def SEC("maps") my_map = {
@@ -23,6 +24,13 @@ struct bpf_map_def SEC("maps") my_map2 = {
 	.max_entries = 1024,
 };
 
+struct bpf_map_def SEC("maps") stackmap = {
+	.type = BPF_MAP_TYPE_STACK_TRACE,
+	.key_size = sizeof(u32),
+	.value_size = PERF_MAX_STACK_DEPTH * sizeof(u64),
+	.max_entries = 10000,
+};
+
 #define PROG(foo) \
 int foo(struct pt_regs *ctx) \
 { \
@@ -32,6 +40,7 @@ int foo(struct pt_regs *ctx) \
 	bpf_map_update_elem(&my_map, &v, &v, BPF_ANY); \
 	bpf_map_update_elem(&my_map2, &v, &v, BPF_ANY); \
 	bpf_map_delete_elem(&my_map2, &v); \
+	bpf_get_stackid(ctx, &stackmap, BPF_F_REUSE_STACKID); \
 	return 0; \
 }
 
-- 
2.8.0.rc1

  reply	other threads:[~2016-03-08 23:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 23:07 [PATCH net-next 1/3] samples/bpf: add bpf map stress test Alexei Starovoitov
2016-03-08 23:07 ` Alexei Starovoitov [this message]
2016-03-09  4:22   ` [PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid David Miller
2016-03-08 23:07 ` [PATCH net-next 3/3] samples/bpf: add map performance test Alexei Starovoitov
2016-03-09  4:22   ` David Miller
2016-03-09  4:22 ` [PATCH net-next 1/3] samples/bpf: add bpf map stress test David Miller

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=1457478474-1614041-2-git-send-email-ast@fb.com \
    --to=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®