From: Wu Hao <hao.wu@intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: mdf@kernel.org, will@kernel.org, mark.rutland@arm.com,
linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-api@vger.kernel.org, atull@kernel.org, yilun.xu@intel.com,
Luwei Kang <luwei.kang@intel.com>
Subject: Re: [PATCH v7 2/2] fpga: dfl: fme: add performance reporting support
Date: Wed, 12 Feb 2020 10:39:13 +0800 [thread overview]
Message-ID: <20200212023913.GA5645@hao-dev> (raw)
In-Reply-To: <20200210205618.GA1347752@kroah.com>
On Mon, Feb 10, 2020 at 12:56:18PM -0800, Greg KH wrote:
> On Mon, Feb 10, 2020 at 11:47:49AM +0800, Wu Hao wrote:
> > +What: /sys/bus/event_source/devices/fmeX/format
> > +Date: February 2020
> > +KernelVersion: 5.7
> > +Contact: Wu Hao <hao.wu@intel.com>
> > +Description: Read-only. Attribute group to describe the magic bits
> > + that go into perf_event_attr.config for a particular pmu.
> > + (See ABI/testing/sysfs-bus-event_source-devices-format).
> > +
> > + Each attribute under this group defines a bit range of the
> > + perf_event_attr.config. All supported attributes are listed
> > + below.
> > +
> > + event = "config:0-11" - event ID
> > + evtype = "config:12-15" - event type
> > + portid = "config:16-23" - event source
> > +
> > + For example,
> > +
> > + fab_mmio_read = "event=0x06,evtype=0x02,portid=0xff"
>
> Are perf sysfs files always this bad "multiple values per file"? Or is
> that unique to this driver? If not unique, do you have specific
> examples in the kernel that currently do this today?
Hi Greg,
Thanks a lot for the review. : )
Perf sysfs files allow this kind of output, so some perf drivers are using
the similar format for their jobs.
Examples from my machine.
# cat /sys/bus/event_source/devices/cpu/events/cycles-ct
event=0x3c,in_tx=1,in_tx_cp=1
# cat /sys/bus/event_source/devices/cpu/events/el-start
event=0xc8,umask=0x1
# cat /sys/bus/event_source/devices/cpu/events/instructions
event=0xc0
# cat /sys/bus/event_source/devices/cpu/events/branch-instructions
event=0xc4
See arch/x86/events/intel/core.c
EVENT_ATTR_STR(cycles-ct, cycles_ct, "event=0x3c,in_tx=1,in_tx_cp=1");
...
And descriptions/examples from ABI/testing/sysfs-bus-event_source-devices-events
What: /sys/bus/event_source/devices/<pmu>/events/<event>
Date: 2014/02/24
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Description: Per-pmu performance monitoring events specific to the running system
Each file (except for some of those with a '.' in them, '.unit'
and '.scale') in the 'events' directory describes a single
performance monitoring event supported by the <pmu>. The name
of the file is the name of the event.
File contents:
<term>[=<value>][,<term>[=<value>]]...
Where <term> is one of the terms listed under
/sys/bus/event_source/devices/<pmu>/format/ and <value> is
a number is base-16 format with a '0x' prefix (lowercase only).
If a <term> is specified alone (without an assigned value), it
is implied that 0x1 is assigned to that <term>.
Examples (each of these lines would be in a seperate file):
event=0x2abc
event=0x423,inv,cmask=0x3
domain=0x1,offset=0x8,starting_index=0xffff
domain=0x1,offset=0x8,core=?
Each of the assignments indicates a value to be assigned to a
particular set of bits (as defined by the format file
corresponding to the <term>) in the perf_event structure passed
to the perf_open syscall.
In the case of the last example, a value replacing "?" would
need to be provided by the user selecting the particular event.
This is referred to as "event parameterization". Event
parameters have the format 'param=?'.
So this is not something new introduced by this patch.
>
>
> > +static struct attribute *fme_perf_events_attrs_empty[] = {
> > + NULL,
>
> Huh?
>
> > +};
> > +
> > +static struct attribute_group fme_perf_events_group = {
> > + .name = "events",
> > + .attrs = fme_perf_events_attrs_empty,
>
> You create an empty directory? Why? What goes in here?
>
> very odd...
Actually events are filled into this "events" from several different groups
via pmu->attr_update[1].
pmu->attr_update = fme_perf_events_groups;
pmu->attr_update allows us to update "events" directories with attributes that
depend on various HW conditions. In our case, several different groups with
different is_visible functions are filled into "events" using this method.
And several existing pmu drivers (e.g. arch/x86/events/intel/cstate.c) are
using the same way (having an empty directory first and update it using
pmu->attr_update).
But I have to admit that I should add some comments there to avoid confusion,
sorry, will do that in the next version.
[1] https://lkml.org/lkml/2019/5/4/188
Thanks
Hao
>
> greg k-h
prev parent reply other threads:[~2020-02-12 2:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 3:47 [PATCH v7 0/2] add performance reporting support to FPGA DFL drivers Wu Hao
2020-02-10 3:47 ` Wu Hao
[not found] ` <1581306469-22629-1-git-send-email-hao.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2020-02-10 3:47 ` [PATCH v7 1/2] Documentation: fpga: dfl: add description for performance reporting support Wu Hao
2020-02-10 3:47 ` Wu Hao
2020-02-10 3:47 ` [PATCH v7 2/2] fpga: dfl: fme: add " Wu Hao
2020-02-10 3:47 ` Wu Hao
[not found] ` <1581306469-22629-3-git-send-email-hao.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2020-02-10 16:34 ` Will Deacon
2020-02-10 16:34 ` Will Deacon
2020-02-12 3:19 ` Wu Hao
2020-02-12 3:19 ` Wu Hao
2020-02-12 5:30 ` Greg KH
[not found] ` <20200212053035.GA382718-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2020-02-12 10:02 ` Wu Hao
2020-02-12 10:02 ` Wu Hao
2020-02-12 13:20 ` Greg KH
[not found] ` <20200212132045.GC1789899-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2020-02-13 2:51 ` Wu Hao
2020-02-13 2:51 ` Wu Hao
2020-02-10 20:56 ` Greg KH
2020-02-10 20:56 ` Greg KH
2020-02-12 2:39 ` Wu Hao [this message]
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=20200212023913.GA5645@hao-dev \
--to=hao.wu@intel.com \
--cc=atull@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luwei.kang@intel.com \
--cc=mark.rutland@arm.com \
--cc=mdf@kernel.org \
--cc=will@kernel.org \
--cc=yilun.xu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.