netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>, Networking <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	Kernel Team <Kernel-team@fb.com>,
	"ast@kernel.org" <ast@kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	Jiri Olsa <jolsa@kernel.org>, Andi Kleen <andi@firstfloor.org>
Subject: Re: [PATCH v2 bpf-next 1/2] bpftool: introduce "prog profile" command
Date: Tue, 3 Mar 2020 10:06:29 -0300	[thread overview]
Message-ID: <20200303130629.GA13702@kernel.org> (raw)
In-Reply-To: <67921C65-D391-47C9-9582-C9D6060161A1@fb.com>

Em Tue, Mar 03, 2020 at 12:10:50AM +0000, Song Liu escreveu:
> > On Mar 1, 2020, at 8:24 PM, Yonghong Song <yhs@fb.com> wrote:
> >> +	},
> >> +	{
> >> +		.name = "instructions",
> >> +		.attr = {
> >> +			.freq = 0,
> >> +			.sample_period = SAMPLE_PERIOD,
> >> +			.inherit = 0,
> >> +			.type = PERF_TYPE_HARDWARE,
> >> +			.read_format = 0,
> >> +			.sample_type = 0,
> >> +			.config = PERF_COUNT_HW_INSTRUCTIONS,
> >> +		},
> >> +		.ratio_metric = 1,
> >> +		.ratio_mul = 1.0,
> >> +		.ratio_desc = "insn per cycle",
> >> +	},
> >> +	{
> >> +		.name = "l1d_loads",
> >> +		.attr = {
> >> +			.freq = 0,
> >> +			.sample_period = SAMPLE_PERIOD,
> >> +			.inherit = 0,
> >> +			.type = PERF_TYPE_HW_CACHE,
> >> +			.read_format = 0,
> >> +			.sample_type = 0,
> >> +			.config =
> >> +				PERF_COUNT_HW_CACHE_L1D |
> >> +				(PERF_COUNT_HW_CACHE_OP_READ << 8) |
> >> +				(PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16),
> >> +		},
> > 
> > why we do not have metric here?
> 
> This follows perf-stat design: some events have another event to compare 
> against, like instructions per cycle, etc. 
> 
> > 
> >> +	},
> >> +	{
> >> +		.name = "llc_misses",
> >> +		.attr = {
> >> +			.freq = 0,
> >> +			.sample_period = SAMPLE_PERIOD,
> >> +			.inherit = 0,
> >> +			.type = PERF_TYPE_HW_CACHE,
> >> +			.read_format = 0,
> >> +			.sample_type = 0,
> >> +			.config =
> >> +				PERF_COUNT_HW_CACHE_LL |
> >> +				(PERF_COUNT_HW_CACHE_OP_READ << 8) |
> >> +				(PERF_COUNT_HW_CACHE_RESULT_MISS << 16),
> >> +		},
> >> +		.ratio_metric = 2,
> >> +		.ratio_mul = 1e6,
> >> +		.ratio_desc = "LLC misses per million isns",
> >> +	},
> >> +};

> > icache miss and itlb miss might be useful as well as the code will jump
> > to a different physical page. I think we should addd them. dtlb_miss
> > probably not a big problem, but it would be good to be an option.

> I plan to add more events later on. 

> > For ratio_metric, we explicitly assign a slot here. Any specific reason?
> > We can just say this metric *permits* ratio_metric and then ratio_matric
> > is assigned dynamically by the user command line options?

> > I am thinking how we could support *all* metrics the underlying system
> > support based on `perf list`. This can be the future work though.
 
> We are also thinking about adding similar functionality to perf-stat, 
> which will be more flexible. 

Yeah, being able to count events bpf programs using the technique you're
using here but instead using 'perf stat' to set it up and then use what
is already in 'perf stat' would be really great, having the same
interface for BPF programs as we have for tid, pid, cgroups, system
wide, etc.

If you try it and find any problems with the codebase I'll be happy to
help as I think others working with 'perf stat' will too,

Cheers,

- Arnaldo

  reply	other threads:[~2020-03-03 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 23:40 [PATCH v2 bpf-next 0/2] bpftool: introduce prog profile Song Liu
2020-02-28 23:40 ` [PATCH v2 bpf-next 1/2] bpftool: introduce "prog profile" command Song Liu
2020-03-01  3:52   ` Yonghong Song
2020-03-01 22:37     ` Song Liu
2020-03-02  3:42       ` Yonghong Song
2020-03-02  4:26         ` Yonghong Song
2020-03-01  4:14   ` Yonghong Song
2020-03-01 22:37     ` Song Liu
2020-03-02  4:24   ` Yonghong Song
2020-03-03  0:10     ` Song Liu
2020-03-03 13:06       ` Arnaldo Carvalho de Melo [this message]
2020-03-02 13:36   ` Quentin Monnet
2020-03-02 16:52     ` Song Liu
2020-02-28 23:40 ` [PATCH v2 bpf-next 2/2] bpftool: Documentation for bpftool prog profile Song Liu
2020-03-02 13:36   ` Quentin Monnet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200303130629.GA13702@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=Kernel-team@fb.com \
    --cc=andi@firstfloor.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).