Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3253205ybi; Mon, 17 Jun 2019 20:21:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfQuuhSh32AFjEb2nAs0dNZpYjH4tPFAFR7MIk1/0QqAjv2EIWrnDn1zVjvtS9/2PeKHgB X-Received: by 2002:a62:7994:: with SMTP id u142mr74941537pfc.39.1560828091371; Mon, 17 Jun 2019 20:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560828091; cv=none; d=google.com; s=arc-20160816; b=0/344hhnSncXiy0ZMOLUgOPsj7o/P0J1t9Z4py6sjwnXHpX/0QsvVbtIfND8QImCTk psiXqfOaHFX5UXHi/eNpFuE+BiePLk2cEIJjSpldNnSFF9+QxNX4w+hYd5TP2yW72vec MPPqqI/YmVnDp2ZAtdC2qbfaiLS3WpvDmlPASb3VOWIxIXPZ0toae5yHiRqLqAx3RDxA mqOV0batj4JgUex3nUa+wCEvVozUUV7fJ8H8eOjcGWhsk8H0aBKiLDkwvz9XGUFmeCpb fnRAE/ZVBKV1NAZbT50a/ebwLU5a/V3CCnlhpwWapW6QAN4U7iu6on2eqEVgZioV3b3T nHLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O/i7AMMkUKKosjfAFp+SY89OApm68MO3nGMJOcuM8UY=; b=bSq411WWLSRgz2f/sCaoTVK/fsyacxQ8uyITtZAPORD42LSIbKjfRnMT985FEM3478 heS72ItLm1QZlkjES3WVojYV+G3RxOW2lEHwiHE+LYXC+/CZhSzCXFtT5rx1jsYGyFaK KX02cTN9K16HcWrBkeGQfCpoF+C18yOfxuP2JWBVtJVo563afhlLMdmf+nfs0ww3Cm/P pSsaSHZN2e5HkXthiOesosP5BXtf0JA+a0iYag4Jwd58qA9VN5Nqr+uF3yNoa14dFuVL uKRhKxXZYDGVm8p/Gvtx5OifykBw5y4HsTKOj+R1ZqM6pL7HBP4xf6OGRvm4ysi0FzQe W+og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=FYOTl3p4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r185si12089570pgr.10.2019.06.17.20.21.16; Mon, 17 Jun 2019 20:21:31 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=FYOTl3p4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728478AbfFRDVI (ORCPT + 99 others); Mon, 17 Jun 2019 23:21:08 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:34956 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfFRDVI (ORCPT ); Mon, 17 Jun 2019 23:21:08 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5I399uk137012; Tue, 18 Jun 2019 03:20:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=O/i7AMMkUKKosjfAFp+SY89OApm68MO3nGMJOcuM8UY=; b=FYOTl3p47yilQEAD2tOSXuRWh3gNFBayMh3bDKZ5lPjaRURvbbcEuz68TSWGsfFiXaUS SA84AqA7I21wkzycLfTRKuwFe//sh0OuzkV8khR9BIigtRJMtITTLUI4hbnFiLxRKl5h NPKtYuI/J2ovXQW97DEIYIqebwSfMg6SxLj7RUf1qRjsd3OWvpC7CiOs6G4kBqp4dbFS AzRvyVjId6RuLbufF3V9kR+PhvPRo4CcOgl2g2GgcJ+1W2AX7vuGdjjItKX4d6Xq9UJV lvHh4fVbZyL/omBrLiYv6/HOEN8toK/SlCH185oHS41f1Yn1fIW2ZSr5/uG9Mjc9hx04 0A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2t4r3thqse-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2019 03:20:07 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5I3JKFx046047; Tue, 18 Jun 2019 03:20:07 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3020.oracle.com with ESMTP id 2t5h5tg1qt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Jun 2019 03:20:07 +0000 Received: from userp3020.oracle.com (userp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x5I3K667047272; Tue, 18 Jun 2019 03:20:06 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2t5h5tg1qk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2019 03:20:06 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5I3K5nB021569; Tue, 18 Jun 2019 03:20:05 GMT Received: from localhost (/10.159.211.102) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 17 Jun 2019 20:20:05 -0700 Date: Mon, 17 Jun 2019 23:19:59 -0400 From: Kris Van Hees To: Alexei Starovoitov Cc: Kris Van Hees , Network Development , bpf , dtrace-devel@oss.oracle.com, LKML , Steven Rostedt , Masami Hiramatsu , Arnaldo Carvalho de Melo , Alexei Starovoitov , Daniel Borkmann , Peter Zijlstra Subject: Re: [RFC PATCH 00/11] bpf, trace, dtrace: DTrace BPF program type implementation and sample use Message-ID: <20190618031959.GI8794@oracle.com> References: <20190521213648.GK2422@oracle.com> <20190521232618.xyo6w3e6nkwu3h5v@ast-mbp.dhcp.thefacebook.com> <20190522041253.GM2422@oracle.com> <20190522201624.eza3pe2v55sn2t2w@ast-mbp.dhcp.thefacebook.com> <20190523051608.GP2422@oracle.com> <20190523202842.ij2quhpmem3nabii@ast-mbp.dhcp.thefacebook.com> <20190618012509.GF8794@oracle.com> <20190618015442.GG8794@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9291 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=875 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906180024 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 08:01:52PM -0700, Alexei Starovoitov wrote: > On Mon, Jun 17, 2019 at 6:54 PM Kris Van Hees wrote: > > > > It is not hypothetical. The folowing example works fine: > > > > static int noinline bpf_action(void *ctx, long fd, long buf, long count) > > { > > int cpu = bpf_get_smp_processor_id(); > > struct data { > > u64 arg0; > > u64 arg1; > > u64 arg2; > > } rec; > > > > memset(&rec, 0, sizeof(rec)); > > > > rec.arg0 = fd; > > rec.arg1 = buf; > > rec.arg2 = count; > > > > bpf_perf_event_output(ctx, &buffers, cpu, &rec, sizeof(rec)); > > > > return 0; > > } > > > > SEC("kprobe/ksys_write") > > int bpf_kprobe(struct pt_regs *ctx) > > { > > return bpf_action(ctx, ctx->di, ctx->si, ctx->dx); > > } > > > > SEC("tracepoint/syscalls/sys_enter_write") > > int bpf_tp(struct syscalls_enter_write_args *ctx) > > { > > return bpf_action(ctx, ctx->fd, ctx->buf, ctx->count); > > } > > > > char _license[] SEC("license") = "GPL"; > > u32 _version SEC("version") = LINUX_VERSION_CODE; > > Great. Then you're all set to proceed with user space dtrace tooling, right? I can indeed proceed with the initial basics, yes, and have started. I hope to have a first bare bones patch for review sometime next week. > What you'll discover thought that it works only for simplest things > like above. libbpf assumes that everything in single elf will be used > and passes the whole thing to the kernel. > The verifer removes dead code only from single program. > It disallows unused functions. Hence libbpf needs to start doing > more "linker work" than it does today. > When it loads .o it needs to pass to the kernel only the functions > that are used by the program. > This work should be straightforward to implement. > Unfortunately no one had time to do it. Ah yes, I see what you mean. I'll work on that next since I will definitely be needing that. > It's also going to be the first step to multi-elf support. > libbpf would need to do the same "linker work" across .o-s.