<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/perf, branch v4.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-06-10T18:15:41Z</updated>
<entry>
<title>Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2016-06-10T18:15:41Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-06-10T18:15:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7fcbc230c6f0ee96d397e30d061ef4995879b835'/>
<id>urn:sha1:7fcbc230c6f0ee96d397e30d061ef4995879b835</id>
<content type='text'>
Pull perf fixes from Ingo Molnar:
 "A handful of tooling fixes, two PMU driver fixes and a cleanup of
  redundant code that addresses a security analyzer false positive"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Remove a redundant check
  perf/x86/intel/uncore: Remove SBOX support for Broadwell server
  perf ctf: Convert invalid chars in a string before set value
  perf record: Fix crash when kptr is restricted
  perf symbols: Check kptr_restrict for root
  perf/x86/intel/rapl: Fix pmus free during cleanup
</content>
</entry>
<entry>
<title>perf ctf: Convert invalid chars in a string before set value</title>
<updated>2016-05-27T15:08:40Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-27T11:35:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5ea5888b2fbf5b230da62b2a21c8247bebb6c9cf'/>
<id>urn:sha1:5ea5888b2fbf5b230da62b2a21c8247bebb6c9cf</id>
<content type='text'>
We observed some crazy apps on Android set their comm to unprintable
string. For example:

  # cat /proc/10607/task/*/comm
  tencent.qqmusic
  ...
  Binder_2
  日志输出线  &lt;-- Chinese word 'log output thread'
  WifiManager
  ...

'perf data convert' fails to convert perf.data with such string to CTF format.

For example:

  # cat &lt;&lt; EOF &gt; ./badguy.c
  #include &lt;sys/prctl.h&gt;
  int main(int argc, char *argv[])
  {
         prctl(PR_SET_NAME, "\xe6\x97\xa5\xe5\xbf\x97\xe8\xbe\x93\xe5\x87\xba\xe7\xba\xbf");
         while(1)
                 sleep(1);
         return 0;
  }
  EOF
  # gcc ./badguy.c
  # perf record -e sched:* ./a.out
  # perf data convert --to-ctf ./bad.ctf
  CTF stream 4 flush failed
  [ perf data convert: Converted 'perf.data' into CTF data './bad.ctf' ]
  [ perf data convert: Converted and wrote 0.008 MB (78 samples)  ]
  # babeltrace ./bad.ctf/
  [error] Packet size (18446744073709551615 bits) is larger than remaining file size (262144 bits).
  [error] Stream index creation error.
  [error] Open file stream error.
  [warning] [Context] Cannot open_trace of format ctf at path ./bad.ctf.
  [warning] [Context] cannot open trace "./bad.ctf" from ./bad.ctf/ for reading.
  [error] Cannot open any trace for reading.

  [error] opening trace "./bad.ctf/" for reading.

  [error] none of the specified trace paths could be opened.

This patch converts unprintable characters to hexadecimal word.

After applying this patch the above test works correctly:

  # ~/perf data convert --to-ctf ./good.ctf
  [ perf data convert: Converted 'perf.data' into CTF data './good.ctf' ]
  [ perf data convert: Converted and wrote 0.008 MB (78 samples) ]
  # babeltrace ./good.ctf
  ..
  [23:14:35.491665268] (+0.000001100) sched:sched_wakeup: { cpu_id = 4 }, { perf_ip = 0xFFFFFFFF810AEF33, perf_tid = 0, perf_pid = 0, perf_id = 5123, perf_period = 1, common_type = 270, common_flags = 45, common_preempt_count = 4, common_pid = 0, comm = "\xe6\x97\xa5\xe5\xbf\x97\xe8\xbe\x93\xe5\x87\xba\xe7\xba\xbf", pid = 1057, prio = 120, success = 1, target_cpu = 4 }
  [23:14:35.491666230] (+0.000000962) sched:sched_wakeup: { cpu_id = 4 }, { perf_ip = 0xFFFFFFFF810AEF33, perf_tid = 0, perf_pid = 0, perf_id = 5122, perf_period = 1, common_type = 270, common_flags = 45, common_preempt_count = 4, common_pid = 0, comm = "\xe6\x97\xa5\xe5\xbf\x97\xe8\xbe\x93\xe5\x87\xba\xe7\xba\xbf", pid = 1057, prio = 120, success = 1, target_cpu = 4 }
  ..

Committer note:

To build perf with libabeltrace, use:

  $ mkdir -p /tmp/build/perf
  $ make LIBBABELTRACE=1 LIBBABELTRACE_DIR=/usr/local O=/tmp/build/perf -C tools/perf install-bin

Or equivalent (no O=, fixup LIBBABELTRACE_DIR, etc).

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1464348951-179595-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf record: Fix crash when kptr is restricted</title>
<updated>2016-05-27T12:41:39Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-24T09:21:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3dc6c1d54ff4cc9ce7e8513c286c970304cde20b'/>
<id>urn:sha1:3dc6c1d54ff4cc9ce7e8513c286c970304cde20b</id>
<content type='text'>
Before this patch, a simple 'perf record' could fail if kptr_restrict is
set to 1 (for normal user) or 2 (for root):

  # perf record ls
  WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,
  check /proc/sys/kernel/kptr_restrict.

  Samples in kernel functions may not be resolved if a suitable vmlinux
  file is not found in the buildid cache or in the vmlinux path.

  Samples in kernel modules won't be resolved at all.

  If some relocation was applied (e.g. kexec) symbols may be misresolved
  even with a suitable vmlinux or kallsyms file.

  Segmentation fault (core dumped)

This patch skips perf_event__synthesize_kernel_mmap() when kptr is not
available.

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Fixes: 45e90056904b ("perf machine: Do not bail out if not managing to read ref reloc symbol")
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1464081688-167940-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf symbols: Check kptr_restrict for root</title>
<updated>2016-05-27T12:41:23Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-24T09:21:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=38272dc4f1b17437871b786d567e1242d0904f5a'/>
<id>urn:sha1:38272dc4f1b17437871b786d567e1242d0904f5a</id>
<content type='text'>
If kptr_restrict is set to 2, even root is not allowed to see pointers.
This patch checks kptr_restrict even if euid == 0. For root, report
error if kptr_restrict is 2.

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Tested-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1464081688-167940-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2016-05-26T00:05:40Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-05-26T00:05:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bdc6b758e443c21c39a14c075e5b7e01f095b37b'/>
<id>urn:sha1:bdc6b758e443c21c39a14c075e5b7e01f095b37b</id>
<content type='text'>
Pull perf updates from Ingo Molnar:
 "Mostly tooling and PMU driver fixes, but also a number of late updates
  such as the reworking of the call-chain size limiting logic to make
  call-graph recording more robust, plus tooling side changes for the
  new 'backwards ring-buffer' extension to the perf ring-buffer"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (34 commits)
  perf record: Read from backward ring buffer
  perf record: Rename variable to make code clear
  perf record: Prevent reading invalid data in record__mmap_read
  perf evlist: Add API to pause/resume
  perf trace: Use the ptr-&gt;name beautifier as default for "filename" args
  perf trace: Use the fd-&gt;name beautifier as default for "fd" args
  perf report: Add srcline_from/to branch sort keys
  perf evsel: Record fd into perf_mmap
  perf evsel: Add overwrite attribute and check write_backward
  perf tools: Set buildid dir under symfs when --symfs is provided
  perf trace: Only auto set call-graph to "dwarf" when syscalls are being traced
  perf annotate: Sort list of recognised instructions
  perf annotate: Fix identification of ARM blt and bls instructions
  perf tools: Fix usage of max_stack sysctl
  perf callchain: Stop validating callchains by the max_stack sysctl
  perf trace: Fix exit_group() formatting
  perf top: Use machine-&gt;kptr_restrict_warned
  perf trace: Warn when trying to resolve kernel addresses with kptr_restrict=1
  perf machine: Do not bail out if not managing to read ref reloc symbol
  perf/x86/intel/p4: Trival indentation fix, remove space
  ...
</content>
</entry>
<entry>
<title>perf record: Read from backward ring buffer</title>
<updated>2016-05-23T21:22:48Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-23T07:13:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3a62a7b8200a177ad96161e4f2678514e6ee301e'/>
<id>urn:sha1:3a62a7b8200a177ad96161e4f2678514e6ee301e</id>
<content type='text'>
Introduce rb_find_range() to find start and end position from a backward
ring buffer.

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1463987628-163563-5-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang &lt;hekuang@huawei.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf record: Rename variable to make code clear</title>
<updated>2016-05-23T21:22:47Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-23T07:13:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=09fa4f401296f555afb6f2f4282717644d94722e'/>
<id>urn:sha1:09fa4f401296f555afb6f2f4282717644d94722e</id>
<content type='text'>
record__mmap_read() writes data from ring buffer into perf.data.  'head'
is maintained by the kernel, points to the last written record.
'old' is maintained by perf, points to the record read in previous
round. record__mmap_read() saves data from 'old' to 'head' to
perf.data.

The names of these variables are not very intutive. In addition,
when dealing with backward writing ring buffer, the md-&gt;prev pointer
should point to 'head' instead of the last byte it got.

Add 'start' and 'end' pointer to make code clear and set md-&gt;prev to
'head' instead of the moved 'old' pointer. This patch doesn't change
behavior since:

    buf = &amp;data[old &amp; md-&gt;mask];
    size = head - old;
    old += size;     &lt;--- Here, old == head

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1463987628-163563-4-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang &lt;hekuang@huawei.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf record: Prevent reading invalid data in record__mmap_read</title>
<updated>2016-05-23T21:22:46Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-23T07:13:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d11c65071d489e20b3a811167507939dd8c2eac'/>
<id>urn:sha1:2d11c65071d489e20b3a811167507939dd8c2eac</id>
<content type='text'>
When record__mmap_read() requires data more than the size of ring
buffer, drop those data to avoid accessing invalid memory.

This can happen when reading from overwritable ring buffer, which
should be avoided. However, check this for robustness.

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1463987628-163563-3-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang &lt;hekuang@huawei.com&gt;
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf evlist: Add API to pause/resume</title>
<updated>2016-05-23T21:22:00Z</updated>
<author>
<name>Wang Nan</name>
<email>wangnan0@huawei.com</email>
</author>
<published>2016-05-23T07:13:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=65aea2338765da1a58cc26eeb84d72308492ecb5'/>
<id>urn:sha1:65aea2338765da1a58cc26eeb84d72308492ecb5</id>
<content type='text'>
perf_evlist__toggle_{pause,resume}() are introduced to pause/resume
events in an evlist. Utilize PERF_EVENT_IOC_PAUSE_OUTPUT ioctl.

Following commits use them to ensure overwrite ring buffer is paused
before reading.

Signed-off-by: Wang Nan &lt;wangnan0@huawei.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1463987628-163563-2-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang &lt;hekuang@huawei.com&gt;
[ Return -1, like all other ioctl() usage in evlist.c, rename 'pause'
  arg to avoid breaking the build on ubuntu 12.04 and other old systems ]
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>perf trace: Use the ptr-&gt;name beautifier as default for "filename" args</title>
<updated>2016-05-23T19:41:00Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2016-05-23T19:37:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=12f3ca4fc8e27aa602c9c3c717d755b1e8f7fd47'/>
<id>urn:sha1:12f3ca4fc8e27aa602c9c3c717d755b1e8f7fd47</id>
<content type='text'>
Auto-attach the ptr-&gt;name beautifier to syscall args "filename", "path"
and "pathname" if they are of type "const char *".

Cc: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Milian Wolff &lt;milian.wolff@kdab.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Wang Nan &lt;wangnan0@huawei.com&gt;
Link: http://lkml.kernel.org/n/tip-jxii4qmcgoppftv0zdvml9d7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
</feed>
