diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-24 03:49:12 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-24 03:49:12 +0300 |
commit | 00198dab3b825ab264424a052beea5acb859754f (patch) | |
tree | 1afa5fc96a0447bc8049a9992e5d4d047f5f0b38 /samples/bpf/test_cgrp2_attach.c | |
parent | 9004fda59577d439564d44d6d1db52d262fe3f99 (diff) | |
parent | 3705b97505bcbf6440f38119c0e7d6058f585b54 (diff) | |
download | linux-00198dab3b825ab264424a052beea5acb859754f.tar.xz |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"On the kernel side there's two x86 PMU driver fixes and a uprobes fix,
plus on the tooling side there's a number of fixes and some late
updates"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
perf sched timehist: Fix invalid period calculation
perf sched timehist: Remove hardcoded 'comm_width' check at print_summary
perf sched timehist: Enlarge default 'comm_width'
perf sched timehist: Honour 'comm_width' when aligning the headers
perf/x86: Fix overlap counter scheduling bug
perf/x86/pebs: Fix handling of PEBS buffer overflows
samples/bpf: Move open_raw_sock to separate header
samples/bpf: Remove perf_event_open() declaration
samples/bpf: Be consistent with bpf_load_program bpf_insn parameter
tools lib bpf: Add bpf_prog_{attach,detach}
samples/bpf: Switch over to libbpf
perf diff: Do not overwrite valid build id
perf annotate: Don't throw error for zero length symbols
perf bench futex: Fix lock-pi help string
perf trace: Check if MAP_32BIT is defined (again)
samples/bpf: Make perf_event_read() static
uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
samples/bpf: Make samples more libbpf-centric
tools lib bpf: Add flags to bpf_create_map()
tools lib bpf: use __u32 from linux/types.h
...
Diffstat (limited to 'samples/bpf/test_cgrp2_attach.c')
-rw-r--r-- | samples/bpf/test_cgrp2_attach.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/samples/bpf/test_cgrp2_attach.c b/samples/bpf/test_cgrp2_attach.c index a19484c45b79..504058631ffc 100644 --- a/samples/bpf/test_cgrp2_attach.c +++ b/samples/bpf/test_cgrp2_attach.c @@ -36,6 +36,8 @@ enum { MAP_KEY_BYTES, }; +char bpf_log_buf[BPF_LOG_BUF_SIZE]; + static int prog_load(int map_fd, int verdict) { struct bpf_insn prog[] = { @@ -66,9 +68,11 @@ static int prog_load(int map_fd, int verdict) BPF_MOV64_IMM(BPF_REG_0, verdict), /* r0 = verdict */ BPF_EXIT_INSN(), }; + size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn); - return bpf_prog_load(BPF_PROG_TYPE_CGROUP_SKB, - prog, sizeof(prog), "GPL", 0); + return bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB, + prog, insns_cnt, "GPL", 0, + bpf_log_buf, BPF_LOG_BUF_SIZE); } static int usage(const char *argv0) @@ -108,10 +112,10 @@ static int attach_filter(int cg_fd, int type, int verdict) } while (1) { key = MAP_KEY_PACKETS; - assert(bpf_lookup_elem(map_fd, &key, &pkt_cnt) == 0); + assert(bpf_map_lookup_elem(map_fd, &key, &pkt_cnt) == 0); key = MAP_KEY_BYTES; - assert(bpf_lookup_elem(map_fd, &key, &byte_cnt) == 0); + assert(bpf_map_lookup_elem(map_fd, &key, &byte_cnt) == 0); printf("cgroup received %lld packets, %lld bytes\n", pkt_cnt, byte_cnt); |