lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5549BF5C.7070906@intel.com>
Date:	Wed, 06 May 2015 10:14:36 +0300
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
CC:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung@...il.com>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH V4 18/24] perf tools: Add Intel BTS support

On 06/05/15 00:09, Arnaldo Carvalho de Melo wrote:
> Em Tue, May 05, 2015 at 04:51:41PM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Thu, Apr 30, 2015 at 05:37:41PM +0300, Adrian Hunter escreveu:
>>> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
>>> ---
>>>  tools/perf/Documentation/intel-bts.txt |  69 +++
>>>
>>> diff --git a/tools/perf/Documentation/intel-bts.txt b/tools/perf/Documentation/intel-bts.txt
>>> new file mode 100644
>>> index 0000000..7a79d36
>>> --- /dev/null
>>> +++ b/tools/perf/Documentation/intel-bts.txt
>>> @@ -0,0 +1,69 @@
>>> +Intel Branch Trace Store
>>> +========================
>>> +
>>> +perf record
>>> +===========
>>> +
>>> +new event
>>> +---------
>>> +
>>> +The Intel BTS kernel driver creates a new PMU for Intel BTS.  The perf record
>>> +option is:
>>> +
>>> +	-e intel_bts//
>>
>> So, I applied up where Jiri acked, and will process more, but without
>> digging deep, lemme ask you you could please reorder the patches so that
>> what is available in more machines can be tested first, i.e. I think
>> that on this machine:
>>
>> [acme@...andy ~]$ perf report --header --stdio
>> Error:
>> The perf.data file has no samples!
>> # ========
>> # captured on: Tue May  5 16:35:13 2015
>> # hostname : ssdandy.ghostprotocols.net
>> # os release : 4.0.0-rc6+
>> # perf version : 4.0.rc6.gef42845
>> # arch : x86_64
>> # nrcpus online : 8
>> # nrcpus avail : 8
>> # cpudesc : Intel(R) Core(TM) i7-2920XM CPU @ 2.50GHz
>> # cpuid : GenuineIntel,6,42,7
>> # total memory : 16318708 kB
>> # cmdline : /home/acme/bin/perf record --per-thread -e intel_bts//u ls 
>> # event : name = intel_bts//u, , type = 7, size = 112, { sample_period,
>> # sample_freq } = 4000, sample_type = IP|TID|PERIOD, disabled = 1,
>> # exclude_kernel = 1, exclude_hv = 1, mmap = 1, comm = 
>> # HEADER_CPU_TOPOLOGY info available, use -I to display
>> # HEADER_NUMA_TOPOLOGY info available, use -I to display
>> # pmu mappings: cpu = 4, intel_bts = 7, software = 1, power = 6,
>> # tracepoint = 2, breakpoint = 5
>> # ========
>> #
>> (END)
>>
>> It has BTS on the cpuinfo and yeah, intel_bts is there on the pmu
>> mappings.
>>
>> So, this is what I have from you already merged:
>>
>> [acme@...andy linux]$ git log --oneline --author hunter | head -20
>> 030026db927b perf record: Add AUX area tracing Snapshot Mode support
>> 1715de1a37b5 perf tools: Add AUX area tracing Snapshot Mode
>> 41a38c374351 perf tools: Add support for PERF_RECORD_ITRACE_START
>> c11e07a556d0 perf tools: Add support for PERF_RECORD_AUX
>> 61c90246aeeb perf auxtrace: Add option to synthesize events for transactions
>> 8214d444516a perf tools: Add build option NO_AUXTRACE to exclude AUX area tracing
>> cd10b2895205 perf tools: Hit all build ids when AUX area tracing
>> 99fa29845349 perf tools: Add AUX area tracing index
>> 64a7e61f11a2 perf report: Fix placement of itrace option in documentation
>> 520a2ebc2f0b perf report: Add Instruction Tracing support
>> 6d5cdd64f314 perf script: Always allow fields 'addr' and 'cpu' for auxtrace
>> b72e74d1f140 perf evlist: Amend mmap ref counting for the AUX area mmap
>> 70d73de4cd57 perf tools: Add aux_watermark member of struct perf_event_attr
>> 400ea6d327ff perf script: Add field option 'flags' to print sample flags
>> 0f0aa5e0693c perf inject: Add Instruction Tracing support
>> cd17a9b54463 perf inject: Re-pipe AUX area tracing events
>> 7a680eb990b6 perf script: Add Instruction Tracing support
>> cfe9174fcfe2 perf tools: Add member to struct dso for an instruction cache
>> c3278f0231e8 perf auxtrace: Add a hashtable for caching
>> 73f75fb1bdc5 perf auxtrace: Add processing for AUX area tracing events
>> [acme@...andy linux]$
>>
>> Will try processing these BTS first, i.e. do the reorder here,
> 
> Not that easy...

I am not sure what can be done.

Any version of perf will accept a PMU event, so users can select
intel_bts or intel_pt even though the tools have no support :-(

For example, a v4.0 perf with no auxtrace/intel_bs/intel_pt support
but with a kernel that does support intel_bts or intel_pt
gives:

$ tools/perf/perf record -e intel_bts//u ls
arch   COPYING  crypto         drivers   fs       init  Kbuild   kernel  MAINTAINERS  mm   perf.data      README          samples  security  tools  virt
block  CREDITS  Documentation  firmware  include  ipc   Kconfig  lib     Makefile     net  perf.data.old  REPORTING-BUGS  scripts  sound     usr
[ perf record: Woken up 1 times to write data ]
0x1f00 [0x20]: failed to process type: 12
Warning:
Found 1 unknown events!

Is this an older tool processing a perf.data file generated by a more recent tool?

If that is not the case, consider reporting to linux-kernel@...r.kernel.org.

[ perf record: Captured and wrote 0.009 MB perf.data ]
$ tools/perf/perf report --header --stdio
Warning:
Found 1 unknown events!

Is this an older tool processing a perf.data file generated by a more recent tool?

If that is not the case, consider reporting to linux-kernel@...r.kernel.org.

# ========
# captured on: Wed May  6 09:55:00 2015
# hostname : bdw03
# os release : 4.0.0-rc6+
# perf version : 4.0.g39a880
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM) i5-5###U CPU @ 2.20GHz
# cpuid : GenuineIntel,6,61,4
# total memory : 3960092 kB
# cmdline : /home/ahunter/git/linux/tools/perf/perf record -e intel_bts//u ls 
# event : name = intel_bts//u, type = 7, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 1, excl_host = 0, excl_guest = 0, precise_ip = 0, attr_mmap2 = 1, attr_mmap  = 1, attr_mm
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# pmu mappings: cpu = 4, intel_bts = 7, software = 1, tracepoint = 2, breakpoint = 5, intel_pt = 6
# ========
#


Perhaps we should disallow intel_bts and intel_pt PMU events
explicitly and put that change back to v4.1 stable at least?

I tried adding:

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 244c66f..5d3ab7c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -442,6 +442,10 @@ static struct perf_pmu *pmu_lookup(const char *name)
        LIST_HEAD(aliases);
        __u32 type;
 
+       /* No support for intel_bts or intel_pt so disallow them */
+       if (!strcmp(name, "intel_bts") || !strcmp(name, "intel_pt"))
+               return NULL;
+
        /*
         * The pmu data we store & need consists of the pmu
         * type value and format definitions. Load both right


And now I get:

$ tools/perf/perf record -e intel_bts//u ls
invalid or unsupported event: 'intel_bts//u'
Run 'perf list' for a list of valid events

 usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

    -e, --event <event>   event selector. use 'perf list' to list available events



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ