• Y
    bpf: permit multiple bpf attachments for a single perf event · e87c6bc3
    Yonghong Song 提交于
    This patch enables multiple bpf attachments for a
    kprobe/uprobe/tracepoint single trace event.
    Each trace_event keeps a list of attached perf events.
    When an event happens, all attached bpf programs will
    be executed based on the order of attachment.
    
    A global bpf_event_mutex lock is introduced to protect
    prog_array attaching and detaching. An alternative will
    be introduce a mutex lock in every trace_event_call
    structure, but it takes a lot of extra memory.
    So a global bpf_event_mutex lock is a good compromise.
    
    The bpf prog detachment involves allocation of memory.
    If the allocation fails, a dummy do-nothing program
    will replace to-be-detached program in-place.
    Signed-off-by: NYonghong Song <yhs@fb.com>
    Acked-by: NAlexei Starovoitov <ast@kernel.org>
    Acked-by: NMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    e87c6bc3
bpf_trace.c 21.5 KB