-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2020-10-01 The following pull-request contains BPF updates for your *net-next* tree. We've added 90 non-merge commits during the last 8 day(s) which contain a total of 103 files changed, 7662 insertions(+), 1894 deletions(-). Note that once bpf(/net) tree gets merged into net-next, there will be a small merge conflict in tools/lib/bpf/btf.c between commit 1245008 ("libbpf: Fix native endian assumption when parsing BTF") from the bpf tree and the commit 3289959 ("libbpf: Support BTF loading and raw data output in both endianness") from the bpf-next tree. Correct resolution would be to stick with bpf-next, it should look like: [...] /* check BTF magic */ if (fread(&magic, 1, sizeof(magic), f) < sizeof(magic)) { err = -EIO; goto err_out; } if (magic != BTF_MAGIC && magic != bswap_16(BTF_MAGIC)) { /* definitely not a raw BTF */ err = -EPROTO; goto err_out; } /* get file size */ [...] The main changes are: 1) Add bpf_snprintf_btf() and bpf_seq_printf_btf() helpers to support displaying BTF-based kernel data structures out of BPF programs, from Alan Maguire. 2) Speed up RCU tasks trace grace periods by a factor of 50 & fix a few race conditions exposed by it. It was discussed to take these via BPF and networking tree to get better testing exposure, from Paul E. McKenney. 3) Support multi-attach for freplace programs, needed for incremental attachment of multiple XDP progs using libxdp dispatcher model, from Toke Høiland-Jørgensen. 4) libbpf support for appending new BTF types at the end of BTF object, allowing intrusive changes of prog's BTF (useful for future linking), from Andrii Nakryiko. 5) Several BPF helper improvements e.g. avoid atomic op in cookie generator and add a redirect helper into neighboring subsys, from Daniel Borkmann. 6) Allow map updates on sockmaps from bpf_iter context in order to migrate sockmaps from one to another, from Lorenz Bauer. 7) Fix 32 bit to 64 bit assignment from latest alu32 bounds tracking which caused a verifier issue due to type downgrade to scalar, from John Fastabend. 8) Follow-up on tail-call support in BPF subprogs which optimizes x64 JIT prologue and epilogue sections, from Maciej Fijalkowski. 9) Add an option to perf RB map to improve sharing of event entries by avoiding remove- on-close behavior. Also, add BPF_PROG_TEST_RUN for raw_tracepoint, from Song Liu. 10) Fix a crash in AF_XDP's socket_release when memory allocation for UMEMs fails, from Magnus Karlsson. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
103 changed files
with
7,662 additions
and
1,894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef __LINUX_COOKIE_H | ||
#define __LINUX_COOKIE_H | ||
|
||
#include <linux/atomic.h> | ||
#include <linux/percpu.h> | ||
#include <asm/local.h> | ||
|
||
struct pcpu_gen_cookie { | ||
local_t nesting; | ||
u64 last; | ||
} __aligned(16); | ||
|
||
struct gen_cookie { | ||
struct pcpu_gen_cookie __percpu *local; | ||
atomic64_t forward_last ____cacheline_aligned_in_smp; | ||
atomic64_t reverse_last; | ||
}; | ||
|
||
#define COOKIE_LOCAL_BATCH 4096 | ||
|
||
#define DEFINE_COOKIE(name) \ | ||
static DEFINE_PER_CPU(struct pcpu_gen_cookie, __##name); \ | ||
static struct gen_cookie name = { \ | ||
.local = &__##name, \ | ||
.forward_last = ATOMIC64_INIT(0), \ | ||
.reverse_last = ATOMIC64_INIT(0), \ | ||
} | ||
|
||
static __always_inline u64 gen_cookie_next(struct gen_cookie *gc) | ||
{ | ||
struct pcpu_gen_cookie *local = this_cpu_ptr(gc->local); | ||
u64 val; | ||
|
||
if (likely(local_inc_return(&local->nesting) == 1)) { | ||
val = local->last; | ||
if (__is_defined(CONFIG_SMP) && | ||
unlikely((val & (COOKIE_LOCAL_BATCH - 1)) == 0)) { | ||
s64 next = atomic64_add_return(COOKIE_LOCAL_BATCH, | ||
&gc->forward_last); | ||
val = next - COOKIE_LOCAL_BATCH; | ||
} | ||
local->last = ++val; | ||
} else { | ||
val = atomic64_dec_return(&gc->reverse_last); | ||
} | ||
local_dec(&local->nesting); | ||
return val; | ||
} | ||
|
||
#endif /* __LINUX_COOKIE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.