Received: by 10.223.185.116 with SMTP id b49csp6979891wrg; Wed, 28 Feb 2018 20:21:23 -0800 (PST) X-Google-Smtp-Source: AG47ELvZjBYsShTcZ6MOzgL8cjnaQ9l9h8Auj8pWVAjW82M4bA+TcYpecZPXKQ+po3bP3lFPfJN0 X-Received: by 10.99.106.71 with SMTP id f68mr467535pgc.262.1519878083483; Wed, 28 Feb 2018 20:21:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519878083; cv=none; d=google.com; s=arc-20160816; b=bzjtyOyiPvRQt9a64Nokl00eYXTxt0flxKPV19nIo5WtEagRZd5+hWTAsmxwQCcTUh T55rnBdv1dbxMDqlnq50jv1ZxUrT9RN4/fuSmwyLeWn+9Y8JlBpWbwGU+w2SdQsjrYcF vJ8F3fdtZHTmKWlOWuBFPTxHUI33M6GoM9+xs7DRPjm/AFwc74HeenGmaimLaZqu6DhM 0oSHxPvTfyczhN/7SZLzKyPjuq5Jr9TULk4UGYf2cLjLuwOzBcBCbbqaawJDenjxMN8A aK0H2ne02xQEvWVgq9p90G+P9kew23Rr9/BFXXwROczf6kqcUN1WuHykUxKlb/TfkavD UrDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject :smtp-origin-cluster:cc:to:smtp-origin-hostname:from :smtp-origin-hostprefix:arc-authentication-results; bh=FUzFvHFm6sLT50VgUSIQTNgKrztFnDUUONl4iowoTsI=; b=srlajnBtxP8AsvuFJ9Fpo+hzq4xQvP84D5wCIFwjYowwHwShOxmR5cLtKtsLqxLz+R S5UtvVX7MLuR7DOYqh47uBMqxfoe4xcvmLoNmZkINlG17foGc0KmSz/bBYyprYtBwkeb ht7VT1DXJV4KKl+rqxrIgJgDuHnOJ3r9AWJIgro2WKVolWXI1fdlOytq7sJ+95spk5Rc 5tqkCtMWunFIAD5W1uvPR/hgboKF1EFHEM+udvx8fPPf4NDAR1B7BB74jLQ3BXVqvSQG kwhcgjRW9sUdL8RrGCPeNRsfinbCkR6IzPpJ4lajPfgP8ro0r320v+MzVHyW1mwVmZ7U TJng== 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 k14si1907355pgp.812.2018.02.28.20.21.07; Wed, 28 Feb 2018 20:21:23 -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 S965873AbeCAEUA (ORCPT + 99 others); Wed, 28 Feb 2018 23:20:00 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:48956 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965812AbeCAET6 (ORCPT ); Wed, 28 Feb 2018 23:19:58 -0500 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w214I8Se027974 for ; Wed, 28 Feb 2018 20:19:58 -0800 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2ge81vrcbn-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 20:19:58 -0800 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB09.TheFacebook.com (192.168.16.19) with Microsoft SMTP Server id 14.3.361.1; Wed, 28 Feb 2018 20:19:57 -0800 Received: by devbig500.prn1.facebook.com (Postfix, from userid 572438) id 2858221810F3; Wed, 28 Feb 2018 20:19:57 -0800 (PST) Smtp-Origin-Hostprefix: devbig From: Alexei Starovoitov Smtp-Origin-Hostname: devbig500.prn1.facebook.com To: CC: , , , , , , , , Smtp-Origin-Cluster: prn1c29 Subject: [PATCH bpf-next 0/5] bpf, tracing: introduce bpf raw tracepoints Date: Wed, 28 Feb 2018 20:19:52 -0800 Message-ID: <20180301041957.399230-1-ast@kernel.org> X-Mailer: git-send-email 2.9.5 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-01_02:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 -- 2.9.5