Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1791147imu; Thu, 22 Nov 2018 23:47:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vlgds5b8VGnh92A9QNiXpW/49ItuSAJNNu5hz8Fzdeu5xSsXtvUzpt1PgtIHd9F4gjcoCc X-Received: by 2002:a17:902:2f03:: with SMTP id s3mr13956163plb.277.1542959271529; Thu, 22 Nov 2018 23:47:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542959271; cv=none; d=google.com; s=arc-20160816; b=uS0Htzk/zrMm8kOPp3eGvuVb/wgsM/8MsM1O6S1+pNwEqKK7fdZvpv9QqBTWpqTvCz 6fTBexEDMXGdzpurAJqVf9AIE69b+1MbhXCIZnJSpLX1OMWlYw56BBWGv5op/9un2+rA KzhIxkI/0KM2SIBvFMvBEns7JKY40tVjektJwcD7nHabSLnbNo0i1OBsq0SGv082BvWr 3cdqeuqcF1GCoyXBpztPz5OldfwbHSQ0Lm4G1pRQZTac4EmNHjDMrQ73ejPO7qqPI3X8 koBO+gwq+j3lo1roCnqht84bR2OGoNuf9Zw2gRUNsaceszzzQEs8USt/86zqziCQGNS7 iPrQ== 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=Uroc4STou8Rt8PF72AReZCmVPgM2zJxM5RyxZsLix1I=; b=W0tjAg60GMlTmUtiah+/Va+4bzIDMKLMSCVQ0yrwvKrDxfLboa4ZEg6XWpV8hair67 Fhbf6kFdTgk+CXKnN/3j1LlGTiRUVRoZ8MHUbjXO26NDlaEaOX+Kz2524325xFx/+1Rf sfHFUHP5VeVwC4tJGoFQhzp0ByCCeoWXfjIM+/wHuAYtS9/rxdzNka/v28A34Rl7+4SS /4huq9kd0KWInvcPXwNZAD0mPPw6zGMv6lq5Zh0AZ+st4hjSM9p1D8yJp64jakiP+4tB YHLo3vmOwMZOmBHgfJIKDfGwof4oMEQiPjQjwz/VQ87wm44UfKaLjp8/2HSAeplOaJuj TCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=DW9xtphq; 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 y141si32241853pfc.180.2018.11.22.23.47.36; Thu, 22 Nov 2018 23:47:51 -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=DW9xtphq; 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 S2393491AbeKVULR (ORCPT + 99 others); Thu, 22 Nov 2018 15:11:17 -0500 Received: from merlin.infradead.org ([205.233.59.134]:37090 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387669AbeKVULQ (ORCPT ); Thu, 22 Nov 2018 15:11:16 -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=Uroc4STou8Rt8PF72AReZCmVPgM2zJxM5RyxZsLix1I=; b=DW9xtphq0zZPwWwIYgpWFPG9Z HODM3TFnANT7jZHZR9487YM73Cd/e5W58xuLp1IO3gHUzZxPT8Xdzcub/drERJZWlcfiV4Biq7uFj rFgqf6aJ/rDvggm4rCGGnSfVO85Q8ZkzOsWFqH20uKuYUAgBzApf1BVBVLYGvaFSbqGxCpWuNC/96 SKAvF80YWD9JzwNcjPhaPBvxV0TxZKuV6sHZmylda6Mt8yHWzrKP5F1xiZ6VT6/k3G8TFNi00btaB JU0Dq8W3FGvJ80myViZEW+GqX8t3BP6T/B5jdGt4n1tY/F5SR2Qz2l7JcGMk3qzzp+x8m8VDLFdye J8wvX2T1A==; 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 1gPlLb-0008Mc-0m; Thu, 22 Nov 2018 09:32:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B81832029FD58; Thu, 22 Nov 2018 10:32:19 +0100 (CET) Date: Thu, 22 Nov 2018 10:32:19 +0100 From: Peter Zijlstra To: Song Liu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, acme@kernel.org, kernel-team@fb.com Subject: Re: [PATCH perf,bpf 0/5] reveal invisible bpf programs Message-ID: <20181122093219.GK2131@hirez.programming.kicks-ass.net> References: <20181121195502.3259930-1-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181121195502.3259930-1-songliubraving@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 21, 2018 at 11:54:57AM -0800, Song Liu wrote: > Changes RFC -> PATCH v1: > > 1. In perf-record, poll vip events in a separate thread; > 2. Add tag to bpf prog name; > 3. Small refactorings. > > Original cover letter (with minor revisions): > > This is to follow up Alexei's early effort to show bpf programs > > https://www.spinics.net/lists/netdev/msg524232.html > > In this version, PERF_RECORD_BPF_EVENT is introduced to send real time BPF > load/unload events to user space. In user space, perf-record is modified > to listen to these events (through a dedicated ring buffer) and generate > detailed information about the program (struct bpf_prog_info_event). Then, > perf-report translates these events into proper symbols. > > With this set, perf-report will show bpf program as: > > 18.49% 0.16% test [kernel.vmlinux] [k] ksys_write > 18.01% 0.47% test [kernel.vmlinux] [k] vfs_write > 17.02% 0.40% test bpf_prog [k] bpf_prog_07367f7ba80df72b_ > 16.97% 0.10% test [kernel.vmlinux] [k] __vfs_write > 16.86% 0.12% test [kernel.vmlinux] [k] comm_write > 16.67% 0.39% test [kernel.vmlinux] [k] bpf_probe_read > > Note that, the program name is still work in progress, it will be cleaner > with function types in BTF. > > Please share your comments on this. So I see: kernel/bpf/core.c:void bpf_prog_kallsyms_add(struct bpf_prog *fp) which should already provide basic symbol information for extant eBPF programs, right? And (AFAIK) perf uses /proc/kcore for annotate on the current running kernel (if not, it really should, given alternatives, jump_labels and all other other self-modifying code). So this fancy new stuff is only for the case where your profile spans eBPF load/unload events (which should be relatively rare in the normal case, right), or when you want source annotated asm output (I normally don't bother with that). That is; I would really like this fancy stuff to be an optional extra that is typically not needed. Does that make sense?