On POWER, the 'perf format parsing' test always fails.
Looks like it is because memset() is being passed number of longs rather
than number of bytes. It is interesting that the test always passes on
my x86 box.
With this patch, the test passes on POWER and continues to pass on x86.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Anton Blanchard <anton@au1.ibm.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@ozlabs.org Link: http://lkml.kernel.org/r/20130117172814.GA18882@us.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Wed, 16 Jan 2013 11:59:53 +0000 (20:59 +0900)]
perf tools: Do not include PERF-VERSION-FILE to Makefile
When make runs it tries to update the Makefile rules by reading all of
included Makefiles. During the perf build it checks PERF-VERSION-FILE
to get the current version number. But it triggers Makefile update so
that make runs again with the update Makefile and, in turn, users will
see duplicate CHK message on the second path.
Running make with -d option for debugging tells me this:
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `../scripts/Makefile.include' (search path) (no ~ expansion)...
Reading makefile `config/utilities.mak' (search path) (no ~ expansion)...
Reading makefile `PERF-VERSION-FILE' (search path) (don't care) (no ~ expansion)...
Reading makefile `config/feature-tests.mak' (search path) (don't care) (no ~ expansion)...
CHK -fstack-protector-all
CHK -Wstack-protector
CHK -Wvolatile-register-var
...
Updating makefiles....
Considering target file `PERF-VERSION-FILE'.
Must remake target `PERF-VERSION-FILE'.
Invoking recipe from Makefile:52 to update target `PERF-VERSION-FILE'.
Putting child 0x14037a0 (PERF-VERSION-FILE) PID 31925 on the chain.
Live child 0x14037a0 (PERF-VERSION-FILE) PID 31925
PERF_VERSION = 3.8.rc3.gf751db6
Reaping winning child 0x14037a0 PID 31925
Removing child 0x14037a0 PID 31925 from chain.
Successfully remade target file `PERF-VERSION-FILE'.
...
Re-executing[1]: make -d <------------ here
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `../scripts/Makefile.include' (search path) (no ~ expansion)...
Reading makefile `config/utilities.mak' (search path) (no ~ expansion)...
Reading makefile `PERF-VERSION-FILE' (search path) (don't care) (no ~ expansion)...
Reading makefile `config/feature-tests.mak' (search path) (don't care) (no ~ expansion)...
CHK -fstack-protector-all
CHK -Wstack-protector
CHK -Wvolatile-register-var
...
Actually PERF-VERSION-FILE is used only for perf.c to #define
PERF_VERSION macro. So make it like a C header file and include it
during compiling the perf.c file will remove the need of being
included into Makefile. Hench no need to update the Makefile and no
CHK lines anymore.
Namhyung Kim [Wed, 16 Jan 2013 11:59:54 +0000 (20:59 +0900)]
perf tools: Get rid of unused include of config.mak
These lines are came from GIT Makefile and never used for perf.
I found it from make -d output during working on previous patch.
Updating makefiles....
Considering target file `arch/x86/Makefile'.
No need to remake target `arch/x86/Makefile'.
Considering target file `config.mak'.
File `config.mak' does not exist.
Must remake target `config.mak'.
Failed to remake target file `config.mak'.
Considering target file `config.mak.autogen'.
File `config.mak.autogen' does not exist.
Must remake target `config.mak.autogen'.
Failed to remake target file `config.mak.autogen'.
Namhyung Kim [Tue, 15 Jan 2013 08:02:19 +0000 (17:02 +0900)]
tools lib traceevent: Fix warning on '>=' operator
Although the '>=' (and '<=') operator is handled properly in
libtraceevent, it emitted following spurious warnings on perf test:
$ perf test
5: parse events tests :
...
Warning: unknown op '>='
Warning: unknown op '>='
Warning: unknown op '>='
Warning: unknown op '>='
Warning: unknown op '>='
Warning: unknown op '>='
...
Add the operator to the checks.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1358236939-17393-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stephane Eranian [Mon, 14 Jan 2013 14:02:45 +0000 (15:02 +0100)]
perf tools: Mark branch_info maps as referenced
As noticed by Jiri, the hist_entry->branch_info.to/from maps need to be
marked as referenced to avoid problems later on. So we do this when the
hist_entry is allocated.
Signed-off-by: Stephane Eranian <eranian@google.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20130114140245.GA4692@quad Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Thu, 27 Dec 2012 09:11:46 +0000 (18:11 +0900)]
perf sort: Separate out branch stack specific sort keys
Current perf report gets segmentation fault when a branch stack specific
sort key is provided by --sort option to a perf.data file which contains
no branch infomation. It's because those sort keys reference branch
info of a hist entry unconditionally. Maybe we can change it checks
whether such branch info is valid or not. But if the branch stacks are
not recorded, it'd be nop. Thus it'd be better to make those keys are
unselectable.
This patch separates those keys to a different dimension array, so that
if user passes such a key to a file which has no branch stack will get
following message rather than a segfault.
Error: Invalid --sort key: `symbol_from'
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Reported-by: Stefan Beller <stefanbeller@googlemail.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1356599507-14226-10-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Thu, 27 Dec 2012 09:11:42 +0000 (18:11 +0900)]
perf sort: Calculate parent column width too
When hists__calc_col_len() called, most of column length are refreshed
but it missed parent column. So if the parent sort key was used along
with other keys rests will be misalinged since parent has no proper
column width.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1356599507-14226-6-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Thu, 27 Dec 2012 09:11:40 +0000 (18:11 +0900)]
perf sort: Fix --sort pid output
The "pid" sort key prints "Command: Pid" output but it's misaligned.
It's because of the offset of 6 was added to the column length during
the calculation in order to reserve an space for Pid part but it isn't
honored when printed. The output before this patch was like this:
Hyeoncheol Lee [Tue, 11 Sep 2012 07:57:28 +0000 (16:57 +0900)]
perf probe: Allow of casting an array of char to string
Before casting a type of a variable to string, convert_variable_type()
confirms that the type is a pointer or an array. then if it is a pointer
to char, it is casted to string. but in case of an array of char, it
isn't
Signed-off-by: H.C. Lee <hyc.lee@gmail.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Link: http://lkml.kernel.org/r/CANFS6bb75e8a_UtyAD9yF73hfXDy0N8tSjDz=a+Vna=Y8ORMHg@mail.gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Vince Weaver [Tue, 8 Jan 2013 19:44:25 +0000 (14:44 -0500)]
perf: Missing field in PERF_RECORD_SAMPLE documentation
While trying to write a perf_event/mmap test for my perf_event
test-suite I came across a missing field description in the
PERF_RECORD_SAMPLE documentation in perf_event.h
Joshua Zhu [Sat, 5 Jan 2013 05:29:57 +0000 (13:29 +0800)]
perf tools: Add anonymous huge page recognition
Judging anonymous memory's vm_area_struct, perf_mmap_event's filename
will be set to "//anon" indicating this vma belongs to anonymous
memory.
Once hugepage is used, vma's vm_file points to hugetlbfs. In this way,
this vma will not be regarded as anonymous memory by is_anon_memory() in
perf user space utility.
Signed-off-by: Joshua Zhu <zhu.wen-jie@hp.com> Cc: Akihiro Nagai <akihiro.nagai.hw@hitachi.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Joshua Zhu <zhu.wen-jie@hp.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1357363797-3550-1-git-send-email-zhu.wen-jie@hp.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Tue, 8 Jan 2013 09:39:26 +0000 (18:39 +0900)]
perf bench: Flush stdout before starting bench suite
perf bench prints header message for bench suite before starting the
benchmark. However if the stdout is redirected to a file and bench
suite forks child processes this (and possibly other debugging
messages too) will be repeated multiple times.
$ perf bench sched messaging
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
In this file, there were so many "Running sched/messaging benchmark..."
lines. This was because stdout is converted to fully-buffered due to
the redirection and inherited child processes. Other lines are printed
after reaping all those tasks.
So fix it by flushing stdout before starting bench suites.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Hitoshi Mitake <h.mitake@gmail.com> Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1357637966-8216-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Fri, 28 Dec 2012 07:16:49 +0000 (16:16 +0900)]
perf symbols: Include elf.h header regardless LIBELF_SUPPORT
The elf.h header file is used for NO_LIBELF build too so it should be
included anyway. Also remove duplicated include of the header file in
symbol-*.c. This patch fixes following build error on NO_LIBELF build:
CC tests/hists_link.o
tests/hists_link.c: In function ‘setup_fake_machine’:
tests/hists_link.c:132:8: error: ‘STB_GLOBAL’ undeclared (first use in this function)
tests/hists_link.c:132:8: note: each undeclared identifier is reported only once for each function it appears in
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1356679009-32122-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Thomas Jarosch [Tue, 25 Dec 2012 16:23:39 +0000 (17:23 +0100)]
perf tools: Fix possible (unlikely) buffer overflow
cppcheck reported:
[tools/perf/util/sysfs.c:50]: (error) Width 4096 given in format string
(no. 1) is larger than destination buffer 'sysfs_mountpoint[4096]',
use %4095s to prevent overflowing it
-> All other places in the kernel that use STR(PATH_MAX)
have a buffer size of PATH_MAX + 1.
Al Cooper [Tue, 8 Jan 2013 21:22:36 +0000 (16:22 -0500)]
perf tools: Fix GNU make v3.80 compatibility issue
According to Documentation/Changes, the kernel should be buildable with
GNU make 3.80+. tools/perf/config/utilities.mak contains the "$(or"
construct, which requires make 3.81. This causes "make" to fail on
systems with GNU make 3.80.
Replace "$(or" with an equivalent "$(if" expression, to restore backward
compatibility. Also fix an issue where _get_attempt was called with only
one argument. This prevented the error message from printing the name of
the variable that can be used to fix the problem.
Jon Stanley [Fri, 7 Sep 2012 20:32:46 +0000 (16:32 -0400)]
tools lib traceevent: Update FSF postal address to be URL's.
The FSF now prefers to use URL's in copyright headers rather than
their postal address. This change updates the address to be
<http://www.gnu.org/licenses> per http://www.gnu.org/licenses/gpl-howto.html
Namhyung Kim [Fri, 21 Dec 2012 08:20:14 +0000 (17:20 +0900)]
perf ui/gtk: Setup browser window early
The ui__error/warning functions use gtk infobar or statusbar and pr_*
functions use statusbar too. But after perf gtk context created but
those infobar and/or statusbar not yet set up, calling one of those
functions will get a segment fault.
Although current code has no problem, move these setting as early as
possible so that it can prevent the segfault from future change.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1356078018-31905-3-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Fri, 21 Dec 2012 08:20:13 +0000 (17:20 +0900)]
perf ui/gtk: Factor out common browser routines
Separate out common codes for setting up a browser, and move report/hist
browser codes into hists.c. The common codes can be used for annotation
browser.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1356078018-31905-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Jiri Olsa [Wed, 19 Dec 2012 14:33:39 +0000 (11:33 -0300)]
perf tests: Add return states enum for tests
Test can currently return one of 3 states: ok, fail, skip.
The ok and fail states are self-explanatory. The skip state means that
some of the conditions for running the test was not met, making it
impossible to even run the test. For instance, if the hardware doesn't
support the 'precise' level required by a test, it will be skipped.
Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lkml.kernel.org/n/tip-04vnsdndarctfb1eii5c9hcy@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Moved the file_name from inside a local struct var that initialized some
of its members, thus zero initializing the not explicitely initialized
variables, one of which was 'file_name', to a standalone local variable,
but forgot to initialize it explicitely to NULL, so it then got some
undefined value, causing a segfault in strdup when it wasn't, by luck,
zero.
Fix it by explicitely initializing it to NULL.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Link: http://lkml.kernel.org/n/tip-qo2jevp1bdcnh8khzdazs17s@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
That consolidates the grouping of host + guests, isolating a bit more of
functionality now centered on 'perf_session' that can be used
independently in tools that don't need a 'perf_session' instance, but
needs to have all the thread/map/symbol machinery.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-c700rsiphpmzv8klogojpfut@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf session: There is no need for a per session hists instance
It was being used just for its stats member, so ditch session->hists and
use just what is needed, session->stats.
This completes the move support multiple events in the hists layer, the
last user of session->hists was 'perf diff' but Jiri Olsa has fixed that
some time ago.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-pimk92kek8kcp4dmb1jakoro@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf record: Don't pass host machine to guest synthesizer
We were calling perf_session__process_machines(), that would first pass
the struct machine associated with the host to the provided callback,
perf_event__synthesize_guest_os() that would test if it was the host and
if so wouldn't do anything.
Ditch this contraption, just call directly machines__process with the
list of guests.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-x65vsxgzg4dvo3zqohtrrb9o@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Mon, 17 Dec 2012 07:25:01 +0000 (16:25 +0900)]
perf tests: Check python path on attr and binding test
Current perf test code tries to execute python version 2 in order to
test attributes on perf_event_open syscall. However it's not default
python version anymore a system can have python v3 only or v2 with a
different name (e.g. python2). So if there's no such python interpreter
with the name 'python', the test would fail like this (yes, it's
happened on my new archlinux laptop :).
13: struct perf_event_attr setup :sh: python: command not found
FAILED!
As we can pass name of the python interpreter on make, use it for
the attr test also.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1355729101-31317-1-git-send-email-namhyung@kernel.org
[ committer note: Added the same mechanism to the python binding test ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Jiri Olsa [Mon, 17 Dec 2012 13:08:38 +0000 (14:08 +0100)]
perf tests: Add event parsing test for '*:*' tracepoints
Adding event parsing test for '*:*' tracepoints. Checking the count
matches all the tracepoints available plus current standard tracepoint
perf_event_attr check.
This test exposes warnings from traceevent lib about not being able to
parse some tracepoints' format data. Exposing these messages in the
automated test suite will probably speed up the fix ;-)
Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1355749718-4355-4-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf python: Fix breakage introduced by the test_attr infrastructure
The test_attr infrastructure hooks on the sys_perf_event_open call,
checking if a variable is set and if so calling a function to intercept
calls and do the checking.
But both the variable and the function aren't on objects that are
linked on the python binding, breaking it:
# perf test -v 15
15: Try 'use perf' in python, checking link problems :
--- start ---
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/acme/git/build/perf//python/perf.so: undefined symbol: test_attr__enabled
---- end ----
Try 'use perf' in python, checking link problems: FAILED!
#
Fix it by moving the variable to one of the linked object files and
providing a stub for the function in the python.o object, that is only
linked in the python binding.
Now 'perf test' is happy again:
# perf test 15
15: Try 'use perf' in python, checking link problems : Ok
#
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-0rsca2kn44b38rgdpr3tz6n5@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf test: Check for linking problems in the python binding
It just will add the O= builddir to PYTHONPATH and try to 'use perf',
which will, in verbose mode show the python backtrace with the missing
symbols, such as in the problem fixed in the patch after this one:
# perf test -v 15
15: Try 'use perf' in python, checking link problems :
--- start ---
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/acme/git/build/perf//python/perf.so: undefined symbol: test_attr__enabled
---- end ----
Try 'use perf' in python, checking link problems: FAILED!
#
Loooong overdue, done.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-zmd2oq9gz6t1u145ub7qm2nv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
That consolidates the error messages in 'record', 'stat' and 'top', that
now get a consistent set of messages and allow other tools to use the
new method to report problems using whatever UI toolkit.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-1cudb7wl996kz7ilz83ctvhr@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tests: Adjust some message log levels to help diagnosing problems in attr tests
Now we'll see the command being run and if it fails, the fields that had
unexpected values and the expected values, example testing a problem in the
next patch:
# perf test -v 13
13: struct perf_event_attr setup :
--- start ---
SNIP
running 'PERF_TEST_ATTR=/tmp/tmpDNIE6M /home/acme/bin/perf record -o /tmp/tmpDNIE6M/perf.data --group -e cycles,instructions kill >/dev/null 2>&1' ret 0
running 'PERF_TEST_ATTR=/tmp/tmpV5lKro /home/acme/bin/perf stat -o /tmp/tmpV5lKro/perf.data -dd kill >/dev/null 2>&1' ret 1
expected config=3, got 65540
expected exclude_guest=1, got 0
FAILED '/home/acme/libexec/perf-core/tests/attr/test-stat-detailed-2' - match failure
---- end ----
struct perf_event_attr setup: FAILED!
#
While in the past we would see at the '-v' level many more messages for the
fields that matched, something we may want to see only in the '-vv' log level.
Keeping the 'running' messages so that we can see the tools tests that
succeeded so that we can compare it to the one that failed, helping pinpointing
the command line switch combo that leads to the problem.
Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-9avmwxv5ipxyafwqxbk52ylg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Mon, 10 Dec 2012 08:29:57 +0000 (17:29 +0900)]
perf test: Add a test case for hists__{match,link}
As they are used from diff and event group report, add a test case to
verify their behaviors.
In this test I made a fake machine and two evsel. Each evsel got 10
samples (so hist entries) - 5 are common and the rests are not. So
after hists__match() both of them will have 5 entries with pair set.
And the second evsel has a collapsed entry so that the total number is 9
- I made it in order to simulate more realistic case. Thus after
hists__link the first entry will have 14 entries - 5 are common (w/
pair), 5 are unmatch (w/o pair) and 4 are dummy (w/ pair). And the
second entry will have 9 entries all have its pair.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1355128197-18193-5-git-send-email-namhyung@kernel.org
[ committer note: fixed up clashes with cset that moved methods to machine.h ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Mon, 10 Dec 2012 08:29:55 +0000 (17:29 +0900)]
perf hists: Link hist entries before inserting to an output tree
For matching and/or linking hist entries, they need to be sorted by
given sort keys. However current hists__match/link did this on the
output trees, so that the entries in the output tree need to be resort
before doing it.
This looks not so good since we have trees for collecting or collapsing
entries before passing them to an output tree and they're already sorted
by the given sort keys. Since we don't need to print anything at the
time of matching/linking, we can use these internal trees directly
instead of bothering with double resort on the output tree.
Its only user - at the time of this writing - perf diff can be easily
converted to use the internal tree and can save some lines too by
getting rid of unnecessary resorting codes.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1355128197-18193-3-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Namhyung Kim [Mon, 10 Dec 2012 08:29:54 +0000 (17:29 +0900)]
perf hists: Exchange order of comparing items when collapsing hists
When comparing entries for collapsing put the given entry first, and
then the iterated entry. This is not the case of hist_entry__cmp() when
called if given sort keys don't require collapsing. So change the order
for the sake of consistency. It will be required for matching and/or
linking multiple hist entries.
Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1355128197-18193-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Ingo Molnar [Thu, 24 Jan 2013 15:30:45 +0000 (16:30 +0100)]
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
. perf build-id cache now can show DSOs present in a perf.data file that are
not in the cache, to integrate with build-id servers being put in place by
organizations such as Fedora.
. perf buildid-list -i an-elf-file-instead-of-a-perf.data is back showing its
build-id.
. No need to do feature checks when doing a 'make tags'
. Fix some 'perf test' errors and make them use the tracepoint evsel constructor.
. perf top now shares more of the evsel config/creation routines with 'record',
paving the way for further integration like 'top' snapshots, etc.
. perf top now supports DWARF callchains.
. perf evlist decodes sample_type and read_format, helping diagnose problems.
. Fix mmap limitations on 32-bit, fix from David Miller.
. perf diff fixes from Jiri Olsa.
. Ignore ABS symbols when loading data maps, fix from Namhyung Kim
. Hists improvements from Namhyung Kim
. Don't check configuration on make clean, from Namhyung Kim
. Fix dso__fprintf() print statement, from Stephane Eranian.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
The last remaining user was oprofile and its use has been
removed a while ago in commit bc078e4eab65f11bba
("oprofile: convert oprofile from timer_hook to hrtimer").
There doesn't seem to be any upstream user of this hook
for about two years now. And I'm not even aware of any out of
tree user.
Let's remove it.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Alessio Igor Bogani <abogani@kernel.org> Cc: Avi Kivity <avi@redhat.com> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Christoph Lameter <cl@linux.com> Cc: Geoff Levand <geoff@infradead.org> Cc: Gilad Ben Yossef <gilad@benyossef.com> Cc: Hakan Akkan <hakanakkan@gmail.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1356191991-2251-1-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Steven Rostedt [Thu, 24 Jan 2013 12:52:34 +0000 (07:52 -0500)]
tracing: Fix unsigned int compare of zero in recursion check
Dan's smatch found a compare bug with the result of the
trace_test_and_set_recursion() and comparing to less than
zero. If the function fails, it returns -1, but was saved in
an unsigned int, which will never be less than zero and will
ignore the result of the test if a recursion did happen.
Luckily this is the last of the recursion tests, as the
infrastructure of ftrace would catch recursions before it
got here, except for some few exceptions.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Linus Torvalds [Thu, 24 Jan 2013 04:11:35 +0000 (20:11 -0800)]
Merge tag 'usb-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull more USB fixes from Greg Kroah-Hartman:
"Here are some more USB fixes for the 3.8-rc4 tree.
Some gadget driver fixes, and finally resolved the ehci-mxc driver
build issues (it's just some code moving around and being deleted)."
* tag 'usb-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: EHCI: fix build error in ehci-mxc
USB: EHCI: add a name for the platform-private field
USB: EHCI: fix incorrect configuration test
USB: EHCI: Move definition of EHCI_STATS to ehci.h
USB: UHCI: fix IRQ race during initialization
usb: gadget: FunctionFS: Fix missing braces in parse_opts
usb: dwc3: gadget: fix ep->maxburst for ep0
ARM: i.MX clock: Change the connection-id for fsl-usb2-udc
usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
usb: gadget: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id
usb: musb: cppi_dma: drop '__init' annotation
Linus Torvalds [Thu, 24 Jan 2013 04:10:48 +0000 (20:10 -0800)]
Merge tag 'char-misc-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull drivers/misc fix from Greg Kroah-Hartman:
"Here is a single revert for the ti-st misc driver, fixing problem that
was introduced in 3.7-rc1 that has been bothering people."
* tag 'char-misc-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
Revert "drivers/misc/ti-st: remove gpio handling"
Linus Torvalds [Thu, 24 Jan 2013 04:09:58 +0000 (20:09 -0800)]
Merge tag 'tty-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull a TTY maintainer patch from Greg Kroah-Hartman:
"Just a MAINTAINERS update, now that Alan has left for a bit, I'll
continue to watch over the serial drivers."
* tag 'tty-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
MAINTAINERS: Someone needs to watch over the serial drivers
Linus Torvalds [Thu, 24 Jan 2013 04:07:12 +0000 (20:07 -0800)]
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab:
- gspca: add needed delay for I2C traffic for sonixb/sonixj cameras
- gspca: add one missing Kinect USB ID
- usbvideo: some regression fixes
- omap3isp: fix some build issues
- videobuf2: fix video output handling
- exynos s5p/m5mols: a few regression fixes.
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
[media] uvcvideo: Cleanup leftovers of partial revert
[media] uvcvideo: Return -EACCES when trying to set a read-only control
[media] omap3isp: Don't include <plat/cpu.h>
[media] s5p-mfc: Fix interrupt error handling routine
[media] s5p-fimc: Fix return value of __fimc_md_create_flite_source_links()
[media] m5mols: Fix typo in get_fmt callback
[media] v4l: vb2: Set data_offset to 0 for single-plane output buffers
[media] [FOR,v3.8] omap3isp: Don't include deleted OMAP plat/ header files
[media] gspca_sonixj: Add a small delay after i2c_w1
[media] gspca_sonixb: Properly wait between i2c writes
[media] gspca_kinect: add Kinect for Windows USB id
Linus Torvalds [Wed, 23 Jan 2013 21:31:15 +0000 (13:31 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k fixes from Geert Uytterhoeven:
"The asm-generic changeset has been ack'ed by Arnd."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
m68k: Wire up finit_module
asm-generic/dma-mapping-broken.h: Provide dma_alloc_attrs()/dma_free_attrs()
m68k: Provide dma_alloc_attrs()/dma_free_attrs()
Linus Torvalds [Wed, 23 Jan 2013 21:28:17 +0000 (13:28 -0800)]
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64
Pull arm64 fixes from Catalin Marinas:
- ELF coredump fix (more registers dumped than what user space expects)
- SUBARCH name generation (s/aarch64/arm64/)
* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64:
arm64: makefile: fix uname munging when setting ARCH on native machine
arm64: elf: fix core dumping to match what glibc expects
Alan Stern [Wed, 23 Jan 2013 18:26:15 +0000 (13:26 -0500)]
USB: EHCI: fix build error in ehci-mxc
This patch (as1643b) fixes a build error in ehci-hcd when compiling for
ARM with allmodconfig:
drivers/usb/host/ehci-hcd.c:1285:0: warning: "PLATFORM_DRIVER" redefined [enabled by default]
drivers/usb/host/ehci-hcd.c:1255:0: note: this is the location of the previous definition
drivers/usb/host/ehci-mxc.c:280:31: warning: 'ehci_mxc_driver' defined but not used [-Wunused-variable]
drivers/usb/host/ehci-hcd.c:1285:0: warning: "PLATFORM_DRIVER" redefined [enabled by default]
drivers/usb/host/ehci-hcd.c:1255:0: note: this is the location of the previous definition
The fix is to convert ehci-mxc over to the new "ehci-hcd is a library"
scheme so that it can coexist peacefully with the ehci-platform
driver. As part of the conversion the ehci_mxc_priv data structure,
which was allocated dynamically, is now placed where it belongs: in
the private area at the end of struct ehci_hcd.
Linus Torvalds [Wed, 23 Jan 2013 17:42:46 +0000 (09:42 -0800)]
Merge tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"Only a few small HD-audio fixes:
- Addition of new Conexant codec IDs
- Two one-liners to add fixups for Realtek codecs
- A last-minute regression fix for auto-mute with power-saving mode
(regressed since 3.8-rc1)"
* tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: hda - Fix inconsistent pin states after resume
ALSA: hda - Add Conexant CX20755/20756/20757 codec IDs
ALSA: hda - Add fixup for Acer AO725 laptop
ALSA: hda - Fix mute led for another HP machine
Takashi Iwai [Wed, 23 Jan 2013 14:58:40 +0000 (15:58 +0100)]
ALSA: hda - Fix inconsistent pin states after resume
The commit [26a6cb6c: ALSA: hda - Implement a poll loop for jacks as a
module parameter] introduced the polling jack detection code, but it
also moved the call of snd_hda_jack_set_dirty_all() in the resume path
after resume/init ops call. This caused a regression when the jack
state has been changed during power-down (e.g. in the power save
mode). Since the driver doesn't probe the new jack state but keeps
using the cached value due to no dirty flag, the pin state remains
also as if the jack is still plugged.
The fix is simply moving snd_hda_jack_set_dirty_all() to the original
position.
Steven Rostedt [Tue, 22 Jan 2013 21:58:30 +0000 (16:58 -0500)]
ring-buffer: Remove trace.h from ring_buffer.c
ring_buffer.c use to require declarations from trace.h, but
these have moved to the generic header files. There's nothing
in trace.h that ring_buffer.c requires.
There's some headers that trace.h included that ring_buffer.c
needs, but it's best that it includes them directly, and not
include trace.h.
Also, some things may use ring_buffer.c without having tracing
configured. This removes the dependency that may come in the
future.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Fri, 2 Nov 2012 21:52:35 +0000 (17:52 -0400)]
ftrace: Use only the preempt version of function tracing
The function tracer had two different versions of function tracing.
The disabling of irqs version and the preempt disable version.
As function tracing in very intrusive and can cause nasty recursion
issues, it has its own recursion protection. But the old method to
do this was a flat layer. If it detected that a recursion was happening
then it would just return without recording.
This made the preempt version (much faster than the irq disabling one)
not very useful, because if an interrupt were to occur after the
recursion flag was set, the interrupt would not be traced at all,
because every function that was traced would think it recursed on
itself (due to the context it preempted setting the recursive flag).
Now that we have a recursion flag for every context level, we
no longer need to worry about that. We can disable preemption,
set the current context recursion check bit, and go on. If an
interrupt were to come along, it would check its own context bit
and happily continue to trace.
As the preempt version is faster than the irq disable version,
there's no more reason to keep the preempt version around.
And the irq disable version still had an issue with missing
out on tracing NMI code.
Remove the irq disable function tracer version and have the
preempt disable version be the default (and only version).
Before this patch we had from running:
# echo function > /debug/tracing/current_tracer
# for i in `seq 10`; do ./hackbench 50; done
Time: 12.028
Time: 11.945
Time: 11.925
Time: 11.964
Time: 12.002
Time: 11.910
Time: 11.944
Time: 11.929
Time: 11.941
Time: 11.924
(average: 11.9512)
Now we have:
# echo function > /debug/tracing/current_tracer
# for i in `seq 10`; do ./hackbench 50; done
Time: 10.285
Time: 10.407
Time: 10.243
Time: 10.372
Time: 10.380
Time: 10.198
Time: 10.272
Time: 10.354
Time: 10.248
Time: 10.253
(average: 10.3012)
a 13.8% savings!
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
When function tracing occurs, the following steps are made:
If arch does not support a ftrace feature:
call internal function (uses INTERNAL bits) which calls...
If callback is registered to the "global" list, the list
function is called and recursion checks the GLOBAL bits.
then this function calls...
The function callback, which can use the FTRACE bits to
check for recursion.
Now if the arch does not suppport a feature, and it calls
the global list function which calls the ftrace callback
all three of these steps will do a recursion protection.
There's no reason to do one if the previous caller already
did. The recursion that we are protecting against will
go through the same steps again.
To prevent the multiple recursion checks, if a recursion
bit is set that is higher than the MAX bit of the current
check, then we know that the check was made by the previous
caller, and we can skip the current check.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Fri, 2 Nov 2012 21:17:59 +0000 (17:17 -0400)]
ftrace: Add context level recursion bit checking
Currently for recursion checking in the function tracer, ftrace
tests a task_struct bit to determine if the function tracer had
recursed or not. If it has, then it will will return without going
further.
But this leads to races. If an interrupt came in after the bit
was set, the functions being traced would see that bit set and
think that the function tracer recursed on itself, and would return.
Instead add a bit for each context (normal, softirq, irq and nmi).
A check of which context the task is in is made before testing the
associated bit. Now if an interrupt preempts the function tracer
after the previous context has been set, the interrupt functions
can still be traced.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Fri, 2 Nov 2012 21:03:03 +0000 (17:03 -0400)]
ftrace: Optimize the function tracer list loop
There is lots of places that perform:
op = rcu_dereference_raw(ftrace_control_list);
while (op != &ftrace_list_end) {
Add a helper macro to do this, and also optimize for a single
entity. That is, gcc will optimize a loop for either no iterations
or more than one iteration. But usually only a single callback
is registered to the function tracer, thus the optimized case
should be a single pass. to do this we now do:
op = rcu_dereference_raw(list);
do {
[...]
} while (likely(op = rcu_dereference_raw((op)->next)) &&
unlikely((op) != &ftrace_list_end));
An op is always registered (ftrace_list_end when no callbacks is
registered), thus when a single callback is registered, the link
list looks like:
top => callback => ftrace_list_end => NULL.
The likely(op = op->next) still must be performed due to the race
of removing the callback, where the first op assignment could
equal ftrace_list_end. In that case, the op->next would be NULL.
But this is unlikely (only happens in a race condition when
removing the callback).
But it is very likely that the next op would be ftrace_list_end,
unless more than one callback has been registered. This tells
gcc what the most common case is and makes the fast path with
the least amount of branches.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Fri, 2 Nov 2012 21:01:20 +0000 (17:01 -0400)]
ftrace: Fix function tracing recursion self test
The function tracing recursion self test should not crash
the machine if the resursion test fails. If it detects that
the function tracing is recursing when it should not be, then
bail, don't go into an infinite recursive loop.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Fri, 2 Nov 2012 20:58:56 +0000 (16:58 -0400)]
ftrace: Fix global function tracers that are not recursion safe
If one of the function tracers set by the global ops is not recursion
safe, it can still be called directly without the added recursion
supplied by the ftrace infrastructure.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Wed, 23 Jan 2013 04:35:11 +0000 (23:35 -0500)]
tracing: Fix selftest function recursion accounting
The test that checks function recursion does things differently
if the arch does not support all ftrace features. But that really
doesn't make a difference with how the test runs, and either way
the count variable should be 2 at the end.
Currently the test wrongly fails for archs that don't support all
the ftrace features.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt [Tue, 22 Jan 2013 18:35:11 +0000 (13:35 -0500)]
tracing: Fix race with max_tr and changing tracers
There's a race condition between the setting of a new tracer and
the update of the max trace buffers (the swap). When a new tracer
is added, it sets current_trace to nop_trace before disabling
the old tracer. At this moment, if the old tracer uses update_max_tr(),
the update may trigger the warning against !current_trace->use_max-tr,
as nop_trace doesn't have that set.
As update_max_tr() requires that interrupts be disabled, we can
add a check to see if current_trace == nop_trace and bail if it
does. Then when disabling the current_trace, set it to nop_trace
and run synchronize_sched(). This will make sure all calls to
update_max_tr() have completed (it was called with interrupts disabled).
As a clean up, this commit also removes shrinking and recreating
the max_tr buffer if the old and new tracers both have use_max_tr set.
The old way use to always shrink the buffer, and then expand it
for the next tracer. This is a waste of time.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
The reason is that it broke TI WiLink shared transport on Panda.
Also, callback functions should not be added to board files anymore,
so revert to implementing the power functions in the driver itself.
Additionally, changed a variable name ('status' to 'err') so that this
revert compiles properly.
Linus Torvalds [Wed, 23 Jan 2013 00:36:23 +0000 (16:36 -0800)]
Merge tag '3.8-pci-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas:
"The most important is a fix for a pciehp deadlock that occurs when
unplugging a Thunderbolt adapter. We also applied the same fix to
shpchp, removed CONFIG_EXPERIMENTAL dependencies, fixed a
pcie_aspm=force problem, and fixed a refcount leak.
Details:
- Hotplug
PCI: pciehp: Use per-slot workqueues to avoid deadlock
PCI: shpchp: Make shpchp_wq non-ordered
PCI: shpchp: Handle push button event asynchronously
PCI: shpchp: Use per-slot workqueues to avoid deadlock
- Power management
PCI: Allow pcie_aspm=force even when FADT indicates it is unsupported
* tag '3.8-pci-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
PCI: remove depends on CONFIG_EXPERIMENTAL
PCI: Allow pcie_aspm=force even when FADT indicates it is unsupported
PCI: shpchp: Use per-slot workqueues to avoid deadlock
PCI: shpchp: Handle push button event asynchronously
PCI: shpchp: Make shpchp_wq non-ordered
PCI/AER: pci_get_domain_bus_and_slot() call missing required pci_dev_put()
PCI: pciehp: Use per-slot workqueues to avoid deadlock
Tejun Heo [Wed, 23 Jan 2013 00:15:15 +0000 (16:15 -0800)]
async: fix __lowest_in_progress()
Commit 083b804c4d3e ("async: use workqueue for worker pool") made it
possible that async jobs are moved from pending to running out-of-order.
While pending async jobs will be queued and dispatched for execution in
the same order, nothing guarantees they'll enter "1) move self to the
running queue" of async_run_entry_fn() in the same order.
Before the conversion, async implemented its own worker pool. An async
worker, upon being woken up, fetches the first item from the pending
list, which kept the executing lists sorted. The conversion to
workqueue was done by adding work_struct to each async_entry and async
just schedules the work item. The queueing and dispatching of such work
items are still in order but now each worker thread is associated with a
specific async_entry and moves that specific async_entry to the
executing list. So, depending on which worker reaches that point
earlier, which is non-deterministic, we may end up moving an async_entry
with larger cookie before one with smaller one.
This broke __lowest_in_progress(). running->domain may not be properly
sorted and is not guaranteed to contain lower cookies than pending list
when not empty. Fix it by ensuring sort-inserting to the running list
and always looking at both pending and running when trying to determine
the lowest cookie.
Over time, the async synchronization implementation became quite messy.
We better restructure it such that each async_entry is linked to two
lists - one global and one per domain - and not move it when execution
starts. There's no reason to distinguish pending and running. They
behave the same for synchronization purposes.
Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Tue, 22 Jan 2013 22:32:07 +0000 (14:32 -0800)]
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
. revert 20b279 - require exclude_guest to use PEBS - kernel side, now
older binaries will continue working for things like cycles:pp
without needing to pass extra modifiers, from David Ahern.
. Fix building from 'make perf-*-src-pkg' tarballs, broken by UAPI,
from Sebastian Andrzej Siewior
[ Pulling directly, Ingo would normally pull but has been unresponsive ]
* tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
perf tools: Fix building from 'make perf-*-src-pkg' tarballs
perf x86: revert 20b279 - require exclude_guest to use PEBS - kernel side
Linus Torvalds [Tue, 22 Jan 2013 22:30:35 +0000 (14:30 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes from Helge Deller:
"Improve the stability of the linux kernel on the parisc architecture"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: sigaltstack doesn't round ss.ss_sp as required
parisc: improve ptrace support for gdb single-step
parisc: don't claim cpu irqs more than once
parisc: avoid undefined shift in cnv_float.h
Linus Torvalds [Tue, 22 Jan 2013 19:53:19 +0000 (11:53 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse fixes from Miklos Szeredi:
"This contain a bugfix for CUSE and miscellaneous small fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
fuse: remove unused variable in fuse_try_move_page()
fuse: make fuse_file_fallocate() static
fuse: Move CUSE Kconfig entry from fs/Kconfig into fs/fuse/Kconfig
cuse: fix uninitialized variable warnings
cuse: do not register multiple devices with identical names
cuse: use mutex as registration lock instead of spinlocks
Linus Torvalds [Tue, 22 Jan 2013 19:52:23 +0000 (11:52 -0800)]
Merge tag 'fixes-for-v3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij:
"Here are some GPIO fixes I stacked up in my GPIO tree:
- Remove a bad #include from the Samsung driver
- Some Kconfig hazzle for the Samsungs
- Skip gpiolib registration on EXYNOS5440
- Don't free the MVEBU label"
* tag 'fixes-for-v3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio: mvebu: Don't free chip label memory
gpio: samsung: skip gpio lib registration for EXYNOS5440
gpio: samsung: silent build warning for EXYNOS5 SoCs
gpio: samsung: fix pinctrl condition for exynos and exynos5440
gpio: samsung: remove inclusion <mach/regs-clock.h>
Linus Torvalds [Tue, 22 Jan 2013 18:33:17 +0000 (10:33 -0800)]
Merge tag 'f2fs-for-3.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs fixes from Jaegeuk Kim:
o Support swap file and link generic_file_remap_pages
o Enhance the bio streaming flow and free section control
o Major bug fix on recovery routine
o Minor bug/warning fixes and code cleanups
* tag 'f2fs-for-3.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (22 commits)
f2fs: use _safe() version of list_for_each
f2fs: add comments of start_bidx_of_node
f2fs: avoid issuing small bios due to several dirty node pages
f2fs: support swapfile
f2fs: add remap_pages as generic_file_remap_pages
f2fs: add __init to functions in init_f2fs_fs
f2fs: fix the debugfs entry creation path
f2fs: add global mutex_lock to protect f2fs_stat_list
f2fs: remove the blk_plug usage in f2fs_write_data_pages
f2fs: avoid redundant time update for parent directory in f2fs_delete_entry
f2fs: remove redundant call to set_blocksize in f2fs_fill_super
f2fs: move f2fs_balance_fs to punch_hole
f2fs: add f2fs_balance_fs in several interfaces
f2fs: revisit the f2fs_gc flow
f2fs: check return value during recovery
f2fs: avoid null dereference in f2fs_acl_from_disk
f2fs: initialize newly allocated dnode structure
f2fs: update f2fs partition info about SIT/NAT layout
f2fs: update f2fs document to reflect SIT/NAT layout correctly
f2fs: remove unneeded INIT_LIST_HEAD at few places
...
Linus Torvalds [Tue, 22 Jan 2013 18:30:49 +0000 (10:30 -0800)]
Merge tag 'trace-3.8-rc4-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull ftrace fix from Steven Rostedt:
"Kprobes now uses the function tracer if it can. That is, if a probe
is placed on a function mcount/nop location, and the arch supports it,
instead of adding a breakpoint, kprobes will register a function
callback as that is much more efficient.
The function tracer requires to update modules before they run, and
uses the module notifier to do so. But if something else in the
module notifiers registers a kprobe at one of these locations, before
ftrace can get to it, then the system could fail.
The function tracer must be initialized early, otherwise module
notifiers that probe will only work by chance."
* tag 'trace-3.8-rc4-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
ftrace: Be first to run code modification on modules
Linus Torvalds [Tue, 22 Jan 2013 18:10:34 +0000 (10:10 -0800)]
Merge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
Pull libata fixes from Jeff Garzik:
1) ahci: Fix typo that caused erronenous error handling.
Thought: I wonder if sparse could have caught this, somehow.
2) ahci: support a slightly odd Enmotus variant
3) core: fix a drive detection problem by correcting the logic by which
the DevSlp timing variables are obtained and used.
* tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
[libata] replace sata_settings with devslp_timing
[libata] ahci: Add support for Enmotus Bobcat device.
[libata] ahci: Fix lack of command retry after a success error handler.
Linus Torvalds [Tue, 22 Jan 2013 18:10:10 +0000 (10:10 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem bugfixes from James Morris.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
security/device_cgroup: lock assert fails in dev_exception_clean()
evm: checking if removexattr is not a NULL