bpf: Fix the build on BPF_SYSCALL=y && !CONFIG_TRACING kernels, make it more configurable
authorIngo Molnar <[email protected]>
Thu, 2 Apr 2015 13:51:39 +0000 (15:51 +0200)
committerIngo Molnar <[email protected]>
Thu, 2 Apr 2015 14:28:06 +0000 (16:28 +0200)
So bpf_tracing.o depends on CONFIG_BPF_SYSCALL - but that's not its only
dependency, it also depends on the tracing infrastructure and on kprobes,
without which it will fail to build with:

  In file included from kernel/trace/bpf_trace.c:14:0:
  kernel/trace/trace.h: In function ‘trace_test_and_set_recursion’:
  kernel/trace/trace.h:491:28: error: ‘struct task_struct’ has no member named ‘trace_recursion’
    unsigned int val = current->trace_recursion;
  [...]

It took quite some time to trigger this build failure, because right now
BPF_SYSCALL is very obscure, depends on CONFIG_EXPERT. So also make BPF_SYSCALL
more configurable, not just under CONFIG_EXPERT.

If BPF_SYSCALL, tracing and kprobes are enabled then enable the bpf_tracing
gateway as well.

We might want to make this an interactive option later on, although
I'd not complicate it unnecessarily: enabling BPF_SYSCALL is enough of
an indicator that the user wants BPF support.

Cc: Alexei Starovoitov <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
init/Kconfig
kernel/trace/Kconfig
kernel/trace/Makefile

index f5dbc6d4261bcb47e7d7dccfa6385f649ecefa0a..2b4d055aca4ae99059a8ebed81979eaa1cc4a68f 100644 (file)
@@ -1513,7 +1513,7 @@ config EVENTFD
 
 # syscall, maps, verifier
 config BPF_SYSCALL
-       bool "Enable bpf() system call" if EXPERT
+       bool "Enable bpf() system call"
        select ANON_INODES
        select BPF
        default n
index a5da09c899dd69fde9dce7f783d5a0fdc27a41c1..c8e53c051293614920238f90cd87b140c11648ee 100644 (file)
@@ -432,6 +432,14 @@ config UPROBE_EVENT
          This option is required if you plan to use perf-probe subcommand
          of perf tools on user space applications.
 
+config BPF_EVENTS
+       depends on BPF_SYSCALL
+       depends on KPROBE_EVENT
+       bool
+       default y
+       help
+         This allows the user to attach BPF programs to kprobe events.
+
 config PROBE_EVENTS
        def_bool n
 
index c575a300103b7a3fd8496c0b105a2c8d0edd9637..9b1044e936a6fae78c218a4d14782fc77bc90645 100644 (file)
@@ -53,7 +53,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o
 endif
 obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
-obj-$(CONFIG_BPF_SYSCALL) += bpf_trace.o
+obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
 obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
 obj-$(CONFIG_TRACEPOINTS) += power-traces.o
 ifeq ($(CONFIG_PM),y)