pandora-kernel.git
11 years agoperf script: use ARRAY_SIZE instead of reinventing it
Sasha Levin [Thu, 20 Dec 2012 19:11:19 +0000 (14:11 -0500)]
perf script: use ARRAY_SIZE instead of reinventing it

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1356030701-16284-11-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf kmem: use ARRAY_SIZE instead of reinventing it
Sasha Levin [Thu, 20 Dec 2012 19:11:16 +0000 (14:11 -0500)]
perf kmem: use ARRAY_SIZE instead of reinventing it

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1356030701-16284-8-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tools: remove redundant checks from _sort__sym_cmp
Sasha Levin [Thu, 20 Dec 2012 19:11:20 +0000 (14:11 -0500)]
perf tools: remove redundant checks from _sort__sym_cmp

We already check that sym_l and sum_r are non-NULLs, no need to do it
twice.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
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/1356030701-16284-12-git-send-email-sasha.levin@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tests: Don't fail if a matching vmlinux isn't found, skip that test
Arnaldo Carvalho de Melo [Wed, 19 Dec 2012 14:11:59 +0000 (11:11 -0300)]
perf tests: Don't fail if a matching vmlinux isn't found, skip that test

Now that Jiri introduced TEST_SKIP, don't fail on the first test, just
skip it.

Requested-by: Ingo Molnar <mingo@kernel.org>
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-wtgs8rd7fjwfhx72pv4la127@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tests: Add return states enum for tests
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>
11 years agoperf kvm: Initialize file_name var to fix segfault
Arnaldo Carvalho de Melo [Wed, 19 Dec 2012 13:59:29 +0000 (10:59 -0300)]
perf kvm: Initialize file_name var to fix segfault

The 3786063 commit:

    perf kvm: Rename perf_kvm to perf_kvm_stat

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>
11 years agoperf machine: Simplify accessing the host machine
Arnaldo Carvalho de Melo [Wed, 19 Dec 2012 12:04:24 +0000 (09:04 -0300)]
perf machine: Simplify accessing the host machine

It is always there, no sense in calling a function named
"perf_session__find_host_machine".

Also no sense in checking if that function return is NULL, so ditch
needless error handling.

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-a6a3zx3afbrxo8p2zqm5mxo8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tests: Fix PYTHONPATH for python-use test tracepoints
Jiri Olsa [Wed, 19 Dec 2012 08:52:21 +0000 (09:52 +0100)]
perf tests: Fix PYTHONPATH for python-use test tracepoints

If there's not OUTPUT variable defined the PYTHONPATH ends up with
/python. We need to remove the extra '/'.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-h1hzfyfcdxjnuq9fin2cjwlr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf machine: Introduce struct machines
Arnaldo Carvalho de Melo [Tue, 18 Dec 2012 22:15:48 +0000 (19:15 -0300)]
perf machine: Introduce struct machines

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>
11 years agoperf session: There is no need for a per session hists instance
Arnaldo Carvalho de Melo [Tue, 18 Dec 2012 19:24:46 +0000 (16:24 -0300)]
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>
11 years agoperf hists: Rename hists__fprintf_nr_events to events_stats__fprintf
Arnaldo Carvalho de Melo [Tue, 18 Dec 2012 19:02:17 +0000 (16:02 -0300)]
perf hists: Rename hists__fprintf_nr_events to events_stats__fprintf

As this function deals exclusively with hists->stats.

Preparatory patch for removing the by now needless session->hists, that
should be just session->stats.

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-be0o8si9f1z40cwoa534f7me@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf record: Don't pass host machine to guest synthesizer
Arnaldo Carvalho de Melo [Tue, 18 Dec 2012 18:49:27 +0000 (15:49 -0300)]
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>
11 years agoperf header: Ensure read/write finished successfully
Namhyung Kim [Mon, 17 Dec 2012 06:38:54 +0000 (15:38 +0900)]
perf header: Ensure read/write finished successfully

Use readn instead of read and check return value of do_write.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Suggested-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
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/1355726345-29553-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tests: Check python path on attr and binding test
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>
11 years agoperf tests: Add event parsing test for '*:*' tracepoints
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>
11 years agoperf tools: Add support for wildcard in tracepoint system name
Jiri Olsa [Mon, 17 Dec 2012 13:08:37 +0000 (14:08 +0100)]
perf tools: Add support for wildcard in tracepoint system name

Adding support for wildcards '*?" in the tracepoint system part.

It's now possible to open all available tracepoints like:

  # perf stat -e '*:*' ls

You might need to increase limit for open files via ulimit.

If ftrace events tracepoints are configured in, the record command fails
on above event selection because of them.

The stat command disables counters that fails to open, the record
command fails completely. We probably want to be smarter here.

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-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tools: Add missing closedir in multi tracepoint processing
Jiri Olsa [Mon, 17 Dec 2012 13:08:36 +0000 (14:08 +0100)]
perf tools: Add missing closedir in multi tracepoint processing

We don't close 'events' directory when reading multiple tracepoint
events. Adding missing closedir.

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-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf python: Fix breakage introduced by the test_attr infrastructure
Arnaldo Carvalho de Melo [Thu, 13 Dec 2012 19:43:04 +0000 (16:43 -0300)]
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>
11 years agoperf test: Check for linking problems in the python binding
Arnaldo Carvalho de Melo [Fri, 14 Dec 2012 16:06:13 +0000 (13:06 -0300)]
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>
11 years agoperf evsel: Introduce perf_evsel__open_strerror method
Arnaldo Carvalho de Melo [Thu, 13 Dec 2012 18:10:58 +0000 (15:10 -0300)]
perf evsel: Introduce perf_evsel__open_strerror method

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>
11 years agoperf evsel: Introduce event fallback method
Arnaldo Carvalho de Melo [Thu, 13 Dec 2012 17:16:30 +0000 (14:16 -0300)]
perf evsel: Introduce event fallback method

The only fallback right now is for HW cpu-cycles -> SW cpu-clock, that
was done in the same way in both 'top' and 'record'.

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-58l1mgibh9oa9m0pd3fasxa5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf evsel: Do missing feature fallbacks in just one place
Arnaldo Carvalho de Melo [Thu, 13 Dec 2012 16:13:07 +0000 (13:13 -0300)]
perf evsel: Do missing feature fallbacks in just one place

Instead of doing it in stat, top, record or any other tool that opens
event descriptors.

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-vr8hzph83d5t2mdlkf565h84@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf tests: Adjust some message log levels to help diagnosing problems in attr tests
Arnaldo Carvalho de Melo [Tue, 18 Dec 2012 17:14:24 +0000 (14:14 -0300)]
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>
11 years agoperf test: Remove leftover temp file left by one of the attr tests
Arnaldo Carvalho de Melo [Wed, 12 Dec 2012 16:27:03 +0000 (13:27 -0300)]
perf test: Remove leftover temp file left by one of the attr tests

Instead of > /tmp/krava, direct it to /dev/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>
Link: http://lkml.kernel.org/n/tip-oo4yhij2327u8ircz4d0y5p4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf test: Add a test case for hists__{match,link}
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>
11 years agoperf diff: Use internal rb tree for compute resort
Namhyung Kim [Mon, 10 Dec 2012 08:29:56 +0000 (17:29 +0900)]
perf diff: Use internal rb tree for compute resort

There's no reason to run hists_compute_resort() using output tree.
Convert it to use internal tree so that it can remove unnecessary
_output_resort.

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-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
11 years agoperf hists: Link hist entries before inserting to an output tree
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>
11 years agoperf hists: Exchange order of comparing items when collapsing hists
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>
11 years agoMerge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git...
Ingo Molnar [Thu, 24 Jan 2013 15:30:45 +0000 (16:30 +0100)]
Merge tag 'perf-core-for-mingo' of git://git./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>
11 years agoprofiling: Remove unused timer hook
Frederic Weisbecker [Sat, 22 Dec 2012 15:59:51 +0000 (16:59 +0100)]
profiling: Remove unused timer hook

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>
11 years agoMerge tag 'please-pull-aer-trace' of git://git.kernel.org/pub/scm/linux/kernel/git...
Ingo Molnar [Thu, 24 Jan 2013 13:49:10 +0000 (14:49 +0100)]
Merge tag 'please-pull-aer-trace' of git://git./linux/kernel/git/ras/ras into perf/core

Use perf/event tracing to report PCI Express advanced errors, by
Tony Luck.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
11 years agoMerge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Ingo Molnar [Thu, 24 Jan 2013 13:31:26 +0000 (14:31 +0100)]
Merge branch 'tip/perf/core' of git://git./linux/kernel/git/rostedt/linux-trace into perf/core

Pull small function-tracing smatch fixlet from Steve Rostedt.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
11 years agotracing: Fix unsigned int compare of zero in recursion check
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>
11 years agoMerge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Ingo Molnar [Thu, 24 Jan 2013 12:39:31 +0000 (13:39 +0100)]
Merge branch 'tip/perf/core' of git://git./linux/kernel/git/rostedt/linux-trace into perf/core

Pull tracing updates from Steve Rostedt.

This commit:

      tracing: Remove the extra 4 bytes of padding in events

changes the ABI. All involved parties seem to agree that it's safe to
do now, but the devil is in the details ...

Signed-off-by: Ingo Molnar <mingo@kernel.org>
11 years agoMerge tag 'usb-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Thu, 24 Jan 2013 04:11:35 +0000 (20:11 -0800)]
Merge tag 'usb-3.8-rc4' of git://git./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

11 years agoMerge tag 'char-misc-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Thu, 24 Jan 2013 04:10:48 +0000 (20:10 -0800)]
Merge tag 'char-misc-3.8-rc4' of git://git./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"

11 years agoMerge tag 'tty-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Thu, 24 Jan 2013 04:09:58 +0000 (20:09 -0800)]
Merge tag 'tty-3.8-rc4' of git://git./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

11 years agoMerge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Thu, 24 Jan 2013 04:07:12 +0000 (20:07 -0800)]
Merge branch 'v4l_for_linus' of git://git./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

11 years agoMAINTAINERS: Someone needs to watch over the serial drivers
Greg Kroah-Hartman [Wed, 23 Jan 2013 23:45:23 +0000 (15:45 -0800)]
MAINTAINERS: Someone needs to watch over the serial drivers

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux...
Linus Torvalds [Wed, 23 Jan 2013 21:31:15 +0000 (13:31 -0800)]
Merge branch 'for-linus' of git://git./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()

11 years agoMerge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas...
Linus Torvalds [Wed, 23 Jan 2013 21:28:17 +0000 (13:28 -0800)]
Merge tag 'arm64-fixes' of git://git./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

11 years agoUSB: EHCI: fix build error in ehci-mxc
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.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Linus Torvalds [Wed, 23 Jan 2013 17:42:46 +0000 (09:42 -0800)]
Merge tag 'sound-3.8' of git://git./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

11 years agoMAINTAINERS: remove me
Alan Cox [Wed, 23 Jan 2013 14:38:16 +0000 (14:38 +0000)]
MAINTAINERS: remove me

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoALSA: hda - Fix inconsistent pin states after resume
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.

Reported-by: Manolo Díaz <diaz.manolo@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoring-buffer: Remove trace.h from ring_buffer.c
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>
11 years agoring-buffer: User context bit recursion checking
Steven Rostedt [Fri, 2 Nov 2012 22:33:05 +0000 (18:33 -0400)]
ring-buffer: User context bit recursion checking

Using context bit recursion checking, we can help increase the
performance of the ring buffer.

Before this patch:

 # 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)

Now we have:

 # echo function > /debug/tracing/current_tracer
 # for i in `seq 10`; do ./hackbench 50; done
Time: 9.712
Time: 9.824
Time: 9.861
Time: 9.827
Time: 9.962
Time: 9.905
Time: 9.886
Time: 10.088
Time: 9.861
Time: 9.834

(average: 9.876)

 a 4% savings!

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoftrace: Use only the preempt version of function tracing
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>
11 years agotracing: Avoid unnecessary multiple recursion checks
Steven Rostedt [Fri, 2 Nov 2012 21:47:21 +0000 (17:47 -0400)]
tracing: Avoid unnecessary multiple recursion checks

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>
11 years agotracing: Make the trace recursion bits into enums
Steven Rostedt [Fri, 2 Nov 2012 21:32:25 +0000 (17:32 -0400)]
tracing: Make the trace recursion bits into enums

Convert the bits into enums which makes the code a little easier
to maintain.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoftrace: Add context level recursion bit checking
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>
11 years agoftrace: Optimize the function tracer list loop
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>
11 years agoftrace: Fix function tracing recursion self test
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>
11 years agoftrace: Fix global function tracers that are not recursion safe
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>
11 years agotracing: Fix selftest function recursion accounting
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>
11 years agotracing: Fix race with max_tr and changing tracers
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>
11 years agoRevert "drivers/misc/ti-st: remove gpio handling"
Luciano Coelho [Mon, 21 Jan 2013 11:12:42 +0000 (13:12 +0200)]
Revert "drivers/misc/ti-st: remove gpio handling"

This reverts commit eccf2979b2c034b516e01b8a104c3739f7ef07d1.

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.

Cc: stable <stable@vger.kernel.org> [3.7]
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag '3.8-pci-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Linus Torvalds [Wed, 23 Jan 2013 00:36:23 +0000 (16:36 -0800)]
Merge tag '3.8-pci-fixes-2' of git://git./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

   - Misc
      PCI/AER: pci_get_domain_bus_and_slot() call missing required pci_dev_put()
      PCI: remove depends on CONFIG_EXPERIMENTAL"

* 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

11 years agoasync: fix __lowest_in_progress()
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>
11 years agoMerge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Tue, 22 Jan 2013 22:32:07 +0000 (14:32 -0800)]
Merge tag 'perf-urgent-for-mingo' of git://git./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

11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Tue, 22 Jan 2013 22:30:35 +0000 (14:30 -0800)]
Merge branch 'for-linus' of git://git./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

11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
Linus Torvalds [Tue, 22 Jan 2013 19:53:19 +0000 (11:53 -0800)]
Merge branch 'for-linus' of git://git./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

11 years agoMerge tag 'fixes-for-v3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/linus...
Linus Torvalds [Tue, 22 Jan 2013 19:52:23 +0000 (11:52 -0800)]
Merge tag 'fixes-for-v3.8-rc4' of git://git./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>

11 years agoMerge tag 'f2fs-for-3.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk...
Linus Torvalds [Tue, 22 Jan 2013 18:33:17 +0000 (10:33 -0800)]
Merge tag 'f2fs-for-3.8-rc5' of git://git./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
  ...

11 years agoMerge tag 'vfio-for-v3.8-rc5' of git://github.com/awilliam/linux-vfio
Linus Torvalds [Tue, 22 Jan 2013 18:31:57 +0000 (10:31 -0800)]
Merge tag 'vfio-for-v3.8-rc5' of git://github.com/awilliam/linux-vfio

Pull vfio fix from Alex Williamson.
 "vfio-pci: Fix buffer overfill"

* tag 'vfio-for-v3.8-rc5' of git://github.com/awilliam/linux-vfio:
  vfio-pci: Fix buffer overfill

11 years agoMerge tag 'trace-3.8-rc4-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/rosted...
Linus Torvalds [Tue, 22 Jan 2013 18:30:49 +0000 (10:30 -0800)]
Merge tag 'trace-3.8-rc4-fix' of git://git./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

11 years agoMerge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik...
Linus Torvalds [Tue, 22 Jan 2013 18:10:34 +0000 (10:10 -0800)]
Merge tag 'upstream-linus' of git://git./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.

11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Tue, 22 Jan 2013 18:10:10 +0000 (10:10 -0800)]
Merge branch 'for-linus' of git://git./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

11 years agowake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task
Oleg Nesterov [Mon, 21 Jan 2013 19:48:17 +0000 (20:48 +0100)]
wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task

wake_up_process() should never wakeup a TASK_STOPPED/TRACED task.
Change it to use TASK_NORMAL and add the WARN_ON().

TASK_ALL has no other users, probably can be killed.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL
Oleg Nesterov [Mon, 21 Jan 2013 19:48:00 +0000 (20:48 +0100)]
ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL

putreg() assumes that the tracee is not running and pt_regs_access() can
safely play with its stack.  However a killed tracee can return from
ptrace_stop() to the low-level asm code and do RESTORE_REST, this means
that debugger can actually read/modify the kernel stack until the tracee
does SAVE_REST again.

set_task_blockstep() can race with SIGKILL too and in some sense this
race is even worse, the very fact the tracee can be woken up breaks the
logic.

As Linus suggested we can clear TASK_WAKEKILL around the arch_ptrace()
call, this ensures that nobody can ever wakeup the tracee while the
debugger looks at it.  Not only this fixes the mentioned problems, we
can do some cleanups/simplifications in arch_ptrace() paths.

Probably ptrace_unfreeze_traced() needs more callers, for example it
makes sense to make the tracee killable for oom-killer before
access_process_vm().

While at it, add the comment into may_ptrace_stop() to explain why
ptrace_stop() still can't rely on SIGKILL and signal_pending_state().

Reported-by: Salman Qazi <sqazi@google.com>
Reported-by: Suleiman Souhlal <suleiman@google.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoarm64: makefile: fix uname munging when setting ARCH on native machine
Will Deacon [Fri, 18 Jan 2013 19:00:47 +0000 (19:00 +0000)]
arm64: makefile: fix uname munging when setting ARCH on native machine

By popular demand, arch/aarch64 is now known as arch/arm64. However,
uname -m (and indeed the GNU triplet) still use aarch64 as the machine
string.

This patch fixes native builds of both the kernel and perf tools by
updating the relevant Makefiles to munge the output of uname -m and
set the ARCH variable appropriately.

Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
11 years agoarm64: elf: fix core dumping to match what glibc expects
Will Deacon [Tue, 22 Jan 2013 15:34:40 +0000 (15:34 +0000)]
arm64: elf: fix core dumping to match what glibc expects

The kernel's internal definition of ELF_NGREG uses struct pt_regs, which
means that we disagree with userspace on the size of coredumps since
glibc correctly uses the user-visible struct user_pt_regs.

This patch fixes our ELF_NGREG definition to use struct user_pt_regs
and introduces our own ELF_CORE_COPY_REGS to convert between the user
and kernel structure definitions.

Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
11 years agoUSB: EHCI: add a name for the platform-private field
Alan Stern [Tue, 22 Jan 2013 17:00:26 +0000 (12:00 -0500)]
USB: EHCI: add a name for the platform-private field

This patch (as1642) adds an ehci->priv field for private use by EHCI
platform drivers.  The space was provided some time ago, but it didn't
have a name.

Until now none of the platform drivers has used this private space,
but that's about to change in the next patch of this series.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: EHCI: fix incorrect configuration test
Alan Stern [Tue, 22 Jan 2013 17:00:12 +0000 (12:00 -0500)]
USB: EHCI: fix incorrect configuration test

This patch (as1641) fixes a minor bug in ehci-hcd left over from when
the Chipidea driver was converted to the "ehci-hcd is a library"
scheme.  The test for whether the Chipidea platform driver is active
should be IS_ENABLED(), not defined().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: EHCI: Move definition of EHCI_STATS to ehci.h
Roger Quadros [Tue, 22 Jan 2013 16:59:58 +0000 (11:59 -0500)]
USB: EHCI: Move definition of EHCI_STATS to ehci.h

Without this, platform drivers e.g. ehci-omap.c will see a
different version of struct ehci_hcd than ehci-hcd.c and
break reference to 'debug_dir' and 'priv' members when
CONFIG_USB_DEBUG is enabled.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agotracing: Remove trace.h header from trace_clock.c
Steven Rostedt [Tue, 22 Jan 2013 17:06:56 +0000 (12:06 -0500)]
tracing: Remove trace.h header from trace_clock.c

As trace_clock is used by other things besides tracing, and it
does not require anything from trace.h, it is best not to include
the header file in trace_clock.c.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoUSB: UHCI: fix IRQ race during initialization
Alan Stern [Tue, 22 Jan 2013 16:37:35 +0000 (11:37 -0500)]
USB: UHCI: fix IRQ race during initialization

This patch (as1644) fixes a race that occurs during startup in
uhci-hcd.  If the IRQ line is shared with other devices, it's possible
for the handler routine to be called before the data structures are
fully initialized.

The problem is fixed by adding a check to the IRQ handler routine.  If
the initialization hasn't finished yet, the routine will return
immediately.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Don Zickus <dzickus@redhat.com>
Tested-by: "Huang, Adrian (ISS Linux TW)" <adrian.huang@hp.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up()
Oleg Nesterov [Mon, 21 Jan 2013 19:47:41 +0000 (20:47 +0100)]
ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up()

Cleanup and preparation for the next change.

signal_wake_up(resume => true) is overused. None of ptrace/jctl callers
actually want to wakeup a TASK_WAKEKILL task, but they can't specify the
necessary mask.

Turn signal_wake_up() into signal_wake_up_state(state), reintroduce
signal_wake_up() as a trivial helper, and add ptrace_signal_wake_up()
which adds __TASK_TRACED.

This way ptrace_signal_wake_up() can work "inside" ptrace_request()
even if the tracee doesn't have the TASK_WAKEKILL bit set.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agotracing: Remove the extra 4 bytes of padding in events
Steven Rostedt [Fri, 18 Jan 2013 15:31:20 +0000 (10:31 -0500)]
tracing: Remove the extra 4 bytes of padding in events

Due to a userspace issue with PowerTop v2beta, which hardcoded
the offset of event fields that it was using, it broke when
we removed the Big Kernel Lock counter from the event header.

 (commit e6e1e2593 "tracing: Remove lock_depth from event entry")

Because this broke userspace, it was determined that we must
keep those 4 bytes around.

 (commit a3a4a5acd "Regression: partial revert "tracing: Remove lock_depth from event entry"")

This unfortunately wastes space in the ring buffer. 4 bytes per
event, where a lot of events are just 24 bytes. That's 16% of the
buffer wasted. A million events will add 4 megs of white space
into the buffer.

It was later noticed that PowerTop v2beta could not work on systems
where the kernel was 64 bit but the userspace was 32 bits.
The reason was because the offsets are different between the
two and the hard coded offset of one would not work with the other.

With PowerTop v2 final, it implemented the same interface that both
perf and trace-cmd use. That is, it reads the format file of
the event to find the offsets of the fields it needs. This fixes
the problem with running powertop on a 32 bit userspace running
on a 64 bit kernel. It also no longer requires the 4 byte padding.

As PowerTop v2 has been out for a while, and is included in all
major distributions, it is time that we can safely remove the
4 bytes of padding. Users of PowerTop v2beta should upgrade to
PowerTop v2 final.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agof2fs: use _safe() version of list_for_each
Dan Carpenter [Sun, 20 Jan 2013 15:02:58 +0000 (18:02 +0300)]
f2fs: use _safe() version of list_for_each

This is calling list_del() inside a loop which is a problem when we try
move to the next item on the list.  I've converted it to use the _safe
version.  And also, as a cleanup, I've converted it to use
list_for_each_entry instead of list_for_each.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
11 years agof2fs: add comments of start_bidx_of_node
Jaegeuk Kim [Mon, 21 Jan 2013 08:34:21 +0000 (17:34 +0900)]
f2fs: add comments of start_bidx_of_node

The caller of start_bidx_of_node() should give proper node offsets which
point only direct node blocks. Otherwise, it is a caller's bug.
This patch adds comments to make it clear.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
11 years agof2fs: avoid issuing small bios due to several dirty node pages
Jaegeuk Kim [Fri, 18 Jan 2013 05:54:13 +0000 (14:54 +0900)]
f2fs: avoid issuing small bios due to several dirty node pages

If some small bios of dirty node pages are supposed to be issued during the
sequential data writes, there-in well-produced consecutive data bios are able
to be split by the small node bios, resulting in performance degradation.
So, let's collect a number of dirty node pages until reaching a threshold.
And, by default, I set the threshold as 2MB, a segment size.

This improves sequential write performance on i5, 512GB SSD (830 w/ SATA2) as
follows.
Before: 231 MB/s -> After: 255 MB/s

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
11 years agof2fs: support swapfile
Jaegeuk Kim [Thu, 17 Jan 2013 11:30:23 +0000 (20:30 +0900)]
f2fs: support swapfile

This patch adds f2fs_bmap operation to the data address space.
This enables f2fs to support swapfile.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
11 years agof2fs: add remap_pages as generic_file_remap_pages
Jaegeuk Kim [Thu, 17 Jan 2013 09:37:41 +0000 (18:37 +0900)]
f2fs: add remap_pages as generic_file_remap_pages

This was added for all the file systems before.

See the following commit.

commit id: 0b173bc4daa8f8ec03a85abf5e47b23502ff80af

[PATCH] mm: kill vma flag VM_CAN_NONLINEAR

This patch moves actual ptes filling for non-linear file mappings
into special vma operation: ->remap_pages().

File system must implement this method to get non-linear mappings support,
if it uses filemap_fault() then generic_file_remap_pages() can be used.

Now device drivers can implement this method and obtain nonlinear vma support."

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
11 years agof2fs: add __init to functions in init_f2fs_fs
Namjae Jeon [Wed, 16 Jan 2013 15:08:30 +0000 (00:08 +0900)]
f2fs: add __init to functions in init_f2fs_fs

Add __init to functions in init_f2fs_fs for code consistency.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
11 years agoMerge tag 'fixes-for-v3.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Mon, 21 Jan 2013 19:37:57 +0000 (11:37 -0800)]
Merge tag 'fixes-for-v3.8-rc5' of git://git./linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

  usb: fixes for v3.8-rc5

  Finally we have a build fix for fsl-mxc-udc UDC driver.

  We also have a fix for ep0 maxburst setting on DWC3
  which could confuse the HW if we tell it we had way
  too many streams on that endpoint when it _has_ to be
  only one.

  cppi_dma support for MUSB got a fix when running as a
  module. By dropping the wrong __init annotation, the
  function will be available even when we're modules and
  we're done with .init.text section.

  Last, but not least, we have a fix on FunctionFS which
  was causing a bug on our option parsing algorithm.

11 years agokprobes/x86: Move kprobes stuff under arch/x86/kernel/kprobes/
Masami Hiramatsu [Fri, 28 Sep 2012 08:15:22 +0000 (17:15 +0900)]
kprobes/x86: Move kprobes stuff under arch/x86/kernel/kprobes/

Move arch-dep kprobes stuff under arch/x86/kernel/kprobes.

Link: http://lkml.kernel.org/r/20120928081522.3560.75469.stgit@ltc138.sdl.hitachi.co.jp
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
[ fixed whitespace and s/__attribute__((packed))/__packed/ ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agokprobes/x86: Move ftrace-based kprobe code into kprobes-ftrace.c
Masami Hiramatsu [Fri, 28 Sep 2012 08:15:20 +0000 (17:15 +0900)]
kprobes/x86: Move ftrace-based kprobe code into kprobes-ftrace.c

Split ftrace-based kprobes code from kprobes, and introduce
CONFIG_(HAVE_)KPROBES_ON_FTRACE Kconfig flags.
For the cleanup reason, this also moves kprobe_ftrace check
into skip_singlestep.

Link: http://lkml.kernel.org/r/20120928081520.3560.25624.stgit@ltc138.sdl.hitachi.co.jp
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoftrace: Move ARCH_SUPPORTS_FTRACE_SAVE_REGS in Kconfig
Masami Hiramatsu [Fri, 28 Sep 2012 08:15:17 +0000 (17:15 +0900)]
ftrace: Move ARCH_SUPPORTS_FTRACE_SAVE_REGS in Kconfig

Move SAVE_REGS support flag into Kconfig and rename
it to CONFIG_DYNAMIC_FTRACE_WITH_REGS. This also introduces
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS which indicates
the architecture depending part of ftrace has a code
that saves full registers.
On the other hand, CONFIG_DYNAMIC_FTRACE_WITH_REGS indicates
the code is enabled.

Link: http://lkml.kernel.org/r/20120928081516.3560.72534.stgit@ltc138.sdl.hitachi.co.jp
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing/fgraph: Add max_graph_depth to limit function_graph depth
Steven Rostedt [Wed, 16 Jan 2013 15:49:37 +0000 (10:49 -0500)]
tracing/fgraph: Add max_graph_depth to limit function_graph depth

Add the file max_graph_depth to the debug tracing directory that lets
the user define the depth of the function graph.

A very useful operation is to set the depth to 1. Then it traces only
the first function that is called when entering the kernel. This can
be used to determine what system operations interrupt a process.

For example, to work on NOHZ processes (single tasks running without
a timer tick), if any interrupt goes off and preempts that task, this
code will show it happening.

  # cd /sys/kernel/debug/tracing
  # echo 1 > max_graph_depth
  # echo function_graph > current_tracer
  # cat per_cpu/cpu/<cpu-of-process>/trace

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing/lockdep: Disable lockdep first in entering NMI
Steven Rostedt [Wed, 16 Jan 2013 03:11:19 +0000 (22:11 -0500)]
tracing/lockdep: Disable lockdep first in entering NMI

When function tracing with either debug locks enabled or tracing
preempt disabled, the add_preempt_count() is traced. This is an
issue with lockdep and function tracing. As function tracing
can disable interrupts, and lockdep records that change,
lockdep may not be able to handle this recursion if it happens from
an NMI context.

The first thing that an NMI does is:

 #define nmi_enter() \
do { \
ftrace_nmi_enter(); \
BUG_ON(in_nmi()); \
add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
lockdep_off(); \
rcu_nmi_enter(); \
trace_hardirq_enter(); \
} while (0)

When the add_preempt_count() is traced, and the tracing callback
disables interrupts, it will jump into the lockdep code. There's
some places in lockdep that can't handle this re-entrance, and
causes lockdep to fail.

As the lockdep_off() (and lockdep_on) is a simple:

void lockdep_off(void)
{
current->lockdep_recursion++;
}

and is never traced, it can be called first in nmi_enter()
and lockdep_on() last in nmi_exit().

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing: Remove unneeded check of max_tr->buffer before tracing_reset
Steven Rostedt [Fri, 21 Dec 2012 02:43:52 +0000 (21:43 -0500)]
tracing: Remove unneeded check of max_tr->buffer before tracing_reset

There's now a check in tracing_reset_online_cpus() if the buffer is
allocated or NULL. No need to do a check before calling it with max_tr.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing: Add checks if tr->buffer is NULL in tracing_reset{_online_cpus}
Hiraku Toyooka [Wed, 19 Dec 2012 07:02:34 +0000 (16:02 +0900)]
tracing: Add checks if tr->buffer is NULL in tracing_reset{_online_cpus}

max_tr->buffer could be NULL in the tracing_reset{_online_cpus}. In this
case, a NULL pointer dereference happens, so we should return immediately
from these functions.

Note, the current code does not call tracing_reset*() with max_tr when
its buffer is NULL, but future code will. This patch is needed to prevent
the future code from crashing.

Link: http://lkml.kernel.org/r/20121219070234.31200.93863.stgit@liselsia
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing/syscalls: Make local functions static
Fengguang Wu [Wed, 21 Nov 2012 07:13:47 +0000 (15:13 +0800)]
tracing/syscalls: Make local functions static

Some functions in the syscall tracing is used only locally to
the file, but they are labeled global. Convert them to static functions.

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing: Verify target file before registering a uprobe event
Jovi Zhang [Wed, 18 Jul 2012 10:16:44 +0000 (18:16 +0800)]
tracing: Verify target file before registering a uprobe event

Without this patch, we can register a uprobe event for a directory.
Enabling such a uprobe event would anyway fail.

Example:
$ echo 'p /bin:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events

However dirctories cannot be valid targets for uprobe.
Hence verify if the target is a regular file during the probe
registration.

Link: http://lkml.kernel.org/r/20130103004212.690763002@goodmis.org
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
[ cleaned up whitespace and removed redundant IS_DIR() check ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing: Use this_cpu_ptr per-cpu helper
Shan Wei [Tue, 13 Nov 2012 01:53:04 +0000 (09:53 +0800)]
tracing: Use this_cpu_ptr per-cpu helper

typeof(&buffer) is a pointer to array of 1024 char, or char (*)[1024].
But, typeof(&buffer[0]) is a pointer to char which match the return type of get_trace_buf().
As well-known, the value of &buffer is equal to &buffer[0].
so return this_cpu_ptr(&percpu_buffer->buffer[0]) can avoid type cast.

Link: http://lkml.kernel.org/r/50A1A800.3020102@gmail.com
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Shan Wei <davidshan@tencent.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoring-buffer: Remove unnecessary recusive call in rb_advance_iter()
Steven Rostedt [Fri, 30 Nov 2012 15:41:57 +0000 (10:41 -0500)]
ring-buffer: Remove unnecessary recusive call in rb_advance_iter()

The original ring-buffer code had special checks at the start
of rb_advance_iter() and instead of repeating them again at the
end of the function if a certain condition existed, I just did
a recursive call to rb_advance_iter() because the special condition
would cause rb_advance_iter() to return early (after the checks).

But as things have changed, the special checks no longer exist
and the only thing done for the special_condition is to call
rb_inc_iter() and return. Instead of doing a confusing recursive call,
just call rb_inc_iter instead.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agotracing: Fix sparse warning with is_signed_type() macro
Steven Rostedt [Fri, 14 Dec 2012 18:15:08 +0000 (13:15 -0500)]
tracing: Fix sparse warning with is_signed_type() macro

Sparse complains when is_signed_type() is used on a pointer.
This macro is needed for the format output used for ftrace
and perf, to know if a binary field is a signed type or not.
The is_signed_type() macro is used against all fields that are
recorded by events to automate the operation.

The problem sparse has is with the current way is_signed_type()
works:

  ((type)-1 < 0)

If "type" is a poiner, than sparse does not like it being compared
to an integer (zero). The simple fix is to just give zero the
same type. The runtime result stays the same.

Reported-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoftrace: Be first to run code modification on modules
Steven Rostedt [Fri, 14 Dec 2012 14:48:15 +0000 (09:48 -0500)]
ftrace: Be first to run code modification on modules

If some other kernel subsystem has a module notifier, and adds a kprobe
to a ftrace mcount point (now that kprobes work on ftrace points),
when the ftrace notifier runs it will fail and disable ftrace, as well
as kprobes that are attached to ftrace points.

Here's the error:

 WARNING: at kernel/trace/ftrace.c:1618 ftrace_bug+0x239/0x280()
 Hardware name: Bochs
 Modules linked in: fat(+) stap_56d28a51b3fe546293ca0700b10bcb29__8059(F) nfsv4 auth_rpcgss nfs dns_resolver fscache xt_nat iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack lockd sunrpc ppdev parport_pc parport microcode virtio_net i2c_piix4 drm_kms_helper ttm drm i2c_core [last unloaded: bid_shared]
 Pid: 8068, comm: modprobe Tainted: GF            3.7.0-0.rc8.git0.1.fc19.x86_64 #1
 Call Trace:
  [<ffffffff8105e70f>] warn_slowpath_common+0x7f/0xc0
  [<ffffffff81134106>] ? __probe_kernel_read+0x46/0x70
  [<ffffffffa0180000>] ? 0xffffffffa017ffff
  [<ffffffffa0180000>] ? 0xffffffffa017ffff
  [<ffffffff8105e76a>] warn_slowpath_null+0x1a/0x20
  [<ffffffff810fd189>] ftrace_bug+0x239/0x280
  [<ffffffff810fd626>] ftrace_process_locs+0x376/0x520
  [<ffffffff810fefb7>] ftrace_module_notify+0x47/0x50
  [<ffffffff8163912d>] notifier_call_chain+0x4d/0x70
  [<ffffffff810882f8>] __blocking_notifier_call_chain+0x58/0x80
  [<ffffffff81088336>] blocking_notifier_call_chain+0x16/0x20
  [<ffffffff810c2a23>] sys_init_module+0x73/0x220
  [<ffffffff8163d719>] system_call_fastpath+0x16/0x1b
 ---[ end trace 9ef46351e53bbf80 ]---
 ftrace failed to modify [<ffffffffa0180000>] init_once+0x0/0x20 [fat]
  actual: cc:bb:d2:4b:e1

A kprobe was added to the init_once() function in the fat module on load.
But this happened before ftrace could have touched the code. As ftrace
didn't run yet, the kprobe system had no idea it was a ftrace point and
simply added a breakpoint to the code (0xcc in the cc:bb:d2:4b:e1).

Then when ftrace went to modify the location from a call to mcount/fentry
into a nop, it didn't see a call op, but instead it saw the breakpoint op
and not knowing what to do with it, ftrace shut itself down.

The solution is to simply give the ftrace module notifier the max priority.
This should have been done regardless, as the core code ftrace modification
also happens very early on in boot up. This makes the module modification
closer to core modification.

Link: http://lkml.kernel.org/r/20130107140333.593683061@goodmis.org
Cc: stable@vger.kernel.org
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reported-by: Frank Ch. Eigler <fche@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
11 years agoALSA: hda - Add Conexant CX20755/20756/20757 codec IDs
Takashi Iwai [Mon, 21 Jan 2013 15:53:37 +0000 (16:53 +0100)]
ALSA: hda - Add Conexant CX20755/20756/20757 codec IDs

These are just compatible with other CX2075x codecs.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>