On Tue, Oct 03, 2017 at 05:20:25PM -0700, Jakub Kicinski wrote: > The only global state protected by the verifier lock is > the verifier log. Move that log to struct bpf_verifier_env > and allow verification of multiple programs in parallel. > > Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> > --- > Like this? :) > > Compile-tested, I'm rebasing things and will test shortly. > > include/linux/bpf_verifier.h | 5 + > kernel/bpf/verifier.c | 520 > ++++++++++++++++++++++--------------------- > 2 files changed, 276 insertions(+), 249 deletions(-) > > diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h > index b8d200f60a40..598802dd1897 100644 > --- a/include/linux/bpf_verifier.h > +++ b/include/linux/bpf_verifier.h > @@ -139,6 +139,11 @@ struct bpf_verifier_env { > bool allow_ptr_leaks; > bool seen_direct_write; > struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */ > + > + u32 log_level; > + u32 log_size; > + u32 log_len; > + char *log_buf; > }; > > int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops > *ops, > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index 4cf9b72c59a0..450f60e6229d 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -153,27 +153,21 @@ struct bpf_call_arg_meta { > int access_size; > }; > > -/* verbose verifier prints what it's seeing > - * bpf_check() is called under lock, so no race to access these global vars > - */ > -static u32 log_level, log_size, log_len; > -static char *log_buf; > - > -static DEFINE_MUTEX(bpf_verifier_lock);
yep. looks great. Please test it and submit officially :) The commit aafe6ae9cee3 ("bpf: dynamically allocate digest scratch buffer") fixed the other case where we were relying on the above mutex. The only other spot to be adjusted is to add spin_lock/mutex or DO_ONCE() to bpf_get_skb_set_tunnel_proto() to protect md_dst init. imo that would be it. Daniel, anything else comes to mind?