Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp190987imu; Thu, 8 Nov 2018 07:01:31 -0800 (PST) X-Google-Smtp-Source: AJdET5fB/pJka6lrZAP5ydRMB/QZggW2GrSIuDGW2dkJy6C0gnb2AgLc+rXB23NMAvC/edBrGjIw X-Received: by 2002:a17:902:b03:: with SMTP id 3-v6mr4899217plq.233.1541689291315; Thu, 08 Nov 2018 07:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541689291; cv=none; d=google.com; s=arc-20160816; b=luk0PNdR8A6BnJEZEXnbYXTz0YoCNCZ50aQloQchqAUb/3RmmXOmncJIMaC620xg9x 8efJIb2+sgvXBzInzE+aaEjZ2j+LtqCblsSWKqW5OI2efMeFKFOlAOA83jLhdWT6QGse cdkDQiosYgBALIsOcUOcxzjYNwjwLoG9kvRMXpNRaRieWi+MIKm7tfcUAhSg4tPJdraV hMIDUZM39cITBfli/rRGEP/0Q38J9Ok2knZhzssgbJsQ/QSbnlAMkwkFX48kzE49dMZG wY3b0edtelGIpyFQSCetMvxSFQsqnbhDCh+cJgI1n/44bKzCumS+tlLPQfVCNY5VqE4x ziSQ== 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=PX2vCXgd9PUHUkmWFd4nDqiQOB3Jv6+9WSonyIROxuE=; b=C79v2hQexycbOe5B941+URSCQLuoJSgpzAmNNzOCu/QqJ9zJNOXpDDX1XCmqWnyKEA /GSI0W34Sd4QebGAs3LT94hM73fo64WFX9zUb2b581sB+cCnPTu0wrolvXbKeMXx9/FZ 1m86MB+/aBVrUOb3FrNRgJYI1K/Vrqeunf6gjSOF2J9pqIgSK8/GMJxcTybBYTBo2I2l Conrs3PlkzK4WPKwZODMXRs2Nsk+JdRobeta8YxsuAhuGVJH4Arq6fy7SJBUy9vFglPO xLJFQgkuL+33km/HXgIsjcAcAkuBOmYFfMvCrfTFWmohYwzEDQBWrKyQiuzJxPv5spy6 PGMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=3cy4HcbD; 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 b18-v6si4339483pls.32.2018.11.08.07.01.14; Thu, 08 Nov 2018 07:01:31 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=3cy4HcbD; 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 S1726975AbeKIAgb (ORCPT + 99 others); Thu, 8 Nov 2018 19:36:31 -0500 Received: from merlin.infradead.org ([205.233.59.134]:37624 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbeKIAga (ORCPT ); Thu, 8 Nov 2018 19:36:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PX2vCXgd9PUHUkmWFd4nDqiQOB3Jv6+9WSonyIROxuE=; b=3cy4HcbD0j9qLOr3Ek7WWFZmq anR++4ARdcLyOSs8KCHwi0xVgVgoGvuAYf9jFijSIlulY1ektL+2t/NVq+sEwy6EoTBWp8uoOas3e S+8dyOdMNdufgxDfQJ0ZXgVzyh5nuaUsIeR10I4SZrbOhMjqKVmSyyDSbc2vsOUSx3AEE4TkFRMlM Nis35/5mrWrLBs2qzynIgazD4PSX4p4T96rnvgkLhx1Yj6llTf+/3vCNTIVVOW2R6729JPmqURELg jkzZykFO1P/uz0E3iG7WVNs0kuwz481/gKmpH20FtbCwJK1XqDDEKw7Zz9n9gyx05mlzhRPL2fpG/ wfzPdKqsw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKlnL-0002Wa-5B; Thu, 08 Nov 2018 15:00:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 42B0820284F98; Thu, 8 Nov 2018 16:00:28 +0100 (CET) Date: Thu, 8 Nov 2018 16:00:28 +0100 From: Peter Zijlstra To: Song Liu Cc: Netdev , lkml , Kernel Team , "ast@kernel.org" , "daniel@iogearbox.net" , "acme@kernel.org" Subject: Re: [RFC perf,bpf 1/5] perf, bpf: Introduce PERF_RECORD_BPF_EVENT Message-ID: <20181108150028.GU9761@hirez.programming.kicks-ass.net> References: <20181106205246.567448-1-songliubraving@fb.com> <20181106205246.567448-2-songliubraving@fb.com> <20181107084057.GG9781@hirez.programming.kicks-ass.net> <31067290-4B66-4AA1-8027-607397BC0264@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31067290-4B66-4AA1-8027-607397BC0264@fb.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 06:25:04PM +0000, Song Liu wrote: > > > > On Nov 7, 2018, at 12:40 AM, Peter Zijlstra wrote: > > > > On Tue, Nov 06, 2018 at 12:52:42PM -0800, Song Liu wrote: > >> For better performance analysis of BPF programs, this patch introduces > >> PERF_RECORD_BPF_EVENT, a new perf_event_type that exposes BPF program > >> load/unload information to user space. > >> > >> /* > >> * Record different types of bpf events: > >> * enum perf_bpf_event_type { > >> * PERF_BPF_EVENT_UNKNOWN = 0, > >> * PERF_BPF_EVENT_PROG_LOAD = 1, > >> * PERF_BPF_EVENT_PROG_UNLOAD = 2, > >> * }; > >> * > >> * struct { > >> * struct perf_event_header header; > >> * u16 type; > >> * u16 flags; > >> * u32 id; // prog_id or map_id > >> * }; > >> */ > >> PERF_RECORD_BPF_EVENT = 17, > >> > >> PERF_RECORD_BPF_EVENT contains minimal information about the BPF program. > >> Perf utility (or other user space tools) should listen to this event and > >> fetch more details about the event via BPF syscalls > >> (BPF_PROG_GET_FD_BY_ID, BPF_OBJ_GET_INFO_BY_FD, etc.). > > > > Why !? You're failing to explain why it cannot provide the full > > information there. > > Aha, I missed this part. I will add the following to next version. Please > let me know if anything is not clear. > > This design decision is picked for the following reasons. First, BPF > programs could be loaded-and-jited and/or unloaded before/during/after > perf-record run. Once a BPF programs is unloaded, it is impossible to > recover details of the program. It is impossible to provide the > information through a simple key (like the build ID). Second, BPF prog > annotation is under fast developments. Multiple informations will be > added to bpf_prog_info in the next few releases. Including all the > information of a BPF program in the perf ring buffer requires frequent > changes to the perf ABI, and thus makes it very difficult to manage > compatibility of perf utility. So I don't agree with that reasoning. If you want symbol information you'll just have to commit to some form of ABI. That bpf_prog_info is an ABI too. And relying on userspace to synchronously consume perf output to directly call into the kernel again to get more info (through another ABI) is a pretty terrible design. So please try harder. NAK on this.