linux-stable/tools/perf/arch
Nickhu ebd09753b5 nds32: Perf porting
This is the commit that porting the perf for nds32.

1.Raw event:
	The raw events start with 'r'.
		Usage:
			perf stat -e rXYZ ./app
			X: the index of performance counter.
			YZ: the index(convert to hexdecimal) of events

		Example:
			'perf stat -e r101 ./app' means the counter 1 will count the instruction
		event.

		The index of counter and events can be found in
		"Andes System Privilege Architecture Version 3 Manual".

Or you can perform the 'perf list' to find the symbolic name of raw events.

2.Perf mmap2:

	Fix unexpected perf mmap2() page fault

	When the mmap2() called by perf application,
	you will encounter such condition:"failed to write."
	With return value -EFAULT

	This is due to the page fault caused by "reading" buffer
	from the mapped legal address region to write to the descriptor.
	The page_fault handler will get a VM_FAULT_SIGBUS return value,
	which should not happens here.(Due to this is a read request.)

	You can refer to kernel/events/core.c:perf_mmap_fault(...)
	If "(vmf->pgoff && (vmf->flags & FAULT_FLAG_WRITE))" is evaluated
	as true, you will get VM_FAULT_SIGBUS as return value.

	However, this is not an write request. The flags which indicated
	why the page fault happens is wrong.

	Furthermore, NDS32 SPAv3 is not able to detect it is read or write.
	It only know  either it is instruction fetch or data access.

	Therefore, by removing the wrong flag assignment(actually, the hardware
	is not able to show the reason), we can fix this bug.

3.Perf multiple events map to same counter.

	When there are multiple events map to the same counter, the counter
	counts inaccurately. This is because each counter only counts one event
	in the same time.
	So when there are multiple events map to same counter, they have to take
	turns in each context.

	There are two solution:
	1. Print the error message when multiple events map to the same counter.
	But print the error message would let the program hang in loop. The ltp
	(linux test program) would be failed when the program hang in loop.

	2. Don't print the error message, the ltp would pass. But the user need to
	have the knowledge that don't count the events which map to the same
	counter, or the user will get the inaccurate results.

	We choose method 2 for the solution

Signed-off-by: Nickhu <nickhu@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
2018-11-06 18:01:40 +08:00
..
alpha perf tools: Add empty Build files for architectures lacking them 2015-08-06 16:24:15 -03:00
arm perf map: Remove map_type arg from map_groups__find() 2018-04-26 13:47:18 -03:00
arm64 perf arm64: Fix generate system call table failed with /tmp mounted with noexec 2018-10-19 11:56:57 -03:00
mips perf tools: Add empty Build files for architectures lacking them 2015-08-06 16:24:15 -03:00
nds32 nds32: Perf porting 2018-11-06 18:01:40 +08:00
parisc perf tools: Add empty Build files for architectures lacking them 2015-08-06 16:24:15 -03:00
powerpc Merge remote-tracking branch 'remotes/powerpc/topic/ppc-kvm' into kvm-ppc-next 2018-10-09 16:13:20 +11:00
s390 perf annotate: Handle arm64 move instructions 2018-08-30 15:52:25 -03:00
sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sparc perf jitdump: Add Sparc support. 2018-10-18 11:16:38 -03:00
x86 perf tests: Add breakpoint modify tests 2018-08-30 14:49:22 -03:00
xtensa License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Build perf tools: Fix build with ARCH=x86_64 2017-06-14 15:44:29 -03:00
common.c perf annotate: Move objdump_path to struct annotation_options 2018-06-04 10:28:53 -03:00
common.h perf annotate: Move objdump_path to struct annotation_options 2018-06-04 10:28:53 -03:00