From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Stephane Eranian <eranian@google.com>,
Vince Weaver <vince@deater.net>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: Re: [GIT PULL 0/8] perf/pt -> Intel PT/BTS
Date: Thu, 2 Jul 2015 10:02:26 -0300 [thread overview]
Message-ID: <20150702130226.GF8882@kernel.org> (raw)
In-Reply-To: <55953005.6020603@intel.com>
Em Thu, Jul 02, 2015 at 03:35:17PM +0300, Adrian Hunter escreveu:
> On 02/07/15 12:43, Ingo Molnar wrote:
> > Old tooling won't have the feature flag set and won't have the string pointer in
> > perf_attr, so nothing will happen on that case.
> >
> > New tooling that supports 'extended error reporting' has the feature flag set and
> > the kernel will copy the error string into the provided user-space string buffer,
> > where tooling could use that string to generate more meaningful error messages:
> >
> > perf syscall error: The BTS hardware feature is not available on this CPU.
> >
> > Does this make sense to you?
> Normally the warts of syscalls are hidden by libraries. I am not sure a
> library couldn't do just as well with the advantage that it would work for
> old kernels too. A library could also have information about multiple
> architectures, not just the one that is actually running e.g. your BTS
> example won't work on ARM.
> A library could provide a similar API to the one you described. Either it
> just does the syscall and returns, or if extended error information is
> requested, it probes the API with various options, checks
> perf_event_paranoid, and generally uses whatever information it can to best
> figure out what went wrong.
Agreed, that is what tools/perf/util/evsel.c does, e.g.:
static struct {
bool sample_id_all;
bool exclude_guest;
bool mmap2;
bool cloexec;
bool clockid;
bool clockid_wrong;
} perf_missing_features;
And in __perf_evsel__open():
/*
* Must probe features in the order they were added to the
* perf_event_attr interface.
*/
if (!perf_missing_features.clockid_wrong && evsel->attr.use_clockid) {
perf_missing_features.clockid_wrong = true;
goto fallback_missing_features;
} else if (!perf_missing_features.clockid && evsel->attr.use_clockid) {
perf_missing_features.clockid = true;
goto fallback_missing_features;
} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
perf_missing_features.cloexec = true;
goto fallback_missing_features;
} else if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {
perf_missing_features.mmap2 = true;
goto fallback_missing_features;
} else if (!perf_missing_features.exclude_guest &&
(evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
perf_missing_features.exclude_guest = true;
goto fallback_missing_features;
} else if (!perf_missing_features.sample_id_all) {
perf_missing_features.sample_id_all = true;
goto retry_sample_id;
}
So it does already probe for features available in the kernel and reacts
as best as imagined so far to kernels lacking those features.
The whole point here is: who writes the library? Those who need it to
support some feature they want to have merged?
We can use the existing infrastructure to the fullest extent possible,
but at some point we need to extend it, who does it?
> > Now an additional complication is the fact that BTS can now also be a separate
> > PMU, listed under /sys/bus/event_source/devices/intel_bts/.
> > If it's not listed there, we don't know the exact reason: is it not available
> > because it's an old kernel? Or is it the wrong CPU?
> > We could solve that by extending the sysfs interface and adding an "error" file to
> > the PMU directory: which would contain the reason why the driver was not created.
> > I.e. if the BTS driver was not created, we'd still have
> > /sys/bus/event_source/devices/intel_bts/error (and no other file), which gives
> > tooling a good way to discover why a particular PMU is not available. This adds a
> > tiny bit more RAM overhead, but it's for the better I think, because tooling could
> > be a lot more certain about what the capabilities of the kernel are.
> That presumes the user understands what is or is not available on their
> architecture, because on a non-x86 architecture they still get nothing
> x86-specific.
> It also runs a bit against the way config works e.g. even if the PMU driver
> is config'ed out it still has to provide a sysfs interface.
> So, isn't the patch I proposed sufficient for now?
I haven't tested it so far, but it seems to improve things, given the
current infrastructure.
- Arnaldo
next prev parent reply other threads:[~2015-07-02 13:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 22:02 [GIT PULL 0/8] perf/pt -> Intel PT/BTS Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 1/8] perf auxtrace: Add Intel PT as an AUX area tracing type Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 2/8] perf tools: Add Intel PT packet decoder Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 3/8] perf tools: Add Intel PT instruction decoder Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 4/8] perf tools: Add Intel PT log Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 5/8] perf tools: Add Intel PT decoder Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 6/8] perf tools: Add Intel PT support Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 7/8] perf tools: Take Intel PT into use Arnaldo Carvalho de Melo
2015-06-26 22:02 ` [PATCH 8/8] perf tools: Add Intel BTS support Arnaldo Carvalho de Melo
2015-06-30 4:58 ` [GIT PULL 0/8] perf/pt -> Intel PT/BTS Ingo Molnar
2015-06-30 7:54 ` Adrian Hunter
2015-06-30 10:56 ` Ingo Molnar
2015-06-30 13:23 ` Adrian Hunter
2015-06-30 14:39 ` Arnaldo Carvalho de Melo
2015-07-01 8:19 ` Adrian Hunter
2015-07-01 12:47 ` Adrian Hunter
2015-07-02 9:28 ` Ingo Molnar
2015-07-02 9:43 ` Ingo Molnar
2015-07-02 12:35 ` Adrian Hunter
2015-07-02 13:02 ` Arnaldo Carvalho de Melo [this message]
2015-07-02 19:00 ` Ingo Molnar
2015-07-03 9:08 ` Adrian Hunter
2015-07-03 14:31 ` Alexander Shishkin
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=20150702130226.GF8882@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=vince@deater.net \
/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