From: Jiri Olsa <jolsa@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Jiri Olsa <jolsa@kernel.org>,
"Liang, Kan" <kan.liang@linux.intel.com>,
Stephane Eranian <eranian@google.com>,
Andy Lutomirski <luto@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Vince Weaver <vincent.weaver@maine.edu>,
Thomas Gleixner <tglx@linutronix.de>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH 1/8] perf/x86: Add msr probe interface
Date: Thu, 21 Mar 2019 12:09:01 +0100 [thread overview]
Message-ID: <20190321110901.GA16430@krava> (raw)
In-Reply-To: <20190320160329.GA14021@kroah.com>
On Wed, Mar 20, 2019 at 05:03:29PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Mar 20, 2019 at 04:48:33PM +0100, Peter Zijlstra wrote:
> > On Mon, Mar 18, 2019 at 07:21:09PM +0100, Jiri Olsa wrote:
> > > Adding perf_msr_probe function to provide interface for
> > > checking up on MSR register and add its related event
> > > attributes if it passes the check.
> > >
> > > User defines following struct for each MSR register:
> > >
> > > struct perf_msr {
> > > u64 msr;
> > > struct attribute **attrs;
>
> Please use attribute groups where ever possible. I've been working to
> fix up the remaining places that use list of attributes as that is not
> flexible at all (and broken in places.)
>
> And this is a device, so why not device attributes?
ok, will check
>
> > > bool (*test)(int idx, void *data);
> > > bool no_check;
> > > };
> > >
> > > Where:
> > > msr - is the MSR address
> > > attrs - is attributes array to add if the check passed
> > > test - is test function pointer
> > > no_check - is bool that bypass the check and adds the
> > > attribute without any test
> > >
> > > The array of struct perf_msr is passed into:
> > >
> > > perf_msr_probe(struct perf_msr *msr, int cnt,
> > > struct attribute **attrs, void *data)
> > >
> > > Together with:
> > > cnt - which is the number of struct msr array elements
> > > attrs - which is an array placeholder for added attributes
> > > and needs to be big enough
> > > data -which is user pointer passed to the test function
> > >
> > > The perf_msr_probe will executed test code, read the MSR and
> > > check the value is != 0. If all these tests pass, related
> > > attributes are added into attrs array.
> > >
> > > Also adding MSR_ATTR macro helper to define attribute array
> > > from single attribute. It will be used in following patches.
>
> Please no, don't we have enough ATTR macros? Why do you need another
> one? What are you trying to save code on?
>
> > Somewhere along the line you lost the explanation of _why_ we're doing
> > this; namely: virt sucks.
> >
> > Also, recently GregKH had a chance to look at perf code and we scored
> > fairly high on the WTF'o'meter for what we're doing with the attribute
> > stuff.
> >
> > He pointed me to sysfs attribute_group::is_visible functions to replace
> > some of our 'creative' code.
>
> Yes, that would be very good to do. If no one is working on it, I can
> take a look next week as I have long plane rides...
if I dont send v2 till then, it's all yours ;-)
thanks,
jirka
next prev parent reply other threads:[~2019-03-21 11:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 18:21 [RFC 0/8] perf/x86: Add msr probe interface Jiri Olsa
2019-03-18 18:21 ` [PATCH 1/8] " Jiri Olsa
2019-03-20 15:48 ` Peter Zijlstra
2019-03-20 16:03 ` Greg Kroah-Hartman
2019-03-21 11:09 ` Jiri Olsa [this message]
2019-03-18 18:21 ` [PATCH 2/8] perf/x86/msr: Use new probe function Jiri Olsa
2019-03-18 18:21 ` [PATCH 3/8] perf/x86/cstate: " Jiri Olsa
2019-03-18 18:21 ` [PATCH 4/8] perf/x86/rapl: Use new msr detection interface Jiri Olsa
2019-03-18 18:21 ` [PATCH 5/8] perf/x86/rapl: Get rapl_cntr_mask from new probe framework Jiri Olsa
2019-03-18 18:21 ` [PATCH 6/8] perf/x86/rapl: Get msr values " Jiri Olsa
2019-03-18 18:21 ` [PATCH 7/8] perf/x86/rapl: Get attributes " Jiri Olsa
2019-03-18 18:21 ` [PATCH 8/8] perf/x86/rapl: Get quirk state " Jiri Olsa
-- strict thread matches above, loose matches on Subject: below --
2019-05-27 21:51 [PATCH 0/8] perf/x86: Rework msr probe interface Jiri Olsa
2019-05-27 21:51 ` [PATCH 1/8] perf/x86: Add " Jiri Olsa
2019-05-31 12:09 [PATCHv2 0/8] perf/x86: Rework " Jiri Olsa
2019-05-31 12:09 ` [PATCH 1/8] perf/x86: Add " Jiri Olsa
2019-06-16 14:03 [PATCHv3 0/8] perf/x86: Rework " Jiri Olsa
2019-06-16 14:03 ` [PATCH 1/8] perf/x86: Add " Jiri Olsa
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=20190321110901.GA16430@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vincent.weaver@maine.edu \
/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).