Received: by 10.223.185.116 with SMTP id b49csp2632623wrg; Mon, 5 Mar 2018 06:19:46 -0800 (PST) X-Google-Smtp-Source: AG47ELtPAHlgSQQftcuOxNxBORCZA+HUVlS1gLRPfmz+/w6aM7Zgz7FF2Z8p0M+MsYeMgxz0KuRX X-Received: by 10.99.120.193 with SMTP id t184mr12628125pgc.348.1520259586775; Mon, 05 Mar 2018 06:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520259586; cv=none; d=google.com; s=arc-20160816; b=Q099/bY6J4Qxtk2ICkWoLz2Q9Di/E/N67hpCHSL2WI0WQE3Y8GuL0pltud2mwtWHw3 aGzsphULVv6YpAALat+ncbUmJfW0/zRvxr67sGCZL6gdHXO6UNp9CxR7TVm6PiEV5BCo ntG2W1rPjss6oDd4NqE4bmSh0GLDgEHdDeRxyfqiWAd7LoSs6bVpKKH/KI0IXAbNVIUW le81lp4suYU4X9mMgDeQktdxOMD3uDWsQKS+WYCvg93SuVnqJqIgljzN+1lCnWRCAJ01 F/MhqWlKrPEQ4E+oVFMM8d1W4lZBP60MmHOy09g9ngHmBxXM7o3FztBsmnG0B1tItklE 6yBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Xp9YMNc960zNrxfxvM948otjKfRdLMbkoy+o2Vhy2i4=; b=oGMco0t6VEFYoWwXAYWEtxr0LuSenGk0AaUJTMFOs8soSdREnVagv5jnQ+DRy6LGvA dP+GVykhmzrXnwHDCjuL+a74kaThgZguwlkUSPWWuQkWBJu7kBNQdHfbeJWz27X0fxVo CBEY0Gc0oPMcEppPBLJQH9jacBotDWpe7g7+Ga5UwxRsJpBR4x4MTdjAlaMdcgbWpbhq ZA+WGWCUDv2ZwOW5vYRfDSzwKjgC1SWFJ72W/2ukY6ZCwSchSMLEGLinMIQSUwKO/UYk BiyrDegdEsZD1NdHwPK9g2S8A2V0cHiNoXI9gjhELujnktDg6wgiEDQEJ+P/rkCpd564 rD6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si9341850pln.274.2018.03.05.06.19.32; Mon, 05 Mar 2018 06:19:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964912AbeCENgT (ORCPT + 99 others); Mon, 5 Mar 2018 08:36:19 -0500 Received: from www62.your-server.de ([213.133.104.62]:40233 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964876AbeCENgR (ORCPT ); Mon, 5 Mar 2018 08:36:17 -0500 Received: from [85.7.107.67] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1esqHg-0001L1-CI; Mon, 05 Mar 2018 14:36:08 +0100 Subject: Re: [PATCH bpf-next 0/5] bpf, tracing: introduce bpf raw tracepoints To: Alexei Starovoitov , davem@davemloft.net Cc: torvalds@linux-foundation.org, peterz@infradead.org, mingo@kernel.org, rostedt@goodmis.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-api@vger.kernel.org References: <20180301041957.399230-1-ast@kernel.org> From: Daniel Borkmann Message-ID: <9bb38939-c357-4db5-6cf4-7b42187f6c7c@iogearbox.net> Date: Mon, 5 Mar 2018 14:36:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180301041957.399230-1-ast@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.3/24365/Mon Mar 5 10:13:02 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/01/2018 05:19 AM, Alexei Starovoitov wrote: > This patch set is a different way to address the pressing need to access > task_struct pointers in sched tracepoints from bpf programs. > > The first approach simply added these pointers to sched tracepoints: > https://lkml.org/lkml/2017/12/14/753 > which Peter nacked. > Few options were discussed and eventually the discussion converged on > doing bpf specific tracepoint_probe_register() probe functions. > Details here: > https://lkml.org/lkml/2017/12/20/929 Ping, Peter/Steven. If you have a chance, please review the series. > Patch 1 is kernel wide cleanup of pass-struct-by-value into > pass-struct-by-reference into tracepoints. > > Patch 2 minor prep work to expose number of arguments passed > into tracepoints. > > Patch 3 introduces BPF_RAW_TRACEPOINT api. > the auto-cleanup and multiple concurrent users are must have > features of tracing api. For bpf raw tracepoints it looks like: > // load bpf prog with BPF_PROG_TYPE_RAW_TRACEPOINT type > prog_fd = bpf_prog_load(...); > > // receive anon_inode fd for given bpf_raw_tracepoint > raw_tp_fd = bpf_raw_tracepoint_open("xdp_exception"); > > // attach bpf program to given tracepoint > bpf_prog_attach(prog_fd, raw_tp_fd, BPF_RAW_TRACEPOINT); > > Ctrl-C of tracing daemon or cmdline tool will automatically > detach bpf program, unload it and unregister tracepoint probe. > More details in patch 3. > > Patch 4, 5 - user space lib and tests > > samples/bpf/test_overhead performance on 1 cpu: > > tracepoint base kprobe+bpf tracepoint+bpf raw_tracepoint+bpf > task_rename 1.1M 769K 947K 1.0M > urandom_read 789K 697K 750K 755K > > Alexei Starovoitov (5): > treewide: remove struct-pass-by-value from tracepoints arguments > tracepoint: compute num_args at build time > bpf: introduce BPF_RAW_TRACEPOINT > libbpf: add bpf_raw_tracepoint_open helper > samples/bpf: raw tracepoint test > > arch/x86/xen/mmu_pv.c | 16 +-- > drivers/gpu/drm/i915/i915_trace.h | 13 +- > drivers/infiniband/hw/hfi1/file_ops.c | 2 +- > drivers/infiniband/hw/hfi1/trace_ctxts.h | 12 +- > drivers/s390/cio/ioasm.c | 18 +-- > drivers/s390/cio/trace.h | 50 ++++---- > fs/dax.c | 2 +- > include/linux/bpf_types.h | 1 + > include/linux/trace_events.h | 57 +++++++++ > include/linux/tracepoint-defs.h | 1 + > include/linux/tracepoint.h | 32 +++-- > include/trace/bpf_probe.h | 87 +++++++++++++ > include/trace/define_trace.h | 15 ++- > include/trace/events/f2fs.h | 2 +- > include/trace/events/fs_dax.h | 6 +- > include/trace/events/rcu.h | 4 +- > include/trace/events/xen.h | 32 ++--- > include/uapi/linux/bpf.h | 11 ++ > kernel/bpf/syscall.c | 108 ++++++++++++++++ > kernel/rcu/tree.c | 10 +- > kernel/trace/bpf_trace.c | 211 +++++++++++++++++++++++++++++++ > kernel/tracepoint.c | 27 ++-- > net/wireless/trace.h | 2 +- > samples/bpf/Makefile | 1 + > samples/bpf/bpf_load.c | 13 ++ > samples/bpf/test_overhead_raw_tp_kern.c | 17 +++ > samples/bpf/test_overhead_user.c | 12 ++ > sound/firewire/amdtp-stream-trace.h | 2 +- > tools/include/uapi/linux/bpf.h | 11 ++ > tools/lib/bpf/bpf.c | 10 ++ > tools/lib/bpf/bpf.h | 1 + > 31 files changed, 677 insertions(+), 109 deletions(-) > create mode 100644 include/trace/bpf_probe.h > create mode 100644 samples/bpf/test_overhead_raw_tp_kern.c >