platform/kernel/linux-3.10.git
9 years agodts: arm: add arm-pmu node for exynos4412
Chanho Park [Fri, 19 Jul 2013 07:18:56 +0000 (16:18 +0900)]
dts: arm: add arm-pmu node for exynos4412

This patch enables arm-pmu node of exynos4412. It has 4 cpus. Thus, it also
has 4 performance counter.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agoperf tools: Add missing liblk.a dependency for python/perf.so
Jiri Olsa [Mon, 15 Apr 2013 03:54:14 +0000 (05:54 +0200)]
perf tools: Add missing liblk.a dependency for python/perf.so

Adding missing liblk.a dependency for python/perf.so.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-26-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Remove '?=' Makefile STRIP assignment
Jiri Olsa [Mon, 15 Apr 2013 02:49:43 +0000 (04:49 +0200)]
perf tools: Remove '?=' Makefile STRIP assignment

No need to use '?=' assignment for STRIP variable, the standard
'=' does the same job without creating confusion.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: http://lkml.kernel.org/r/1369398928-9809-25-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Replace multiple line assignment with multiple statements
Jiri Olsa [Mon, 15 Apr 2013 02:32:28 +0000 (04:32 +0200)]
perf tools: Replace multiple line assignment with multiple statements

Replacing multiple line assignment with multiple statements.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-24-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Replace tabs with spaces for all non-commands statements
Jiri Olsa [Mon, 15 Apr 2013 02:06:58 +0000 (04:06 +0200)]
perf tools: Replace tabs with spaces for all non-commands statements

Replacing tabs with spaces for all non-commands statements
in 'Makefile' and 'config/Makefile' files.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-23-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Add NO_BIONIC variable to confiure bionic setup
Jiri Olsa [Fri, 24 May 2013 12:35:24 +0000 (14:35 +0200)]
perf tools: Add NO_BIONIC variable to confiure bionic setup

Adding NO_BIONIC variable to confiure bionic setup

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-22-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Switch to full path C include directories
Jiri Olsa [Fri, 24 May 2013 12:35:23 +0000 (14:35 +0200)]
perf tools: Switch to full path C include directories

Switching to full path C include directories, to make the includes
clear. Plus little include cleanup.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-21-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Merge all *LDFLAGS* make variable into LDFLAGS
Jiri Olsa [Thu, 21 Mar 2013 10:41:05 +0000 (11:41 +0100)]
perf tools: Merge all *LDFLAGS* make variable into LDFLAGS

Merging all *LDFLAGS* make variable into LDFLAGS to eliminate all
special *LDFLAGS* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-20-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Merge all *CFLAGS* make variable into CFLAGS
Jiri Olsa [Thu, 21 Mar 2013 10:30:54 +0000 (11:30 +0100)]
perf tools: Merge all *CFLAGS* make variable into CFLAGS

Merging all *CFLAGS* make variable into CFLAGS to eliminate all special
*_CFLAGS_* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-19-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf evlist: Reset SIGTERM handler in workload child process
David Ahern [Sat, 25 May 2013 23:50:39 +0000 (17:50 -0600)]
perf evlist: Reset SIGTERM handler in workload child process

Jiri reported hanging perf tests on latest acme's perf/core and bisected
it to 87f303a9f:

[jolsa@krava2 perf]$ cat /proc/sys/kernel/perf_event_paranoid
1
[jolsa@krava2 perf]$ ./perf record -C 0 kill
Error:
You may not have permission to collect %sstats.
Consider tweaking /proc/sys/kernel/perf_event_paranoid:
 -1 - Not paranoid at all
  0 - Disallow raw tracepoint access for unpriv
  1 - Disallow cpu events for unpriv
  2 - Disallow kernel profiling for unpriv

Need to let default handling kickin for workload process.

Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1369525839-1261-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf: Expand definition of sysfs format attribute
Michael Ellerman [Fri, 10 May 2013 15:33:00 +0000 (17:33 +0200)]
perf: Expand definition of sysfs format attribute

Make it explicit that the format attributes may define overlapping bit
ranges. Unfortunately this was left unspecified originally, and all the
examples show non-overlapping ranges. I don't believe this is an ABI
change, as we are defining something that was previously undefined, but
others may disagree.

The POWER8 PMU would like to define overlapping ranges, as bit ranges in
the event code have different meanings for certain events. It will also
allow us to define an overarching "event" field, that encompasses all
others.

As far as I can see perf is comfortable with this change, however I am
not sure if there are any other users of the interface.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@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/1368199980-20283-1-git-send-email-jolsa@redhat.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf: Power7 Update testing ABI to list CPI-stack events
Sukadev Bhattiprolu [Sat, 6 Apr 2013 16:52:05 +0000 (09:52 -0700)]
perf: Power7 Update testing ABI to list CPI-stack events

Following patch added several Power7 events into /sys/devices/cpu/events.
Document those events in the testing ABI.

https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-April/105167.html

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Link: http://lkml.kernel.org/r/20130406170623.GA900@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf: Power7: Make CPI stack events available in sysfs
Sukadev Bhattiprolu [Sat, 6 Apr 2013 15:48:26 +0000 (08:48 -0700)]
perf: Power7: Make CPI stack events available in sysfs

A set of Power7 events are often used for Cycles Per Instruction (CPI) stack
analysis. Make these events available in sysfs (/sys/devices/cpu/events/) so
they can be identified using their symbolic names:

perf stat -e 'cpu/PM_CMPLU_STALL_DCACHE_MISS/' /bin/ls

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Link: http://lkml.kernel.org/r/20130406164803.GA408@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agotools lib lk: Respect CROSS_COMPILE
Rabin Vincent [Fri, 17 May 2013 20:27:44 +0000 (22:27 +0200)]
tools lib lk: Respect CROSS_COMPILE

Make lk use CROSS_COMPILE, in order to be able to cross compile perf
again.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1368822464-4887-1-git-send-email-rabin@rab.in
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Remove cwdlen from struct perf_session
Jiri Olsa [Fri, 24 May 2013 11:16:41 +0000 (13:16 +0200)]
perf tools: Remove cwdlen from struct perf_session

Removing cwdlen from struct perf_session as it's no longer used.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.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: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369394201-20044-6-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Remove frozen from perf_header struct
Jiri Olsa [Fri, 24 May 2013 11:16:39 +0000 (13:16 +0200)]
perf tools: Remove frozen from perf_header struct

Removing frozen from perf_header struct as it's no longer used.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.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: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369394201-20044-4-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tests: Fix exclude_guest|exclude_host checking for attr tests
Jiri Olsa [Fri, 24 May 2013 11:16:38 +0000 (13:16 +0200)]
perf tests: Fix exclude_guest|exclude_host checking for attr tests

We have a one of the event open fallback case in __perf_evsel__open
where we zero exclude_guest|exclude_host fields.

This means there's no way for attr tests to find out what's the right
value for those fields, so we need to check for both 0 and 1. Luckily we
still have other event parsing tests for those fields.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.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: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369394201-20044-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tests: Fix attr test for record -d option
Jiri Olsa [Fri, 24 May 2013 11:16:37 +0000 (13:16 +0200)]
perf tests: Fix attr test for record -d option

The sample type for '-d' option is changed, because of the memory
profiling patches from Stephane. The '-d' now adds PERF_SAMPLE_DATA_SRC
sample_type.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.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: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369394201-20044-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Final touches for CHK config move
Jiri Olsa [Mon, 18 Mar 2013 21:04:35 +0000 (22:04 +0100)]
perf tools: Final touches for CHK config move

Removing no longer needed ifdefs.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-18-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move paths config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:56:01 +0000 (00:56 +0100)]
perf tools: Move paths config into config/Makefile

Moving paths config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-17-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libnuma check config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:45:27 +0000 (00:45 +0100)]
perf tools: Move libnuma check config into config/Makefile

Moving libnuma check config into config/Makefile

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-16-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move stdlib check config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:41:04 +0000 (00:41 +0100)]
perf tools: Move stdlib check config into config/Makefile

Moving stdlib check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-15-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libbfd check config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:38:16 +0000 (00:38 +0100)]
perf tools: Move libbfd check config into config/Makefile

Moving libbfd check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-14-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libpython check config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:35:32 +0000 (00:35 +0100)]
perf tools: Move libpython check config into config/Makefile

Moving libpython check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-13-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libperl check config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:19:44 +0000 (00:19 +0100)]
perf tools: Move libperl check config into config/Makefile

Moving libperl check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-12-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move gtk2 check config into config/Makefile
Jiri Olsa [Sun, 17 Mar 2013 23:09:24 +0000 (00:09 +0100)]
perf tools: Move gtk2 check config into config/Makefile

Moving gtk2 check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-11-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move slang check config into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:56:08 +0000 (00:56 +0100)]
perf tools: Move slang check config into config/Makefile

Moving slang check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-10-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libaudit check config into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:54:36 +0000 (00:54 +0100)]
perf tools: Move libaudit check config into config/Makefile

Moving libaudit check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-9-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libunwind check config into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:53:03 +0000 (00:53 +0100)]
perf tools: Move libunwind check config into config/Makefile

Moving libunwind check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-8-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libdw check config into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:48:14 +0000 (00:48 +0100)]
perf tools: Move libdw check config into config/Makefile

Moving libdw check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-7-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move libelf check config into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:45:08 +0000 (00:45 +0100)]
perf tools: Move libelf check config into config/Makefile

Moving libelf check config into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-6-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move compiler and linker flags check into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:40:48 +0000 (00:40 +0100)]
perf tools: Move compiler and linker flags check into config/Makefile

Moving compiler and linker flags check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-5-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move programs check into config/Makefile
Jiri Olsa [Sun, 24 Mar 2013 23:32:01 +0000 (00:32 +0100)]
perf tools: Move programs check into config/Makefile

Moving programs check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-4-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Move arch check into config/Makefile
Jiri Olsa [Fri, 15 Mar 2013 15:28:49 +0000 (16:28 +0100)]
perf tools: Move arch check into config/Makefile

Moving arch check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Add automated make test suite
Jiri Olsa [Fri, 29 Mar 2013 15:11:02 +0000 (16:11 +0100)]
perf tools: Add automated make test suite

Adding automated test for testing the build process.

To run it you need to be in perf directory or specify one with PERF
variable. It's also possible to specify optional Makefile to test via MK
variable.

Whole suite is executed twice, the second time with O=/tmp/xxx option
added.

To run the whole suite:
  $ make -f tests/make
  - make_pure: cd . && make -f Makefile
    test: test -x ./perf
  - make_clean_all: cd . && make -f Makefile clean all
    test: test -x ./perf
  - make_python_perf_so: cd . && make -f Makefile python/perf.so
    test: test -f ./python/perf.so
  - make_debug: cd . && make -f Makefile DEBUG=1
    test: test -x ./perf
  - make_no_libperl: cd . && make -f Makefile NO_LIBPERL=1
    test: test -x ./perf

You see command line for 'make_pure' test right away, and the output is
stored into 'make_pure' file.

To run simple test:
  $ make -f tests/make make_debug
  - make_debug: cd . && make -f Makefile DEBUG=1
    test: test -x ./perf

At this moment tests checks for successfull build and for existence of
several built files. Additional after-build checks could be added.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Save parent pid in thread struct
David Ahern [Sun, 26 May 2013 04:47:10 +0000 (22:47 -0600)]
perf  tools: Save parent pid in thread struct

Information is available, so why not save it in case some command wants
to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369543631-5106-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf stats: Fix divide by 0 in variance
David Ahern [Sun, 26 May 2013 00:24:48 +0000 (18:24 -0600)]
perf stats: Fix divide by 0 in variance

Number of samples needs to be greater 1 to have a variance.

Fixes nan% in perf-kvm-live output.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Runzhen Wang <runzhen@linux.vnet.ibm.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1369527896-3650-9-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf kvm: Handle realloc failures
David Ahern [Sun, 26 May 2013 00:24:46 +0000 (18:24 -0600)]
perf kvm: Handle realloc failures

Save previous pointer and free on failure.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Runzhen Wang <runzhen@linux.vnet.ibm.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1369527896-3650-7-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf test: Fix typo
Arnaldo Carvalho de Melo [Thu, 23 May 2013 10:08:38 +0000 (12:08 +0200)]
perf test: Fix typo

Its 'multiple', not 'mutliple', noticed while preparing a talk for
Linuxtag'13.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
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-dzy9nl1ku7a5umddvdic4ibl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf hists: Rename hist_entry__add_pair arguments
Jiri Olsa [Thu, 13 Dec 2012 13:09:00 +0000 (14:09 +0100)]
perf hists: Rename hist_entry__add_pair arguments

The current logic is to attach pair to the leader hist_entry.

Arguments of hist_entry__add_pair function were placed the other way
round.. driving me crazy.

I.e. list_add_tail expects (new_node, head).

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/1355404152-16523-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf diff: Use internal rb tree for hists__precompute
Jiri Olsa [Thu, 13 Dec 2012 13:08:59 +0000 (14:08 +0100)]
perf diff: Use internal rb tree for hists__precompute

There's missing change for hists__precompute to iterate either
entries_collapsed or entries_in tree. The change was initiated
for hists_compute_resort function in commit:

  66f97ed perf diff: Use internal rb tree for compute resort

but was missing for hists__precompute function changes.

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/1355404152-16523-2-git-send-email-jolsa@redhat.com
[ committer note: Reduce patch size, no functional change ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf report: Add report.percent-limit config variable
Namhyung Kim [Tue, 14 May 2013 02:09:06 +0000 (11:09 +0900)]
perf report: Add report.percent-limit config variable

Now an user can set a default value of --percent-limit option into the
perfconfig file.

  $ cat ~/.perfconfig
  [report]
  percent-limit = 0.1

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf top: Add --percent-limit option
Namhyung Kim [Tue, 14 May 2013 02:09:05 +0000 (11:09 +0900)]
perf top: Add --percent-limit option

The --percent-limit option is for not showing small overhead entries in
the output.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf report: Add --percent-limit option
Namhyung Kim [Tue, 14 May 2013 02:09:04 +0000 (11:09 +0900)]
perf report: Add --percent-limit option

The --percent-limit option is for not showing small overhead entries in
the output.  Maybe we want to set a certain default value like 0.1.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf report: Don't bother locking when adding hist entries
Namhyung Kim [Tue, 14 May 2013 02:09:03 +0000 (11:09 +0900)]
perf report: Don't bother locking when adding hist entries

The 'perf report'command is single-threaded, so no need to grab a lock.

Although the fast path of pthread_mutex_[un]lock() is very fast, there's
a ~3% gain by eliminating it when we have huge sample data.

  $ perf record -a -F 100000 -o perf.data.bench -- perf bench sched all
  $ perf record -e cycles:upp -o perf.data.before -- \
  > perf report -i perf.data.bench --stdio > /dev/null
  ... apply this patch ...
  $ perf record -e cycles:upp -o perf.data.after -- \
  > perf report -i perf.data.bench --stdio > /dev/null
  $ perf diff perf.data.{before,after} | grep pthread
             +0.02%  libpthread-2.15.so  [.] _pthread_cleanup_push_defer
             +0.02%  libpthread-2.15.so  [.] _pthread_cleanup_pop_restore
     0.05%   -0.05%  perf                [.] pthread_mutex_unlock@plt
     0.05%   -0.05%  perf                [.] pthread_mutex_lock@plt
     1.01%   -1.01%  libpthread-2.15.so  [.] pthread_mutex_lock
     1.68%   -1.68%  libpthread-2.15.so  [.] __pthread_mutex_unlock_usercnt
     0.05%   -0.05%  libpthread-2.15.so  [.] pthread_mutex_unlock

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/1368497347-9628-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf hists: Move locking to its call-sites
Namhyung Kim [Tue, 14 May 2013 02:09:02 +0000 (11:09 +0900)]
perf hists: Move locking to its call-sites

It's a preparation patch to eliminate unneeded locking in the perf
report path.

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/1368497347-9628-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf top: Get rid of *_threaded() functions
Namhyung Kim [Tue, 14 May 2013 02:09:01 +0000 (11:09 +0900)]
perf top: Get rid of *_threaded() functions

Those _threaded() functions are needed to make hist tree handling
thread-safe, but AFAICS the only thing it does is forcing it to use
the intermediate 'collapsed' tree.

This can be acheived by setting sort__need_collapse to 1 in cmd_top() so
no need to keep those _threaded() variants.

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/1368497347-9628-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf top: Fix percent output when no samples collected
Namhyung Kim [Tue, 14 May 2013 02:09:00 +0000 (11:09 +0900)]
perf top: Fix percent output when no samples collected

If there's no sample, kernel and exact percent output at the header
looked like "-nan%".

Tested-by: Jiri Olsa <jolsa@redhat.com>
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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf top: Fix -E option behavior
Namhyung Kim [Tue, 14 May 2013 02:08:59 +0000 (11:08 +0900)]
perf top: Fix -E option behavior

The -E/--entries option controls how many lines to be printed on stdio
output but it doesn't work as it should be:

If -E option is specified, print that many lines regardless of current
window size, if not automatically adjust number of lines printed to fit
into the window size.

Reported-by: Minchan Kim <minchan@kernel.org>
Tested-by: Jiri Olsa <jolsa@redhat.com>
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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1368497347-9628-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf record: handle death by SIGTERM
David Ahern [Mon, 6 May 2013 18:24:23 +0000 (12:24 -0600)]
perf record: handle death by SIGTERM

Perf data files cannot be processed until the header is updated which is
done via an on_exit handler.

If perf is killed due to a SIGTERM it does not run the on_exit hooks
leaving the perf.data file in a random state which perf-report will
happily spin on trying to read.

As noted by Mike an easy reproducer is:

perf record -a -g & sleep 1; killall perf

Fix by catching SIGTERM like it does SIGINT.

Also need to remove the kill which was added via commit f7b7c26e.

Acked-by: Stephane Eranian <eranian@google.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1367864663-1309-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tests: Fix compile errors in bp_signal files
Sukadev Bhattiprolu [Fri, 26 Apr 2013 17:17:56 +0000 (10:17 -0700)]
perf tests: Fix compile errors in bp_signal files

When building on powerpc,  we get compile errors in bp_signal.c and
bp_signal_overflow.c due to __u64 and '%llx'.

Powerpc, needs __SANE_USERSPACE_TYPES__ to be defined so we pick up
<asm-generic/int-ll64.h> and define __u64 as unsigned long long.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20130426173320.GA7029@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Fix tab vs spaces issue in Makefile ifdef/endif
Jiri Olsa [Wed, 24 Apr 2013 09:37:29 +0000 (11:37 +0200)]
perf tools: Fix tab vs spaces issue in Makefile ifdef/endif

Unmatched spaces/tabs Makefile indentation could make the
Makefile fails. While the tabed line could be considered
sometimes as follow up for rule command, the mixed space
tab meses up with makefile if conditions.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.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: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1366796273-4780-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf hists browser: Use sort__has_sym
Arnaldo Carvalho de Melo [Fri, 26 Apr 2013 17:28:46 +0000 (14:28 -0300)]
perf hists browser: Use sort__has_sym

The TUI hist browser had a similar variable has_symbols for the same
purpose.  Let's get rid of the duplication.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1365125198-8334-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf top: Use sort__has_sym
Namhyung Kim [Fri, 5 Apr 2013 01:26:37 +0000 (10:26 +0900)]
perf top: Use sort__has_sym

perf top had a similar variable sort_has_symbols for the same purpose.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1365125198-8334-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf sort: Cleanup sort__has_sym setting
Namhyung Kim [Fri, 5 Apr 2013 01:26:36 +0000 (10:26 +0900)]
perf sort: Cleanup sort__has_sym setting

The sort__has_sym variable is set only if a symbol-related sort key was
added.  Since branch stack and memory sort dimensions are separated, it
doesn't need to be checked from common dimension.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1365125198-8334-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf sort: Reorder HISTC_SRCLINE index
Namhyung Kim [Fri, 5 Apr 2013 01:26:31 +0000 (10:26 +0900)]
perf sort: Reorder HISTC_SRCLINE index

It's in common sort dimension so it'd be more natural to place it with
other common column index.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1365125198-8334-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf archive: Fix typo on Documentation
Arnaldo Carvalho de Melo [Thu, 4 Apr 2013 15:41:22 +0000 (12:41 -0300)]
perf archive: Fix typo on Documentation

It is analysis, not analisys.

Reported-by: William Cohen <wcohen@redhat.com>
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-s7476m0irq0naxkzd9iekbr3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf sort: Consolidate sort_entry__setup_elide()
Namhyung Kim [Wed, 3 Apr 2013 12:26:19 +0000 (21:26 +0900)]
perf sort: Consolidate sort_entry__setup_elide()

The same code was duplicate to places, factor them out to common
sort__setup_elide().

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364991979-3008-11-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf sort: Separate out memory-specific sort keys
Namhyung Kim [Wed, 3 Apr 2013 12:26:11 +0000 (21:26 +0900)]
perf sort: Separate out memory-specific sort keys

Since they're used only for perf mem, separate out them to a different
dimension so that normal user cannot access them by any chance.

For global/local weights, I'm not entirely sure to place them into the
memory dimension.  But it's the only user at this time.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364991979-3008-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf sort: Factor out common code in sort_dimension__add()
Namhyung Kim [Wed, 3 Apr 2013 12:26:10 +0000 (21:26 +0900)]
perf sort: Factor out common code in sort_dimension__add()

Let's remove duplicate code.

Suggested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364991979-3008-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf sort: Introduce sort__mode variable
Namhyung Kim [Mon, 1 Apr 2013 11:35:20 +0000 (20:35 +0900)]
perf sort: Introduce sort__mode variable

It's used for determining current sort mode which can be one of
NORMAL, BRANCH and new MEMORY.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364816125-12212-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf report: Fix alignment of symbol column when -v is given
Namhyung Kim [Mon, 1 Apr 2013 11:35:19 +0000 (20:35 +0900)]
perf report: Fix alignment of symbol column when -v is given

When -v option is given, the symbol sort key prints its address also but
it wasn't properly aligned since hists__calc_col_len() misses the
additional part.  Also it missed 2 spaces for 0x prefix when printing.

  $ perf report --stdio -v -s sym
  # Samples: 133  of event 'cycles'
  # Event count (approx.): 50536717
  #
  # Overhead                          Symbol
  # ........  ..............................
  #
      12.20%  0xffffffff81384c50 v [k] intel_idle
       7.62%  0xffffffff8170976a v [k] ftrace_caller
       7.02%  0x2d986d         B [.] 0x00000000002d986d

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364816125-12212-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf hists: Free unused mem info of a matched hist entry
Namhyung Kim [Mon, 1 Apr 2013 11:35:18 +0000 (20:35 +0900)]
perf hists: Free unused mem info of a matched hist entry

The mem info is shared between matched entries so one should be freed.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364816125-12212-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf hists: Fix an invalid memory free on he->branch_info
Namhyung Kim [Mon, 1 Apr 2013 11:35:17 +0000 (20:35 +0900)]
perf hists: Fix an invalid memory free on he->branch_info

The branch info was allocated for the whole stack and passed matching
hist entry for each level during processing samples.  Thus when a hist
entry tries to free its branch info like in hists__collapse_insert_entry
it'll face following error.

  *** glibc detected *** perf: munmap_chunk(): invalid pointer: 0x00000000014e9d20 ***
  ======= Backtrace: =========
  /lib64/libc.so.6[0x387d47ae16]
  perf[0x4923bd]
  perf(cmd_report+0xd68)[0x432a08]
  perf[0x41a663]
  perf(main+0x58f)[0x419eaf]
  /lib64/libc.so.6(__libc_start_main+0xf5)[0x387d421735]
  perf[0x419f95]

Fix it by allocating and copying branch info for each new hist entry.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.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>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1364816125-12212-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agoperf tools: Fix bug in isupper() and islower()
Sukadev Bhattiprolu [Fri, 29 Mar 2013 19:14:43 +0000 (12:14 -0700)]
perf tools: Fix bug in isupper() and islower()

One of the reasons 'perf test' is failing on Power appears to be due to
a bug in isupper().

isupper(c) and islower(c) should be checking 'c' against the mask 0x20.
Instead they are checking sane_ctype[c] which causes isupper() to be
true for lower case letters.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20130329192950.GA9312@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
9 years agodrm/exynos: add cache operation backend callbacks
Inki Dae [Wed, 17 Jul 2013 11:41:15 +0000 (20:41 +0900)]
drm/exynos: add cache operation backend callbacks

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: export a gem into dmabuf fd with O_RDWR
Inki Dae [Wed, 17 Jul 2013 06:29:38 +0000 (15:29 +0900)]
drm/exynos: export a gem into dmabuf fd with O_RDWR

user process needs read/write permissions when the user process tires
buffer lock with a exported dmabuf fd through fcntl system call.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodma-buf: add lock callback for fcntl system call.
Inki Dae [Fri, 12 Jul 2013 05:01:02 +0000 (14:01 +0900)]
dma-buf: add lock callback for fcntl system call.

This patch adds lock callback to dma buf file operations,
and this callback will be called by fcntl system call.

With this patch, fcntl system call can be used for buffer
synchronization between CPU and CPU, and CPU and DMA in user mode.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agodmabuf-sync: add cache operation feature
Inki Dae [Wed, 17 Jul 2013 05:43:43 +0000 (14:43 +0900)]
dmabuf-sync: add cache operation feature

With this patch, all cache operations will be done in kernel side
instead of user side.

P.S. basically, not only user shouldn't need to request cache operation
to kernel but also kernel should't need such things. However, we would
have performance overhead by unnecessary cache operations if we conform
with mainline style: cache sync just before memory ownership moves from
CPU to DMA, and just after memory ownership moves from DMA to CPU.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodmabuf-sync: add buffer synchronization framework
Inki Dae [Wed, 17 Jul 2013 05:40:48 +0000 (14:40 +0900)]
dmabuf-sync: add buffer synchronization framework

This patch adds a buffer synchronization framework based on DMA BUF[1]
and and based on ww-mutexes[2] for lock mechanism.

The purpose of this framework is to provide not only buffer access control
to CPU and DMA but also easy-to-use interfaces for device drivers and
user application. This framework can be used for all dma devices using
system memory as dma buffer, especially for most ARM based SoCs.

Changelog v5:
- Rmove a dependence on reservation_object: the reservation_object is used
  to hook up to ttm and dma-buf for easy sharing of reservations across
  devices. However, the dmabuf sync can be used for all dma devices; v4l2
  and drm based drivers, so doesn't need the reservation_object anymore.
  With regared to this, it adds 'void *sync' to dma_buf structure.
- All patches are rebased on mainline, Linux v3.10.

Changelog v4:
- Add user side interface for buffer synchronization mechanism and update
  descriptions related to the user side interface.

Changelog v3:
- remove cache operation relevant codes and update document file.

Changelog v2:
- use atomic_add_unless to avoid potential bug.
- add a macro for checking valid access type.
- code clean.

The mechanism of this framework has the following steps,
    1. Register dmabufs to a sync object - A task gets a new sync object and
    can add one or more dmabufs that the task wants to access.
    This registering should be performed when a device context or an event
    context such as a page flip event is created or before CPU accesses a shared
    buffer.

dma_buf_sync_get(a sync object, a dmabuf);

    2. Lock a sync object - A task tries to lock all dmabufs added in its own
    sync object. Basically, the lock mechanism uses ww-mutex[1] to avoid dead
    lock issue and for race condition between CPU and CPU, CPU and DMA, and DMA
    and DMA. Taking a lock means that others cannot access all locked dmabufs
    until the task that locked the corresponding dmabufs, unlocks all the locked
    dmabufs.
    This locking should be performed before DMA or CPU accesses these dmabufs.

dma_buf_sync_lock(a sync object);

    3. Unlock a sync object - The task unlocks all dmabufs added in its own sync
    object. The unlock means that the DMA or CPU accesses to the dmabufs have
    been completed so that others may access them.
    This unlocking should be performed after DMA or CPU has completed accesses
    to the dmabufs.

dma_buf_sync_unlock(a sync object);

    4. Unregister one or all dmabufs from a sync object - A task unregisters
    the given dmabufs from the sync object. This means that the task dosen't
    want to lock the dmabufs.
    The unregistering should be performed after DMA or CPU has completed
    accesses to the dmabufs or when dma_buf_sync_lock() is failed.

dma_buf_sync_put(a sync object, a dmabuf);
dma_buf_sync_put_all(a sync object);

    The described steps may be summarized as:
get -> lock -> CPU or DMA access to a buffer/s -> unlock -> put

This framework includes the following two features.
    1. read (shared) and write (exclusive) locks - A task is required to declare
    the access type when the task tries to register a dmabuf;
    READ, WRITE, READ DMA, or WRITE DMA.

    The below is example codes,
struct dmabuf_sync *sync;

sync = dmabuf_sync_init(NULL, "test sync");

dmabuf_sync_get(sync, dmabuf, DMA_BUF_ACCESS_R);
...

And the below can be used as access types:
DMA_BUF_ACCESS_R - CPU will access a buffer for read.
DMA_BUF_ACCESS_W - CPU will access a buffer for read or write.
DMA_BUF_ACCESS_DMA_R - DMA will access a buffer for read
DMA_BUF_ACCESS_DMA_W - DMA will access a buffer for read or
write.

    2. Mandatory resource releasing - a task cannot hold a lock indefinitely.
    A task may never try to unlock a buffer after taking a lock to the buffer.
    In this case, a timer handler to the corresponding sync object is called
    in five (default) seconds and then the timed-out buffer is unlocked by work
    queue handler to avoid lockups and to enforce resources of the buffer.

The below is how to use interfaces for device driver:
1. Allocate and Initialize a sync object:
struct dmabuf_sync *sync;

sync = dmabuf_sync_init(NULL, "test sync");
...

2. Add a dmabuf to the sync object when setting up dma buffer relevant
   registers:
dmabuf_sync_get(sync, dmabuf, DMA_BUF_ACCESS_READ);
...

3. Lock all dmabufs of the sync object before DMA or CPU accesses
   the dmabufs:
dmabuf_sync_lock(sync);
...

4. Now CPU or DMA can access all dmabufs locked in step 3.

5. Unlock all dmabufs added in a sync object after DMA or CPU access
   to these dmabufs is completed:
dmabuf_sync_unlock(sync);

   And call the following functions to release all resources,
dmabuf_sync_put_all(sync);
dmabuf_sync_fini(sync);

You can refer to actual example codes:
"drm/exynos: add dmabuf sync support for g2d driver" and
"drm/exynos: add dmabuf sync support for kms framework" from
https://git.kernel.org/cgit/linux/kernel/git/daeinki/
drm-exynos.git/log/?h=dmabuf-sync

And this framework includes fcntl system call[3] as interfaces exported
to user. As you know, user sees a buffer object as a dma-buf file descriptor.
So fcntl() call with the file descriptor means to lock some buffer region being
managed by the dma-buf object.

The below is how to use interfaces for user application:
struct flock filelock;

1. Lock a dma buf:
filelock.l_type = F_WRLCK or F_RDLCK;

/* lock entire region to the dma buf. */
filelock.lwhence = SEEK_CUR;
filelock.l_start = 0;
filelock.l_len = 0;

fcntl(dmabuf fd, F_SETLKW or F_SETLK, &filelock);
...
CPU access to the dma buf

2. Unlock a dma buf:
filelock.l_type = F_UNLCK;

fcntl(dmabuf fd, F_SETLKW or F_SETLK, &filelock);

close(dmabuf fd) call would also unlock the dma buf. And for more
detail, please refer to [3]

References:
[1] http://lwn.net/Articles/470339/
[2] https://patchwork.kernel.org/patch/2625361/
[3] http://linux.die.net/man/2/fcntl

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agomutex: Add w/w mutex slowpath debugging
Daniel Vetter [Thu, 20 Jun 2013 11:31:17 +0000 (13:31 +0200)]
mutex: Add w/w mutex slowpath debugging

Injects EDEADLK conditions at pseudo-random interval, with
exponential backoff up to UINT_MAX (to ensure that every lock
operation still completes in a reasonable time).

This way we can test the wound slowpath even for ww mutex users
where contention is never expected, and the ww deadlock
avoidance algorithm is only needed for correctness against
malicious userspace. An example would be protecting kernel
modesetting properties, which thanks to single-threaded X isn't
really expected to contend, ever.

I've looked into using the CONFIG_FAULT_INJECTION
infrastructure, but decided against it for two reasons:

- EDEADLK handling is mandatory for ww mutex users and should
  never affect the outcome of a syscall. This is in contrast to -ENOMEM
  injection. So fine configurability isn't required.

- The fault injection framework only allows to set a simple
  probability for failure. Now the probability that a ww mutex acquire
  stage with N locks will never complete (due to too many injected
  EDEADLK backoffs) is zero. But the expected number of ww_mutex_lock
  operations for the completely uncontended case would be O(exp(N)).
  The per-acuiqire ctx exponential backoff solution choosen here only
  results in O(log N) overhead due to injection and so O(log N * N)
  lock operations. This way we can fail with high probability (and so
  have good test coverage even for fancy backoff and lock acquisition
  paths) without running into patalogical cases.

Note that EDEADLK will only ever be injected when we managed to
acquire the lock. This prevents any behaviour changes for users
which rely on the EALREADY semantics.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: rostedt@goodmis.org
Cc: daniel@ffwll.ch
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20130620113117.4001.21681.stgit@patser
Signed-off-by: Ingo Molnar <mingo@kernel.org>
9 years agomutex: Add support for wound/wait style locks
Maarten Lankhorst [Mon, 24 Jun 2013 08:30:04 +0000 (10:30 +0200)]
mutex: Add support for wound/wait style locks

Wound/wait mutexes are used when other multiple lock
acquisitions of a similar type can be done in an arbitrary
order. The deadlock handling used here is called wait/wound in
the RDBMS literature: The older tasks waits until it can acquire
the contended lock. The younger tasks needs to back off and drop
all the locks it is currently holding, i.e. the younger task is
wounded.

For full documentation please read Documentation/ww-mutex-design.txt.

References: https://lwn.net/Articles/548909/
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: rostedt@goodmis.org
Cc: daniel@ffwll.ch
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/51C8038C.9000106@canonical.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
9 years agoarch: Make __mutex_fastpath_lock_retval return whether fastpath succeeded or not
Maarten Lankhorst [Thu, 20 Jun 2013 11:31:05 +0000 (13:31 +0200)]
arch: Make __mutex_fastpath_lock_retval return whether fastpath succeeded or not

This will allow me to call functions that have multiple
arguments if fastpath fails. This is required to support ticket
mutexes, because they need to be able to pass an extra argument
to the fail function.

Originally I duplicated the functions, by adding
__mutex_fastpath_lock_retval_arg. This ended up being just a
duplication of the existing function, so a way to test if
fastpath was called ended up being better.

This also cleaned up the reservation mutex patch some by being
able to call an atomic_set instead of atomic_xchg, and making it
easier to detect if the wrong unlock function was previously
used.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: robclark@gmail.com
Cc: rostedt@goodmis.org
Cc: daniel@ffwll.ch
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20130620113105.4001.83929.stgit@patser
Signed-off-by: Ingo Molnar <mingo@kernel.org>
9 years agoARM: DTS: update device tree for for charger_manager.
Jonghwa Lee [Tue, 16 Jul 2013 08:58:14 +0000 (17:58 +0900)]
ARM: DTS: update device tree for for charger_manager.

Set supply regulator for charger manager.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoARM: config: Update tizen_defconfig.
Jonghwa Lee [Tue, 16 Jul 2013 08:56:59 +0000 (17:56 +0900)]
ARM: config: Update tizen_defconfig.

Enable CONFIG_CHARGER_MANAGER, CONFIG_EXTCON

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agopower: charger-manager: Fix a bug when it unregisters notifier block of extcon.
Jonghwa Lee [Tue, 16 Jul 2013 08:22:29 +0000 (17:22 +0900)]
power: charger-manager: Fix a bug when it unregisters notifier block of extcon.

This patch prevents NULL pointer error cauesed by unregistering unregistered
exton notifier block. At the probing time of charger manager, it tries to
remove extcon notifier block when it fails to initialize them. It has to be
applied for only registered one. Otherwise, it'd make kernel panic. To make it
work right, it checks extcon_specific_cable_nb's extcon_dev node. If extcon
cable notifier block was registered successfully, it has proper extcon_dev
pointer if not so it has NULL pointer.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agopower: charger-manager: regulator_get() never returns NULL.
Jonghwa Lee [Tue, 16 Jul 2013 08:19:13 +0000 (17:19 +0900)]
power: charger-manager: regulator_get() never returns NULL.

This patch fixes return value checking of regulator_get() in charger-manager
driver. The API, regulator_get(), returns ERR_PTR() when it fails to get
regulator with given name, not NULL.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agocharger_manager: Workaround for supporting platform data without DT parsing.
Jonghwa Lee [Mon, 10 Jun 2013 07:01:24 +0000 (16:01 +0900)]
charger_manager: Workaround for supporting platform data without DT parsing.

All data will be move into DT later.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoARM: EXYNOS: firmware: Surround l2x0 ops with an ifdef
Tomasz Figa [Wed, 5 Jun 2013 15:53:37 +0000 (17:53 +0200)]
ARM: EXYNOS: firmware: Surround l2x0 ops with an ifdef

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: EXYNOS: pm: Add support for firmware-based L2X0 resume
Tomasz Figa [Wed, 5 Jun 2013 15:40:11 +0000 (17:40 +0200)]
ARM: EXYNOS: pm: Add support for firmware-based L2X0 resume

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: EXYNOS: Move L2X0 cache resume to SoC PM code
Tomasz Figa [Wed, 5 Jun 2013 15:39:33 +0000 (17:39 +0200)]
ARM: EXYNOS: Move L2X0 cache resume to SoC PM code

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: EXYNOS: firmware: Implement l2x0_resume operation
Tomasz Figa [Wed, 5 Jun 2013 15:38:51 +0000 (17:38 +0200)]
ARM: EXYNOS: firmware: Implement l2x0_resume operation

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: firmware: Add L2X0 resume operation
Tomasz Figa [Wed, 5 Jun 2013 15:38:17 +0000 (17:38 +0200)]
ARM: firmware: Add L2X0 resume operation

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agotty: serial: samsung: Remove useless checks in suspend/resume callbacks
Tomasz Figa [Wed, 8 May 2013 16:30:30 +0000 (18:30 +0200)]
tty: serial: samsung: Remove useless checks in suspend/resume callbacks

Since uart_port struct exists through whole driver lifetime, there is no
need to check if it is non-NULL in suspend/resume callbacks.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoclocksource: exynos_mct: Register sched_clock
Tomasz Figa [Wed, 8 May 2013 10:02:43 +0000 (12:02 +0200)]
clocksource: exynos_mct: Register sched_clock

This patch adds sched_clock registration to Exynos MCT driver to
improve scheduler precision by providing a high resolution clock source
for scheduling purposes.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Conflicts:
drivers/clocksource/exynos_mct.c

9 years agoARM: dts: exynos4412-slp_pq: Add regulator states in mem mode
Tomasz Figa [Wed, 24 Apr 2013 17:02:29 +0000 (19:02 +0200)]
ARM: dts: exynos4412-slp_pq: Add regulator states in mem mode

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoregulator: max77686: Fix suspend-mode settings of regulators
Tomasz Figa [Tue, 30 Apr 2013 15:38:19 +0000 (17:38 +0200)]
regulator: max77686: Fix suspend-mode settings of regulators

LDO20, LDO21, LDO22, BUCK8 and BUCK9 regulators provide external pins
for enable control in addition to I2C control, which is usually used to
control regulator states in suspend.

BUCK5-BUCK7 do not provide any suspend-mode control.

This patch modifies the driver to account for these factors, making it
program sleep mode states of regulators correctly.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Conflicts:
drivers/regulator/max77686.c

9 years agoregulator: max77686: Add set_suspend_enable callback for buck regulators
Tomasz Figa [Thu, 25 Apr 2013 13:47:59 +0000 (15:47 +0200)]
regulator: max77686: Add set_suspend_enable callback for buck regulators

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoregulator: of: Parse regulator state in mem mode from DT
Tomasz Figa [Wed, 24 Apr 2013 17:01:42 +0000 (19:01 +0200)]
regulator: of: Parse regulator state in mem mode from DT

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoregulator: Handle suspend and resume of regulators
Tomasz Figa [Wed, 24 Apr 2013 16:58:06 +0000 (18:58 +0200)]
regulator: Handle suspend and resume of regulators

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: dts: exynos4412-slp_pq: Add sleep mode pin configuration
Tomasz Figa [Thu, 11 Apr 2013 14:52:42 +0000 (16:52 +0200)]
ARM: dts: exynos4412-slp_pq: Add sleep mode pin configuration

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agopinctrl: samsung: Parse pin groups before calling pinctrl_register()
Tomasz Figa [Thu, 27 Jun 2013 15:41:48 +0000 (17:41 +0200)]
pinctrl: samsung: Parse pin groups before calling pinctrl_register()

Calling pinctrl_register() means that the driver is fully initialized
and might accept pinmux/pinconf requests, so pin groups must be parsed
before.

This patch fixes this problem by moving device tree parsing
before call to pinctrl_register().

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: EXYNOS: Add support for firmware-assisted suspend/resume
Tomasz Figa [Thu, 21 Mar 2013 17:48:45 +0000 (18:48 +0100)]
ARM: EXYNOS: Add support for firmware-assisted suspend/resume

This patch adds firmware ops related to system suspend/resume that
allows suspend/resume of systems with secure firmware.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoARM: EXYNOS: pm: Move call to flush_cache_all() before outer_flush_all()
Tomasz Figa [Wed, 26 Jun 2013 17:04:13 +0000 (19:04 +0200)]
ARM: EXYNOS: pm: Move call to flush_cache_all() before outer_flush_all()

Flushing L1 cache might cause data to be stored to L2 cache, so it is
more reasonable to flush L1 cache first and only then L2 cache.

This patch moves call to flush_cache_all() in exynos_cpu_suspend()
before outer_flush_all() to make sure that all data are flushed
correctly. In addition flushing is enabled for all Exynos SoCs to
prevent any data loss.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agoclk: samsung: exynos4: Do not disable ISP bus clocks
Tomasz Figa [Wed, 24 Apr 2013 17:02:54 +0000 (19:02 +0200)]
clk: samsung: exynos4: Do not disable ISP bus clocks

Some ISP bus clocks must be kept enabled when entering sleep mode,
otherwise the system hangs. This patch adds CLK_IGNORE_UNUSED flags to
those clocks to keep them ungated when FIMC IS driver is not present.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
9 years agotizen_defconfig update
Sylwester Nawrocki [Wed, 3 Jul 2013 16:18:13 +0000 (18:18 +0200)]
tizen_defconfig update

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
9 years agoARM: dts: exynos4412-redwood: Add device nodes for modem_if
Kamil Debski [Tue, 2 Jul 2013 15:24:10 +0000 (17:24 +0200)]
ARM: dts: exynos4412-redwood: Add device nodes for modem_if

Add device nodes for modem_if, also set HSIC regulator to always on.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agomodem_if: Add modem drivers to Kconfig and Makefile
Kamil Debski [Thu, 23 May 2013 10:03:23 +0000 (12:03 +0200)]
modem_if: Add modem drivers to Kconfig and Makefile

Add modem_if to Kconfig and Makefile to enable compilation.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agomodem_if: Change net device name choice mechanism
Kamil Debski [Tue, 2 Jul 2013 13:53:32 +0000 (15:53 +0200)]
modem_if: Change net device name choice mechanism

CONFIG_SLP is no longer used hence new method of net device names was
implemented.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
9 years agomodem_if: ifdef wake_lock support in the modem driver
Kamil Debski [Tue, 21 May 2013 14:54:10 +0000 (16:54 +0200)]
modem_if: ifdef wake_lock support in the modem driver

Wake_locks are not supported outside of Android so it is essential to
make their use optional.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>