aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-05-29 06:52:16 -0400
committerTakashi Iwai <tiwai@suse.de>2013-05-29 06:52:16 -0400
commit8a90bb5116889e98008fbc8178fc2a77bb51df4a (patch)
tree210b6755c9ae2d0d66a79f8696469ab50b7621ad /tools
parentd47333ddb234dbc661ab2a4fe019758bd33ba33b (diff)
parent1ab9ecc24819a8cf8ee982aaf6fb83298f094b0d (diff)
Merge tag 'asoc-v3.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v3.10 A series of driver specific updates, none particularly critical, plus one fix to the compressed API code to handle capture streams properly which is very safe for mainline as there's no current users.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/perf/scripts/python/net_dropmonitor.py39
-rw-r--r--tools/testing/selftests/Makefile1
-rw-r--r--tools/testing/selftests/soft-dirty/Makefile10
-rw-r--r--tools/testing/selftests/soft-dirty/soft-dirty.c114
4 files changed, 21 insertions, 143 deletions
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py
index a4ffc9500023..b5740599aabd 100755
--- a/tools/perf/scripts/python/net_dropmonitor.py
+++ b/tools/perf/scripts/python/net_dropmonitor.py
@@ -15,35 +15,38 @@ kallsyms = []
15 15
16def get_kallsyms_table(): 16def get_kallsyms_table():
17 global kallsyms 17 global kallsyms
18
18 try: 19 try:
19 f = open("/proc/kallsyms", "r") 20 f = open("/proc/kallsyms", "r")
20 linecount = 0
21 for line in f:
22 linecount = linecount+1
23 f.seek(0)
24 except: 21 except:
25 return 22 return
26 23
27
28 j = 0
29 for line in f: 24 for line in f:
30 loc = int(line.split()[0], 16) 25 loc = int(line.split()[0], 16)
31 name = line.split()[2] 26 name = line.split()[2]
32 j = j +1 27 kallsyms.append((loc, name))
33 if ((j % 100) == 0):
34 print "\r" + str(j) + "/" + str(linecount),
35 kallsyms.append({ 'loc': loc, 'name' : name})
36
37 print "\r" + str(j) + "/" + str(linecount)
38 kallsyms.sort() 28 kallsyms.sort()
39 return
40 29
41def get_sym(sloc): 30def get_sym(sloc):
42 loc = int(sloc) 31 loc = int(sloc)
43 for i in kallsyms: 32
44 if (i['loc'] >= loc): 33 # Invariant: kallsyms[i][0] <= loc for all 0 <= i <= start
45 return (i['name'], i['loc']-loc) 34 # kallsyms[i][0] > loc for all end <= i < len(kallsyms)
46 return (None, 0) 35 start, end = -1, len(kallsyms)
36 while end != start + 1:
37 pivot = (start + end) // 2
38 if loc < kallsyms[pivot][0]:
39 end = pivot
40 else:
41 start = pivot
42
43 # Now (start == -1 or kallsyms[start][0] <= loc)
44 # and (start == len(kallsyms) - 1 or loc < kallsyms[start + 1][0])
45 if start >= 0:
46 symloc, name = kallsyms[start]
47 return (name, loc - symloc)
48 else:
49 return (None, 0)
47 50
48def print_drop_table(): 51def print_drop_table():
49 print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT") 52 print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT")
@@ -64,7 +67,7 @@ def trace_end():
64 67
65# called from perf, when it finds a correspoinding event 68# called from perf, when it finds a correspoinding event
66def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, 69def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm,
67 skbaddr, protocol, location): 70 skbaddr, location, protocol):
68 slocation = str(location) 71 slocation = str(location)
69 try: 72 try:
70 drop_log[slocation] = drop_log[slocation] + 1 73 drop_log[slocation] = drop_log[slocation] + 1
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index d4abc59ce1d9..0a63658065f0 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -6,7 +6,6 @@ TARGETS += memory-hotplug
6TARGETS += mqueue 6TARGETS += mqueue
7TARGETS += net 7TARGETS += net
8TARGETS += ptrace 8TARGETS += ptrace
9TARGETS += soft-dirty
10TARGETS += vm 9TARGETS += vm
11 10
12all: 11all:
diff --git a/tools/testing/selftests/soft-dirty/Makefile b/tools/testing/selftests/soft-dirty/Makefile
deleted file mode 100644
index a9cdc823d6e0..000000000000
--- a/tools/testing/selftests/soft-dirty/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1CFLAGS += -iquote../../../../include/uapi -Wall
2soft-dirty: soft-dirty.c
3
4all: soft-dirty
5
6clean:
7 rm -f soft-dirty
8
9run_tests: all
10 @./soft-dirty || echo "soft-dirty selftests: [FAIL]"
diff --git a/tools/testing/selftests/soft-dirty/soft-dirty.c b/tools/testing/selftests/soft-dirty/soft-dirty.c
deleted file mode 100644
index aba4f87f87f0..000000000000
--- a/tools/testing/selftests/soft-dirty/soft-dirty.c
+++ /dev/null
@@ -1,114 +0,0 @@
1#include <stdlib.h>
2#include <stdio.h>
3#include <sys/mman.h>
4#include <unistd.h>
5#include <fcntl.h>
6#include <sys/types.h>
7
8typedef unsigned long long u64;
9
10#define PME_PRESENT (1ULL << 63)
11#define PME_SOFT_DIRTY (1Ull << 55)
12
13#define PAGES_TO_TEST 3
14#ifndef PAGE_SIZE
15#define PAGE_SIZE 4096
16#endif
17
18static void get_pagemap2(char *mem, u64 *map)
19{
20 int fd;
21
22 fd = open("/proc/self/pagemap2", O_RDONLY);
23 if (fd < 0) {
24 perror("Can't open pagemap2");
25 exit(1);
26 }
27
28 lseek(fd, (unsigned long)mem / PAGE_SIZE * sizeof(u64), SEEK_SET);
29 read(fd, map, sizeof(u64) * PAGES_TO_TEST);
30 close(fd);
31}
32
33static inline char map_p(u64 map)
34{
35 return map & PME_PRESENT ? 'p' : '-';
36}
37
38static inline char map_sd(u64 map)
39{
40 return map & PME_SOFT_DIRTY ? 'd' : '-';
41}
42
43static int check_pte(int step, int page, u64 *map, u64 want)
44{
45 if ((map[page] & want) != want) {
46 printf("Step %d Page %d has %c%c, want %c%c\n",
47 step, page,
48 map_p(map[page]), map_sd(map[page]),
49 map_p(want), map_sd(want));
50 return 1;
51 }
52
53 return 0;
54}
55
56static void clear_refs(void)
57{
58 int fd;
59 char *v = "4";
60
61 fd = open("/proc/self/clear_refs", O_WRONLY);
62 if (write(fd, v, 3) < 3) {
63 perror("Can't clear soft-dirty bit");
64 exit(1);
65 }
66 close(fd);
67}
68
69int main(void)
70{
71 char *mem, x;
72 u64 map[PAGES_TO_TEST];
73
74 mem = mmap(NULL, PAGES_TO_TEST * PAGE_SIZE,
75 PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, 0, 0);
76
77 x = mem[0];
78 mem[2 * PAGE_SIZE] = 'c';
79 get_pagemap2(mem, map);
80
81 if (check_pte(1, 0, map, PME_PRESENT))
82 return 1;
83 if (check_pte(1, 1, map, 0))
84 return 1;
85 if (check_pte(1, 2, map, PME_PRESENT | PME_SOFT_DIRTY))
86 return 1;
87
88 clear_refs();
89 get_pagemap2(mem, map);
90
91 if (check_pte(2, 0, map, PME_PRESENT))
92 return 1;
93 if (check_pte(2, 1, map, 0))
94 return 1;
95 if (check_pte(2, 2, map, PME_PRESENT))
96 return 1;
97
98 mem[0] = 'a';
99 mem[PAGE_SIZE] = 'b';
100 x = mem[2 * PAGE_SIZE];
101 get_pagemap2(mem, map);
102
103 if (check_pte(3, 0, map, PME_PRESENT | PME_SOFT_DIRTY))
104 return 1;
105 if (check_pte(3, 1, map, PME_PRESENT | PME_SOFT_DIRTY))
106 return 1;
107 if (check_pte(3, 2, map, PME_PRESENT))
108 return 1;
109
110 (void)x; /* gcc warn */
111
112 printf("PASS\n");
113 return 0;
114}