Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1314606imc; Mon, 11 Mar 2019 10:57:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjbTieqoOyhUeuDbso/2Dp1GcOXa9s+vPvqNn2P+0qNhTsTYGPL2MEoFUqp3Dh3N/lLXwP X-Received: by 2002:aa7:854d:: with SMTP id y13mr34158232pfn.175.1552327067587; Mon, 11 Mar 2019 10:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552327067; cv=none; d=google.com; s=arc-20160816; b=FAWq61LWrp0i/XUWUysEJ3RJudWx1eWB1u0qDp3ubiy3Wx737Tg/rrxjCT/D3DTREX RSjQ83cJ0URgJWj8kX3Q21tIx8N5Szr8f83sppAHoP5gItAGLxpR/PiGjARuOasia3lu EsfsRUZzezhSzxTLT2QBfpJVSiWHHpQ+c9YRPcC9l2zbc656HcMdJPjL5epEh+41lO2X 3n8txjUqm8Boet23652c/5GcpfLkCXR6FN2qya6bzR2SlOhJiTa2+kpCoeJo9HWdx3Ou AX46xlUm9iK+34h8a2Avv8yCDVcFsyzZWi/7MXDRtMBGUthNCbHcU/H+FpbW0W6AwdnK m2FA== 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; bh=GIvANdOAYja4dbb14PwmSJg7SSJrnXHICKn+IVACVZM=; b=vQqMPwCLq7eMG8z7hdJk8+8e3EHzlfevOvNmQzOQ1fYtCvuIHZX+tTSBiRvtMWBl1v HTCQgC1p7iOAowtFGvYB32+lDIu8M+vo/UaaxX8TKZxicoG361dYIldsi3R3TO9cI8l6 EiRf0eWKTDdqedPD6Q9mvK+SFbM0Y11LAfIupArZXUu4lLigAxuRGPhWcGUZhC9GPTqU sVeczjd8ZGYK63t7QGFkcV9LWvAJttyP3Acf2+DDs2xhsLWoyESFuR1uKP7SGzR9GHO8 0dfFP6Xrw0XwR4taEq1zQlgsD6h5bXRrPzKZBVwz1nvKqLPoWU9vqhZZU1JSEC+VzTZ2 OM5Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16si5288964pgv.70.2019.03.11.10.57.31; Mon, 11 Mar 2019 10:57:47 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728172AbfCKR47 (ORCPT + 99 others); Mon, 11 Mar 2019 13:56:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726675AbfCKR47 (ORCPT ); Mon, 11 Mar 2019 13:56:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D4BD309EA7A; Mon, 11 Mar 2019 17:56:58 +0000 (UTC) Received: from krava (ovpn-204-107.brq.redhat.com [10.40.204.107]) by smtp.corp.redhat.com (Postfix) with SMTP id D84801001DDD; Mon, 11 Mar 2019 17:56:55 +0000 (UTC) Date: Mon, 11 Mar 2019 18:56:54 +0100 From: Jiri Olsa To: Song Liu Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, kernel-team@fb.com, peterz@infradead.org, acme@redhat.com, jolsa@kernel.org, namhyung@kernel.org Subject: Re: [PATCH v7 perf,bpf 07/15] perf, bpf: save bpf_prog_info information as headers to perf.data Message-ID: <20190311175654.GC19721@krava> References: <20190307175810.249857-1-songliubraving@fb.com> <20190307175810.249857-8-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190307175810.249857-8-songliubraving@fb.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 11 Mar 2019 17:56:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 07, 2019 at 09:58:02AM -0800, Song Liu wrote: > This patch enables perf-record to save bpf_prog_info information as > headers to perf.data. A new header type HEADER_BPF_PROG_INFO is > introduced for this data. > > Signed-off-by: Song Liu > --- > tools/perf/util/header.c | 145 ++++++++++++++++++++++++++++++++++++++- > tools/perf/util/header.h | 1 + > 2 files changed, 145 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c > index 4b88de5e9192..f0708188211e 100644 > --- a/tools/perf/util/header.c > +++ b/tools/perf/util/header.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > > #include "evlist.h" > #include "evsel.h" > @@ -39,6 +40,7 @@ > #include "tool.h" > #include "time-utils.h" > #include "units.h" > +#include "bpf-event.h" > > #include "sane_ctype.h" > > @@ -1074,6 +1076,54 @@ static int write_clockid(struct feat_fd *ff, > sizeof(ff->ph->env.clockid_res_ns)); > } > > +static int write_bpf_prog_info(struct feat_fd *ff, > + struct perf_evlist *evlist __maybe_unused) > +{ > + struct perf_env *env = &ff->ph->env; > + struct rb_root *root; > + struct rb_node *next; > + u32 count = 0; > + int ret; > + > + down_read(&env->bpf_progs.lock); > + > + root = &env->bpf_progs.infos; > + next = rb_first(root); > + while (next) { > + ++count; > + next = rb_next(next); > + } sry I did not se this before, but why you don't keep program count in perf_env::bpf_progs::infos_cnt ? jirka