diff options
Diffstat (limited to 'tools')
25 files changed, 399 insertions, 67 deletions
diff --git a/tools/include/uapi/linux/bpf_perf_event.h b/tools/include/uapi/linux/bpf_perf_event.h new file mode 100644 index 000000000000..067427259820 --- /dev/null +++ b/tools/include/uapi/linux/bpf_perf_event.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* Copyright (c) 2016 Facebook | ||
| 2 | * | ||
| 3 | * This program is free software; you can redistribute it and/or | ||
| 4 | * modify it under the terms of version 2 of the GNU General Public | ||
| 5 | * License as published by the Free Software Foundation. | ||
| 6 | */ | ||
| 7 | #ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__ | ||
| 8 | #define _UAPI__LINUX_BPF_PERF_EVENT_H__ | ||
| 9 | |||
| 10 | #include <linux/types.h> | ||
| 11 | #include <linux/ptrace.h> | ||
| 12 | |||
| 13 | struct bpf_perf_event_data { | ||
| 14 | struct pt_regs regs; | ||
| 15 | __u64 sample_period; | ||
| 16 | }; | ||
| 17 | |||
| 18 | #endif /* _UAPI__LINUX_BPF_PERF_EVENT_H__ */ | ||
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index 11c8d9bc762e..5d19fdf80292 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c | |||
| @@ -1387,7 +1387,7 @@ static bool pci_data_iowrite(u16 port, u32 mask, u32 val) | |||
| 1387 | /* Allow writing to any other BAR, or expansion ROM */ | 1387 | /* Allow writing to any other BAR, or expansion ROM */ |
| 1388 | iowrite(portoff, val, mask, &d->config_words[reg]); | 1388 | iowrite(portoff, val, mask, &d->config_words[reg]); |
| 1389 | return true; | 1389 | return true; |
| 1390 | /* We let them overide latency timer and cacheline size */ | 1390 | /* We let them override latency timer and cacheline size */ |
| 1391 | } else if (&d->config_words[reg] == (void *)&d->config.cacheline_size) { | 1391 | } else if (&d->config_words[reg] == (void *)&d->config.cacheline_size) { |
| 1392 | /* Only let them change the first two fields. */ | 1392 | /* Only let them change the first two fields. */ |
| 1393 | if (mask == 0xFFFFFFFF) | 1393 | if (mask == 0xFFFFFFFF) |
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index e2efddf10231..1f5300e56b44 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile | |||
| @@ -132,7 +132,7 @@ else | |||
| 132 | Q = @ | 132 | Q = @ |
| 133 | endif | 133 | endif |
| 134 | 134 | ||
| 135 | # Disable command line variables (CFLAGS) overide from top | 135 | # Disable command line variables (CFLAGS) override from top |
| 136 | # level Makefile (perf), otherwise build Makefile will get | 136 | # level Makefile (perf), otherwise build Makefile will get |
| 137 | # the same command line setup. | 137 | # the same command line setup. |
| 138 | MAKEOVERRIDES= | 138 | MAKEOVERRIDES= |
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index 47076b15eebe..9b8555ea3459 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
| @@ -135,7 +135,7 @@ else | |||
| 135 | Q = @ | 135 | Q = @ |
| 136 | endif | 136 | endif |
| 137 | 137 | ||
| 138 | # Disable command line variables (CFLAGS) overide from top | 138 | # Disable command line variables (CFLAGS) override from top |
| 139 | # level Makefile (perf), otherwise build Makefile will get | 139 | # level Makefile (perf), otherwise build Makefile will get |
| 140 | # the same command line setup. | 140 | # the same command line setup. |
| 141 | MAKEOVERRIDES= | 141 | MAKEOVERRIDES= |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 66342804161c..0c03538df74c 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
| @@ -140,7 +140,7 @@ struct pevent_plugin_option { | |||
| 140 | * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { | 140 | * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { |
| 141 | * { | 141 | * { |
| 142 | * .name = "option-name", | 142 | * .name = "option-name", |
| 143 | * .plugin_alias = "overide-file-name", (optional) | 143 | * .plugin_alias = "override-file-name", (optional) |
| 144 | * .description = "description of option to show users", | 144 | * .description = "description of option to show users", |
| 145 | * }, | 145 | * }, |
| 146 | * { | 146 | * { |
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 4cfdbb5b6967..066086dd59a8 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c | |||
| @@ -805,11 +805,20 @@ static struct rela *find_switch_table(struct objtool_file *file, | |||
| 805 | insn->jump_dest->offset > orig_insn->offset)) | 805 | insn->jump_dest->offset > orig_insn->offset)) |
| 806 | break; | 806 | break; |
| 807 | 807 | ||
| 808 | /* look for a relocation which references .rodata */ | ||
| 808 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, | 809 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, |
| 809 | insn->len); | 810 | insn->len); |
| 810 | if (text_rela && text_rela->sym == file->rodata->sym) | 811 | if (!text_rela || text_rela->sym != file->rodata->sym) |
| 811 | return find_rela_by_dest(file->rodata, | 812 | continue; |
| 812 | text_rela->addend); | 813 | |
| 814 | /* | ||
| 815 | * Make sure the .rodata address isn't associated with a | ||
| 816 | * symbol. gcc jump tables are anonymous data. | ||
| 817 | */ | ||
| 818 | if (find_symbol_containing(file->rodata, text_rela->addend)) | ||
| 819 | continue; | ||
| 820 | |||
| 821 | return find_rela_by_dest(file->rodata, text_rela->addend); | ||
| 813 | } | 822 | } |
| 814 | 823 | ||
| 815 | return NULL; | 824 | return NULL; |
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 0d7983ac63ef..d897702ce742 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c | |||
| @@ -85,6 +85,18 @@ struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset) | |||
| 85 | return NULL; | 85 | return NULL; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | struct symbol *find_symbol_containing(struct section *sec, unsigned long offset) | ||
| 89 | { | ||
| 90 | struct symbol *sym; | ||
| 91 | |||
| 92 | list_for_each_entry(sym, &sec->symbol_list, list) | ||
| 93 | if (sym->type != STT_SECTION && | ||
| 94 | offset >= sym->offset && offset < sym->offset + sym->len) | ||
| 95 | return sym; | ||
| 96 | |||
| 97 | return NULL; | ||
| 98 | } | ||
| 99 | |||
| 88 | struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset, | 100 | struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset, |
| 89 | unsigned int len) | 101 | unsigned int len) |
| 90 | { | 102 | { |
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index aa1ff6596684..731973e1a3f5 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h | |||
| @@ -79,6 +79,7 @@ struct elf { | |||
| 79 | struct elf *elf_open(const char *name); | 79 | struct elf *elf_open(const char *name); |
| 80 | struct section *find_section_by_name(struct elf *elf, const char *name); | 80 | struct section *find_section_by_name(struct elf *elf, const char *name); |
| 81 | struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset); | 81 | struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset); |
| 82 | struct symbol *find_symbol_containing(struct section *sec, unsigned long offset); | ||
| 82 | struct rela *find_rela_by_dest(struct section *sec, unsigned long offset); | 83 | struct rela *find_rela_by_dest(struct section *sec, unsigned long offset); |
| 83 | struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset, | 84 | struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset, |
| 84 | unsigned int len); | 85 | unsigned int len); |
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c index 55b6250350d7..459352a9978f 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #error Instruction buffer size too small | 31 | #error Instruction buffer size too small |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | /* Based on branch_type() from perf_event_intel_lbr.c */ | 34 | /* Based on branch_type() from arch/x86/events/intel/lbr.c */ |
| 35 | static void intel_pt_insn_decoder(struct insn *insn, | 35 | static void intel_pt_insn_decoder(struct insn *insn, |
| 36 | struct intel_pt_insn *intel_pt_insn) | 36 | struct intel_pt_insn *intel_pt_insn) |
| 37 | { | 37 | { |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 6e4eb2fc2d1e..0c8b61f8398e 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -1880,6 +1880,7 @@ sub get_grub_index { | |||
| 1880 | sub wait_for_input | 1880 | sub wait_for_input |
| 1881 | { | 1881 | { |
| 1882 | my ($fp, $time) = @_; | 1882 | my ($fp, $time) = @_; |
| 1883 | my $start_time; | ||
| 1883 | my $rin; | 1884 | my $rin; |
| 1884 | my $rout; | 1885 | my $rout; |
| 1885 | my $nr; | 1886 | my $nr; |
| @@ -1895,17 +1896,22 @@ sub wait_for_input | |||
| 1895 | vec($rin, fileno($fp), 1) = 1; | 1896 | vec($rin, fileno($fp), 1) = 1; |
| 1896 | vec($rin, fileno(\*STDIN), 1) = 1; | 1897 | vec($rin, fileno(\*STDIN), 1) = 1; |
| 1897 | 1898 | ||
| 1899 | $start_time = time; | ||
| 1900 | |||
| 1898 | while (1) { | 1901 | while (1) { |
| 1899 | $nr = select($rout=$rin, undef, undef, $time); | 1902 | $nr = select($rout=$rin, undef, undef, $time); |
| 1900 | 1903 | ||
| 1901 | if ($nr <= 0) { | 1904 | last if ($nr <= 0); |
| 1902 | return undef; | ||
| 1903 | } | ||
| 1904 | 1905 | ||
| 1905 | # copy data from stdin to the console | 1906 | # copy data from stdin to the console |
| 1906 | if (vec($rout, fileno(\*STDIN), 1) == 1) { | 1907 | if (vec($rout, fileno(\*STDIN), 1) == 1) { |
| 1907 | sysread(\*STDIN, $buf, 1000); | 1908 | $nr = sysread(\*STDIN, $buf, 1000); |
| 1908 | syswrite($fp, $buf, 1000); | 1909 | syswrite($fp, $buf, $nr) if ($nr > 0); |
| 1910 | } | ||
| 1911 | |||
| 1912 | # The timeout is based on time waiting for the fp data | ||
| 1913 | if (vec($rout, fileno($fp), 1) != 1) { | ||
| 1914 | last if (defined($time) && (time - $start_time > $time)); | ||
| 1909 | next; | 1915 | next; |
| 1910 | } | 1916 | } |
| 1911 | 1917 | ||
| @@ -1917,12 +1923,11 @@ sub wait_for_input | |||
| 1917 | last if ($ch eq "\n"); | 1923 | last if ($ch eq "\n"); |
| 1918 | } | 1924 | } |
| 1919 | 1925 | ||
| 1920 | if (!length($line)) { | 1926 | last if (!length($line)); |
| 1921 | return undef; | ||
| 1922 | } | ||
| 1923 | 1927 | ||
| 1924 | return $line; | 1928 | return $line; |
| 1925 | } | 1929 | } |
| 1930 | return undef; | ||
| 1926 | } | 1931 | } |
| 1927 | 1932 | ||
| 1928 | sub reboot_to { | 1933 | sub reboot_to { |
diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index f11315bedefc..6a9480c03cbd 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address | 2 | CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address |
| 3 | LDFLAGS += -lpthread -lurcu | 3 | LDFLAGS += -fsanitize=address |
| 4 | LDLIBS+= -lpthread -lurcu | ||
| 4 | TARGETS = main idr-test multiorder | 5 | TARGETS = main idr-test multiorder |
| 5 | CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o | 6 | CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o |
| 6 | OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ | 7 | OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ |
| @@ -10,23 +11,25 @@ ifndef SHIFT | |||
| 10 | SHIFT=3 | 11 | SHIFT=3 |
| 11 | endif | 12 | endif |
| 12 | 13 | ||
| 14 | ifeq ($(BUILD), 32) | ||
| 15 | CFLAGS += -m32 | ||
| 16 | LDFLAGS += -m32 | ||
| 17 | endif | ||
| 18 | |||
| 13 | targets: mapshift $(TARGETS) | 19 | targets: mapshift $(TARGETS) |
| 14 | 20 | ||
| 15 | main: $(OFILES) | 21 | main: $(OFILES) |
| 16 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o main | ||
| 17 | 22 | ||
| 18 | idr-test: idr-test.o $(CORE_OFILES) | 23 | idr-test: idr-test.o $(CORE_OFILES) |
| 19 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o idr-test | ||
| 20 | 24 | ||
| 21 | multiorder: multiorder.o $(CORE_OFILES) | 25 | multiorder: multiorder.o $(CORE_OFILES) |
| 22 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o multiorder | ||
| 23 | 26 | ||
| 24 | clean: | 27 | clean: |
| 25 | $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h | 28 | $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h |
| 26 | 29 | ||
| 27 | vpath %.c ../../lib | 30 | vpath %.c ../../lib |
| 28 | 31 | ||
| 29 | $(OFILES): *.h */*.h generated/map-shift.h \ | 32 | $(OFILES): Makefile *.h */*.h generated/map-shift.h \ |
| 30 | ../../include/linux/*.h \ | 33 | ../../include/linux/*.h \ |
| 31 | ../../include/asm/*.h \ | 34 | ../../include/asm/*.h \ |
| 32 | ../../../include/linux/radix-tree.h \ | 35 | ../../../include/linux/radix-tree.h \ |
| @@ -41,7 +44,7 @@ idr.c: ../../../lib/idr.c | |||
| 41 | .PHONY: mapshift | 44 | .PHONY: mapshift |
| 42 | 45 | ||
| 43 | mapshift: | 46 | mapshift: |
| 44 | @if ! grep -qw $(SHIFT) generated/map-shift.h; then \ | 47 | @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ |
| 45 | echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \ | 48 | echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \ |
| 46 | generated/map-shift.h; \ | 49 | generated/map-shift.h; \ |
| 47 | fi | 50 | fi |
diff --git a/tools/testing/radix-tree/benchmark.c b/tools/testing/radix-tree/benchmark.c index 9b09ddfe462f..99c40f3ed133 100644 --- a/tools/testing/radix-tree/benchmark.c +++ b/tools/testing/radix-tree/benchmark.c | |||
| @@ -17,6 +17,9 @@ | |||
| 17 | #include <time.h> | 17 | #include <time.h> |
| 18 | #include "test.h" | 18 | #include "test.h" |
| 19 | 19 | ||
| 20 | #define for_each_index(i, base, order) \ | ||
| 21 | for (i = base; i < base + (1 << order); i++) | ||
| 22 | |||
| 20 | #define NSEC_PER_SEC 1000000000L | 23 | #define NSEC_PER_SEC 1000000000L |
| 21 | 24 | ||
| 22 | static long long benchmark_iter(struct radix_tree_root *root, bool tagged) | 25 | static long long benchmark_iter(struct radix_tree_root *root, bool tagged) |
| @@ -57,27 +60,176 @@ again: | |||
| 57 | return nsec; | 60 | return nsec; |
| 58 | } | 61 | } |
| 59 | 62 | ||
| 63 | static void benchmark_insert(struct radix_tree_root *root, | ||
| 64 | unsigned long size, unsigned long step, int order) | ||
| 65 | { | ||
| 66 | struct timespec start, finish; | ||
| 67 | unsigned long index; | ||
| 68 | long long nsec; | ||
| 69 | |||
| 70 | clock_gettime(CLOCK_MONOTONIC, &start); | ||
| 71 | |||
| 72 | for (index = 0 ; index < size ; index += step) | ||
| 73 | item_insert_order(root, index, order); | ||
| 74 | |||
| 75 | clock_gettime(CLOCK_MONOTONIC, &finish); | ||
| 76 | |||
| 77 | nsec = (finish.tv_sec - start.tv_sec) * NSEC_PER_SEC + | ||
| 78 | (finish.tv_nsec - start.tv_nsec); | ||
| 79 | |||
| 80 | printv(2, "Size: %8ld, step: %8ld, order: %d, insertion: %15lld ns\n", | ||
| 81 | size, step, order, nsec); | ||
| 82 | } | ||
| 83 | |||
| 84 | static void benchmark_tagging(struct radix_tree_root *root, | ||
| 85 | unsigned long size, unsigned long step, int order) | ||
| 86 | { | ||
| 87 | struct timespec start, finish; | ||
| 88 | unsigned long index; | ||
| 89 | long long nsec; | ||
| 90 | |||
| 91 | clock_gettime(CLOCK_MONOTONIC, &start); | ||
| 92 | |||
| 93 | for (index = 0 ; index < size ; index += step) | ||
| 94 | radix_tree_tag_set(root, index, 0); | ||
| 95 | |||
| 96 | clock_gettime(CLOCK_MONOTONIC, &finish); | ||
| 97 | |||
| 98 | nsec = (finish.tv_sec - start.tv_sec) * NSEC_PER_SEC + | ||
| 99 | (finish.tv_nsec - start.tv_nsec); | ||
| 100 | |||
| 101 | printv(2, "Size: %8ld, step: %8ld, order: %d, tagging: %17lld ns\n", | ||
| 102 | size, step, order, nsec); | ||
| 103 | } | ||
| 104 | |||
| 105 | static void benchmark_delete(struct radix_tree_root *root, | ||
| 106 | unsigned long size, unsigned long step, int order) | ||
| 107 | { | ||
| 108 | struct timespec start, finish; | ||
| 109 | unsigned long index, i; | ||
| 110 | long long nsec; | ||
| 111 | |||
| 112 | clock_gettime(CLOCK_MONOTONIC, &start); | ||
| 113 | |||
| 114 | for (index = 0 ; index < size ; index += step) | ||
| 115 | for_each_index(i, index, order) | ||
| 116 | item_delete(root, i); | ||
| 117 | |||
| 118 | clock_gettime(CLOCK_MONOTONIC, &finish); | ||
| 119 | |||
| 120 | nsec = (finish.tv_sec - start.tv_sec) * NSEC_PER_SEC + | ||
| 121 | (finish.tv_nsec - start.tv_nsec); | ||
| 122 | |||
| 123 | printv(2, "Size: %8ld, step: %8ld, order: %d, deletion: %16lld ns\n", | ||
| 124 | size, step, order, nsec); | ||
| 125 | } | ||
| 126 | |||
| 60 | static void benchmark_size(unsigned long size, unsigned long step, int order) | 127 | static void benchmark_size(unsigned long size, unsigned long step, int order) |
| 61 | { | 128 | { |
| 62 | RADIX_TREE(tree, GFP_KERNEL); | 129 | RADIX_TREE(tree, GFP_KERNEL); |
| 63 | long long normal, tagged; | 130 | long long normal, tagged; |
| 64 | unsigned long index; | ||
| 65 | 131 | ||
| 66 | for (index = 0 ; index < size ; index += step) { | 132 | benchmark_insert(&tree, size, step, order); |
| 67 | item_insert_order(&tree, index, order); | 133 | benchmark_tagging(&tree, size, step, order); |
| 68 | radix_tree_tag_set(&tree, index, 0); | ||
| 69 | } | ||
| 70 | 134 | ||
| 71 | tagged = benchmark_iter(&tree, true); | 135 | tagged = benchmark_iter(&tree, true); |
| 72 | normal = benchmark_iter(&tree, false); | 136 | normal = benchmark_iter(&tree, false); |
| 73 | 137 | ||
| 74 | printv(2, "Size %ld, step %6ld, order %d tagged %10lld ns, normal %10lld ns\n", | 138 | printv(2, "Size: %8ld, step: %8ld, order: %d, tagged iteration: %8lld ns\n", |
| 75 | size, step, order, tagged, normal); | 139 | size, step, order, tagged); |
| 140 | printv(2, "Size: %8ld, step: %8ld, order: %d, normal iteration: %8lld ns\n", | ||
| 141 | size, step, order, normal); | ||
| 142 | |||
| 143 | benchmark_delete(&tree, size, step, order); | ||
| 76 | 144 | ||
| 77 | item_kill_tree(&tree); | 145 | item_kill_tree(&tree); |
| 78 | rcu_barrier(); | 146 | rcu_barrier(); |
| 79 | } | 147 | } |
| 80 | 148 | ||
| 149 | static long long __benchmark_split(unsigned long index, | ||
| 150 | int old_order, int new_order) | ||
| 151 | { | ||
| 152 | struct timespec start, finish; | ||
| 153 | long long nsec; | ||
| 154 | RADIX_TREE(tree, GFP_ATOMIC); | ||
| 155 | |||
| 156 | item_insert_order(&tree, index, old_order); | ||
| 157 | |||
| 158 | clock_gettime(CLOCK_MONOTONIC, &start); | ||
| 159 | radix_tree_split(&tree, index, new_order); | ||
| 160 | clock_gettime(CLOCK_MONOTONIC, &finish); | ||
| 161 | nsec = (finish.tv_sec - start.tv_sec) * NSEC_PER_SEC + | ||
| 162 | (finish.tv_nsec - start.tv_nsec); | ||
| 163 | |||
| 164 | item_kill_tree(&tree); | ||
| 165 | |||
| 166 | return nsec; | ||
| 167 | |||
| 168 | } | ||
| 169 | |||
| 170 | static void benchmark_split(unsigned long size, unsigned long step) | ||
| 171 | { | ||
| 172 | int i, j, idx; | ||
| 173 | long long nsec = 0; | ||
| 174 | |||
| 175 | |||
| 176 | for (idx = 0; idx < size; idx += step) { | ||
| 177 | for (i = 3; i < 11; i++) { | ||
| 178 | for (j = 0; j < i; j++) { | ||
| 179 | nsec += __benchmark_split(idx, i, j); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 184 | printv(2, "Size %8ld, step %8ld, split time %10lld ns\n", | ||
| 185 | size, step, nsec); | ||
| 186 | |||
| 187 | } | ||
| 188 | |||
| 189 | static long long __benchmark_join(unsigned long index, | ||
| 190 | unsigned order1, unsigned order2) | ||
| 191 | { | ||
| 192 | unsigned long loc; | ||
| 193 | struct timespec start, finish; | ||
| 194 | long long nsec; | ||
| 195 | void *item, *item2 = item_create(index + 1, order1); | ||
| 196 | RADIX_TREE(tree, GFP_KERNEL); | ||
| 197 | |||
| 198 | item_insert_order(&tree, index, order2); | ||
| 199 | item = radix_tree_lookup(&tree, index); | ||
| 200 | |||
| 201 | clock_gettime(CLOCK_MONOTONIC, &start); | ||
| 202 | radix_tree_join(&tree, index + 1, order1, item2); | ||
| 203 | clock_gettime(CLOCK_MONOTONIC, &finish); | ||
| 204 | nsec = (finish.tv_sec - start.tv_sec) * NSEC_PER_SEC + | ||
| 205 | (finish.tv_nsec - start.tv_nsec); | ||
| 206 | |||
| 207 | loc = find_item(&tree, item); | ||
| 208 | if (loc == -1) | ||
| 209 | free(item); | ||
| 210 | |||
| 211 | item_kill_tree(&tree); | ||
| 212 | |||
| 213 | return nsec; | ||
| 214 | } | ||
| 215 | |||
| 216 | static void benchmark_join(unsigned long step) | ||
| 217 | { | ||
| 218 | int i, j, idx; | ||
| 219 | long long nsec = 0; | ||
| 220 | |||
| 221 | for (idx = 0; idx < 1 << 10; idx += step) { | ||
| 222 | for (i = 1; i < 15; i++) { | ||
| 223 | for (j = 0; j < i; j++) { | ||
| 224 | nsec += __benchmark_join(idx, i, j); | ||
| 225 | } | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | printv(2, "Size %8d, step %8ld, join time %10lld ns\n", | ||
| 230 | 1 << 10, step, nsec); | ||
| 231 | } | ||
| 232 | |||
| 81 | void benchmark(void) | 233 | void benchmark(void) |
| 82 | { | 234 | { |
| 83 | unsigned long size[] = {1 << 10, 1 << 20, 0}; | 235 | unsigned long size[] = {1 << 10, 1 << 20, 0}; |
| @@ -95,4 +247,11 @@ void benchmark(void) | |||
| 95 | for (c = 0; size[c]; c++) | 247 | for (c = 0; size[c]; c++) |
| 96 | for (s = 0; step[s]; s++) | 248 | for (s = 0; step[s]; s++) |
| 97 | benchmark_size(size[c], step[s] << 9, 9); | 249 | benchmark_size(size[c], step[s] << 9, 9); |
| 250 | |||
| 251 | for (c = 0; size[c]; c++) | ||
| 252 | for (s = 0; step[s]; s++) | ||
| 253 | benchmark_split(size[c], step[s]); | ||
| 254 | |||
| 255 | for (s = 0; step[s]; s++) | ||
| 256 | benchmark_join(step[s]); | ||
| 98 | } | 257 | } |
diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c index a26098c6123d..30cd0b296f1a 100644 --- a/tools/testing/radix-tree/idr-test.c +++ b/tools/testing/radix-tree/idr-test.c | |||
| @@ -153,6 +153,30 @@ void idr_nowait_test(void) | |||
| 153 | idr_destroy(&idr); | 153 | idr_destroy(&idr); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | void idr_get_next_test(void) | ||
| 157 | { | ||
| 158 | unsigned long i; | ||
| 159 | int nextid; | ||
| 160 | DEFINE_IDR(idr); | ||
| 161 | |||
| 162 | int indices[] = {4, 7, 9, 15, 65, 128, 1000, 99999, 0}; | ||
| 163 | |||
| 164 | for(i = 0; indices[i]; i++) { | ||
| 165 | struct item *item = item_create(indices[i], 0); | ||
| 166 | assert(idr_alloc(&idr, item, indices[i], indices[i+1], | ||
| 167 | GFP_KERNEL) == indices[i]); | ||
| 168 | } | ||
| 169 | |||
| 170 | for(i = 0, nextid = 0; indices[i]; i++) { | ||
| 171 | idr_get_next(&idr, &nextid); | ||
| 172 | assert(nextid == indices[i]); | ||
| 173 | nextid++; | ||
| 174 | } | ||
| 175 | |||
| 176 | idr_for_each(&idr, item_idr_free, &idr); | ||
| 177 | idr_destroy(&idr); | ||
| 178 | } | ||
| 179 | |||
| 156 | void idr_checks(void) | 180 | void idr_checks(void) |
| 157 | { | 181 | { |
| 158 | unsigned long i; | 182 | unsigned long i; |
| @@ -202,6 +226,7 @@ void idr_checks(void) | |||
| 202 | idr_alloc_test(); | 226 | idr_alloc_test(); |
| 203 | idr_null_test(); | 227 | idr_null_test(); |
| 204 | idr_nowait_test(); | 228 | idr_nowait_test(); |
| 229 | idr_get_next_test(); | ||
| 205 | } | 230 | } |
| 206 | 231 | ||
| 207 | /* | 232 | /* |
| @@ -338,7 +363,7 @@ void ida_check_random(void) | |||
| 338 | { | 363 | { |
| 339 | DEFINE_IDA(ida); | 364 | DEFINE_IDA(ida); |
| 340 | DECLARE_BITMAP(bitmap, 2048); | 365 | DECLARE_BITMAP(bitmap, 2048); |
| 341 | int id; | 366 | int id, err; |
| 342 | unsigned int i; | 367 | unsigned int i; |
| 343 | time_t s = time(NULL); | 368 | time_t s = time(NULL); |
| 344 | 369 | ||
| @@ -352,8 +377,11 @@ void ida_check_random(void) | |||
| 352 | ida_remove(&ida, bit); | 377 | ida_remove(&ida, bit); |
| 353 | } else { | 378 | } else { |
| 354 | __set_bit(bit, bitmap); | 379 | __set_bit(bit, bitmap); |
| 355 | ida_pre_get(&ida, GFP_KERNEL); | 380 | do { |
| 356 | assert(!ida_get_new_above(&ida, bit, &id)); | 381 | ida_pre_get(&ida, GFP_KERNEL); |
| 382 | err = ida_get_new_above(&ida, bit, &id); | ||
| 383 | } while (err == -ENOMEM); | ||
| 384 | assert(!err); | ||
| 357 | assert(id == bit); | 385 | assert(id == bit); |
| 358 | } | 386 | } |
| 359 | } | 387 | } |
| @@ -362,6 +390,24 @@ void ida_check_random(void) | |||
| 362 | goto repeat; | 390 | goto repeat; |
| 363 | } | 391 | } |
| 364 | 392 | ||
| 393 | void ida_simple_get_remove_test(void) | ||
| 394 | { | ||
| 395 | DEFINE_IDA(ida); | ||
| 396 | unsigned long i; | ||
| 397 | |||
| 398 | for (i = 0; i < 10000; i++) { | ||
| 399 | assert(ida_simple_get(&ida, 0, 20000, GFP_KERNEL) == i); | ||
| 400 | } | ||
| 401 | assert(ida_simple_get(&ida, 5, 30, GFP_KERNEL) < 0); | ||
| 402 | |||
| 403 | for (i = 0; i < 10000; i++) { | ||
| 404 | ida_simple_remove(&ida, i); | ||
| 405 | } | ||
| 406 | assert(ida_is_empty(&ida)); | ||
| 407 | |||
| 408 | ida_destroy(&ida); | ||
| 409 | } | ||
| 410 | |||
| 365 | void ida_checks(void) | 411 | void ida_checks(void) |
| 366 | { | 412 | { |
| 367 | DEFINE_IDA(ida); | 413 | DEFINE_IDA(ida); |
| @@ -428,15 +474,41 @@ void ida_checks(void) | |||
| 428 | ida_check_max(); | 474 | ida_check_max(); |
| 429 | ida_check_conv(); | 475 | ida_check_conv(); |
| 430 | ida_check_random(); | 476 | ida_check_random(); |
| 477 | ida_simple_get_remove_test(); | ||
| 431 | 478 | ||
| 432 | radix_tree_cpu_dead(1); | 479 | radix_tree_cpu_dead(1); |
| 433 | } | 480 | } |
| 434 | 481 | ||
| 482 | static void *ida_random_fn(void *arg) | ||
| 483 | { | ||
| 484 | rcu_register_thread(); | ||
| 485 | ida_check_random(); | ||
| 486 | rcu_unregister_thread(); | ||
| 487 | return NULL; | ||
| 488 | } | ||
| 489 | |||
| 490 | void ida_thread_tests(void) | ||
| 491 | { | ||
| 492 | pthread_t threads[10]; | ||
| 493 | int i; | ||
| 494 | |||
| 495 | for (i = 0; i < ARRAY_SIZE(threads); i++) | ||
| 496 | if (pthread_create(&threads[i], NULL, ida_random_fn, NULL)) { | ||
| 497 | perror("creating ida thread"); | ||
| 498 | exit(1); | ||
| 499 | } | ||
| 500 | |||
| 501 | while (i--) | ||
| 502 | pthread_join(threads[i], NULL); | ||
| 503 | } | ||
| 504 | |||
| 435 | int __weak main(void) | 505 | int __weak main(void) |
| 436 | { | 506 | { |
| 437 | radix_tree_init(); | 507 | radix_tree_init(); |
| 438 | idr_checks(); | 508 | idr_checks(); |
| 439 | ida_checks(); | 509 | ida_checks(); |
| 510 | ida_thread_tests(); | ||
| 511 | radix_tree_cpu_dead(1); | ||
| 440 | rcu_barrier(); | 512 | rcu_barrier(); |
| 441 | if (nr_allocated) | 513 | if (nr_allocated) |
| 442 | printf("nr_allocated = %d\n", nr_allocated); | 514 | printf("nr_allocated = %d\n", nr_allocated); |
diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c index b829127d5670..bc9a78449572 100644 --- a/tools/testing/radix-tree/main.c +++ b/tools/testing/radix-tree/main.c | |||
| @@ -368,6 +368,7 @@ int main(int argc, char **argv) | |||
| 368 | iteration_test(0, 10 + 90 * long_run); | 368 | iteration_test(0, 10 + 90 * long_run); |
| 369 | iteration_test(7, 10 + 90 * long_run); | 369 | iteration_test(7, 10 + 90 * long_run); |
| 370 | single_thread_tests(long_run); | 370 | single_thread_tests(long_run); |
| 371 | ida_thread_tests(); | ||
| 371 | 372 | ||
| 372 | /* Free any remaining preallocated nodes */ | 373 | /* Free any remaining preallocated nodes */ |
| 373 | radix_tree_cpu_dead(0); | 374 | radix_tree_cpu_dead(0); |
diff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c index d4ff00989245..36dcf7d6945d 100644 --- a/tools/testing/radix-tree/tag_check.c +++ b/tools/testing/radix-tree/tag_check.c | |||
| @@ -330,6 +330,34 @@ static void single_check(void) | |||
| 330 | item_kill_tree(&tree); | 330 | item_kill_tree(&tree); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | void radix_tree_clear_tags_test(void) | ||
| 334 | { | ||
| 335 | unsigned long index; | ||
| 336 | struct radix_tree_node *node; | ||
| 337 | struct radix_tree_iter iter; | ||
| 338 | void **slot; | ||
| 339 | |||
| 340 | RADIX_TREE(tree, GFP_KERNEL); | ||
| 341 | |||
| 342 | item_insert(&tree, 0); | ||
| 343 | item_tag_set(&tree, 0, 0); | ||
| 344 | __radix_tree_lookup(&tree, 0, &node, &slot); | ||
| 345 | radix_tree_clear_tags(&tree, node, slot); | ||
| 346 | assert(item_tag_get(&tree, 0, 0) == 0); | ||
| 347 | |||
| 348 | for (index = 0; index < 1000; index++) { | ||
| 349 | item_insert(&tree, index); | ||
| 350 | item_tag_set(&tree, index, 0); | ||
| 351 | } | ||
| 352 | |||
| 353 | radix_tree_for_each_slot(slot, &tree, &iter, 0) { | ||
| 354 | radix_tree_clear_tags(&tree, iter.node, slot); | ||
| 355 | assert(item_tag_get(&tree, iter.index, 0) == 0); | ||
| 356 | } | ||
| 357 | |||
| 358 | item_kill_tree(&tree); | ||
| 359 | } | ||
| 360 | |||
| 333 | void tag_check(void) | 361 | void tag_check(void) |
| 334 | { | 362 | { |
| 335 | single_check(); | 363 | single_check(); |
| @@ -347,4 +375,5 @@ void tag_check(void) | |||
| 347 | thrash_tags(); | 375 | thrash_tags(); |
| 348 | rcu_barrier(); | 376 | rcu_barrier(); |
| 349 | printv(2, "after thrash_tags: %d allocated\n", nr_allocated); | 377 | printv(2, "after thrash_tags: %d allocated\n", nr_allocated); |
| 378 | radix_tree_clear_tags_test(); | ||
| 350 | } | 379 | } |
diff --git a/tools/testing/radix-tree/test.h b/tools/testing/radix-tree/test.h index b30e11d9d271..0f8220cc6166 100644 --- a/tools/testing/radix-tree/test.h +++ b/tools/testing/radix-tree/test.h | |||
| @@ -36,6 +36,7 @@ void iteration_test(unsigned order, unsigned duration); | |||
| 36 | void benchmark(void); | 36 | void benchmark(void); |
| 37 | void idr_checks(void); | 37 | void idr_checks(void); |
| 38 | void ida_checks(void); | 38 | void ida_checks(void); |
| 39 | void ida_thread_tests(void); | ||
| 39 | 40 | ||
| 40 | struct item * | 41 | struct item * |
| 41 | item_tag_set(struct radix_tree_root *root, unsigned long index, int tag); | 42 | item_tag_set(struct radix_tree_root *root, unsigned long index, int tag); |
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 4b498265dae6..67531f47781b 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
| @@ -1,12 +1,14 @@ | |||
| 1 | LIBDIR := ../../../lib | 1 | LIBDIR := ../../../lib |
| 2 | BPFOBJ := $(LIBDIR)/bpf/bpf.o | 2 | BPFOBJ := $(LIBDIR)/bpf/bpf.o |
| 3 | 3 | ||
| 4 | CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR) | 4 | CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR) $(BPFOBJ) |
| 5 | 5 | ||
| 6 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map | 6 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map |
| 7 | 7 | ||
| 8 | TEST_PROGS := test_kmod.sh | 8 | TEST_PROGS := test_kmod.sh |
| 9 | 9 | ||
| 10 | all: $(TEST_GEN_PROGS) | ||
| 11 | |||
| 10 | .PHONY: all clean force | 12 | .PHONY: all clean force |
| 11 | 13 | ||
| 12 | # force a rebuild of BPFOBJ when its dependencies are updated | 14 | # force a rebuild of BPFOBJ when its dependencies are updated |
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index e1f5b9eea1e8..d1555e4240c0 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | * License as published by the Free Software Foundation. | 8 | * License as published by the Free Software Foundation. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <asm/types.h> | ||
| 12 | #include <linux/types.h> | ||
| 11 | #include <stdint.h> | 13 | #include <stdint.h> |
| 12 | #include <stdio.h> | 14 | #include <stdio.h> |
| 13 | #include <stdlib.h> | 15 | #include <stdlib.h> |
| @@ -4583,10 +4585,12 @@ static bool is_admin(void) | |||
| 4583 | cap_flag_value_t sysadmin = CAP_CLEAR; | 4585 | cap_flag_value_t sysadmin = CAP_CLEAR; |
| 4584 | const cap_value_t cap_val = CAP_SYS_ADMIN; | 4586 | const cap_value_t cap_val = CAP_SYS_ADMIN; |
| 4585 | 4587 | ||
| 4588 | #ifdef CAP_IS_SUPPORTED | ||
| 4586 | if (!CAP_IS_SUPPORTED(CAP_SETFCAP)) { | 4589 | if (!CAP_IS_SUPPORTED(CAP_SETFCAP)) { |
| 4587 | perror("cap_get_flag"); | 4590 | perror("cap_get_flag"); |
| 4588 | return false; | 4591 | return false; |
| 4589 | } | 4592 | } |
| 4593 | #endif | ||
| 4590 | caps = cap_get_proc(); | 4594 | caps = cap_get_proc(); |
| 4591 | if (!caps) { | 4595 | if (!caps) { |
| 4592 | perror("cap_get_proc"); | 4596 | perror("cap_get_proc"); |
diff --git a/tools/testing/selftests/powerpc/harness.c b/tools/testing/selftests/powerpc/harness.c index 248a820048df..66d31de60b9a 100644 --- a/tools/testing/selftests/powerpc/harness.c +++ b/tools/testing/selftests/powerpc/harness.c | |||
| @@ -114,9 +114,11 @@ int test_harness(int (test_function)(void), char *name) | |||
| 114 | 114 | ||
| 115 | rc = run_test(test_function, name); | 115 | rc = run_test(test_function, name); |
| 116 | 116 | ||
| 117 | if (rc == MAGIC_SKIP_RETURN_VALUE) | 117 | if (rc == MAGIC_SKIP_RETURN_VALUE) { |
| 118 | test_skip(name); | 118 | test_skip(name); |
| 119 | else | 119 | /* so that skipped test is not marked as failed */ |
| 120 | rc = 0; | ||
| 121 | } else | ||
| 120 | test_finish(name, rc); | 122 | test_finish(name, rc); |
| 121 | 123 | ||
| 122 | return rc; | 124 | return rc; |
diff --git a/tools/testing/selftests/powerpc/include/vsx_asm.h b/tools/testing/selftests/powerpc/include/vsx_asm.h index d828bfb6ef2d..54064ced9e95 100644 --- a/tools/testing/selftests/powerpc/include/vsx_asm.h +++ b/tools/testing/selftests/powerpc/include/vsx_asm.h | |||
| @@ -16,56 +16,56 @@ | |||
| 16 | */ | 16 | */ |
| 17 | FUNC_START(load_vsx) | 17 | FUNC_START(load_vsx) |
| 18 | li r5,0 | 18 | li r5,0 |
| 19 | lxvx vs20,r5,r3 | 19 | lxvd2x vs20,r5,r3 |
| 20 | addi r5,r5,16 | 20 | addi r5,r5,16 |
| 21 | lxvx vs21,r5,r3 | 21 | lxvd2x vs21,r5,r3 |
| 22 | addi r5,r5,16 | 22 | addi r5,r5,16 |
| 23 | lxvx vs22,r5,r3 | 23 | lxvd2x vs22,r5,r3 |
| 24 | addi r5,r5,16 | 24 | addi r5,r5,16 |
| 25 | lxvx vs23,r5,r3 | 25 | lxvd2x vs23,r5,r3 |
| 26 | addi r5,r5,16 | 26 | addi r5,r5,16 |
| 27 | lxvx vs24,r5,r3 | 27 | lxvd2x vs24,r5,r3 |
| 28 | addi r5,r5,16 | 28 | addi r5,r5,16 |
| 29 | lxvx vs25,r5,r3 | 29 | lxvd2x vs25,r5,r3 |
| 30 | addi r5,r5,16 | 30 | addi r5,r5,16 |
| 31 | lxvx vs26,r5,r3 | 31 | lxvd2x vs26,r5,r3 |
| 32 | addi r5,r5,16 | 32 | addi r5,r5,16 |
| 33 | lxvx vs27,r5,r3 | 33 | lxvd2x vs27,r5,r3 |
| 34 | addi r5,r5,16 | 34 | addi r5,r5,16 |
| 35 | lxvx vs28,r5,r3 | 35 | lxvd2x vs28,r5,r3 |
| 36 | addi r5,r5,16 | 36 | addi r5,r5,16 |
| 37 | lxvx vs29,r5,r3 | 37 | lxvd2x vs29,r5,r3 |
| 38 | addi r5,r5,16 | 38 | addi r5,r5,16 |
| 39 | lxvx vs30,r5,r3 | 39 | lxvd2x vs30,r5,r3 |
| 40 | addi r5,r5,16 | 40 | addi r5,r5,16 |
| 41 | lxvx vs31,r5,r3 | 41 | lxvd2x vs31,r5,r3 |
| 42 | blr | 42 | blr |
| 43 | FUNC_END(load_vsx) | 43 | FUNC_END(load_vsx) |
| 44 | 44 | ||
| 45 | FUNC_START(store_vsx) | 45 | FUNC_START(store_vsx) |
| 46 | li r5,0 | 46 | li r5,0 |
| 47 | stxvx vs20,r5,r3 | 47 | stxvd2x vs20,r5,r3 |
| 48 | addi r5,r5,16 | 48 | addi r5,r5,16 |
| 49 | stxvx vs21,r5,r3 | 49 | stxvd2x vs21,r5,r3 |
| 50 | addi r5,r5,16 | 50 | addi r5,r5,16 |
| 51 | stxvx vs22,r5,r3 | 51 | stxvd2x vs22,r5,r3 |
| 52 | addi r5,r5,16 | 52 | addi r5,r5,16 |
| 53 | stxvx vs23,r5,r3 | 53 | stxvd2x vs23,r5,r3 |
| 54 | addi r5,r5,16 | 54 | addi r5,r5,16 |
| 55 | stxvx vs24,r5,r3 | 55 | stxvd2x vs24,r5,r3 |
| 56 | addi r5,r5,16 | 56 | addi r5,r5,16 |
| 57 | stxvx vs25,r5,r3 | 57 | stxvd2x vs25,r5,r3 |
| 58 | addi r5,r5,16 | 58 | addi r5,r5,16 |
| 59 | stxvx vs26,r5,r3 | 59 | stxvd2x vs26,r5,r3 |
| 60 | addi r5,r5,16 | 60 | addi r5,r5,16 |
| 61 | stxvx vs27,r5,r3 | 61 | stxvd2x vs27,r5,r3 |
| 62 | addi r5,r5,16 | 62 | addi r5,r5,16 |
| 63 | stxvx vs28,r5,r3 | 63 | stxvd2x vs28,r5,r3 |
| 64 | addi r5,r5,16 | 64 | addi r5,r5,16 |
| 65 | stxvx vs29,r5,r3 | 65 | stxvd2x vs29,r5,r3 |
| 66 | addi r5,r5,16 | 66 | addi r5,r5,16 |
| 67 | stxvx vs30,r5,r3 | 67 | stxvd2x vs30,r5,r3 |
| 68 | addi r5,r5,16 | 68 | addi r5,r5,16 |
| 69 | stxvx vs31,r5,r3 | 69 | stxvd2x vs31,r5,r3 |
| 70 | blr | 70 | blr |
| 71 | FUNC_END(store_vsx) | 71 | FUNC_END(store_vsx) |
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 4cff7e7ddcc4..41642ba5e318 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | # Makefile for vm selftests | 1 | # Makefile for vm selftests |
| 2 | 2 | ||
| 3 | ifndef OUTPUT | ||
| 4 | OUTPUT := $(shell pwd) | ||
| 5 | endif | ||
| 6 | |||
| 3 | CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) | 7 | CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) |
| 4 | LDLIBS = -lrt | 8 | LDLIBS = -lrt |
| 5 | TEST_GEN_FILES = compaction_test | 9 | TEST_GEN_FILES = compaction_test |
diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c index 5b2b4b3c634c..b4967d875236 100644 --- a/tools/testing/selftests/x86/fsgsbase.c +++ b/tools/testing/selftests/x86/fsgsbase.c | |||
| @@ -245,7 +245,7 @@ void do_unexpected_base(void) | |||
| 245 | long ret; | 245 | long ret; |
| 246 | asm volatile ("int $0x80" | 246 | asm volatile ("int $0x80" |
| 247 | : "=a" (ret) : "a" (243), "b" (low_desc) | 247 | : "=a" (ret) : "a" (243), "b" (low_desc) |
| 248 | : "flags"); | 248 | : "r8", "r9", "r10", "r11"); |
| 249 | memcpy(&desc, low_desc, sizeof(desc)); | 249 | memcpy(&desc, low_desc, sizeof(desc)); |
| 250 | munmap(low_desc, sizeof(desc)); | 250 | munmap(low_desc, sizeof(desc)); |
| 251 | 251 | ||
diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c index 4af47079cf04..f6121612e769 100644 --- a/tools/testing/selftests/x86/ldt_gdt.c +++ b/tools/testing/selftests/x86/ldt_gdt.c | |||
| @@ -45,6 +45,12 @@ | |||
| 45 | #define AR_DB (1 << 22) | 45 | #define AR_DB (1 << 22) |
| 46 | #define AR_G (1 << 23) | 46 | #define AR_G (1 << 23) |
| 47 | 47 | ||
| 48 | #ifdef __x86_64__ | ||
| 49 | # define INT80_CLOBBERS "r8", "r9", "r10", "r11" | ||
| 50 | #else | ||
| 51 | # define INT80_CLOBBERS | ||
| 52 | #endif | ||
| 53 | |||
| 48 | static int nerrs; | 54 | static int nerrs; |
| 49 | 55 | ||
| 50 | /* Points to an array of 1024 ints, each holding its own index. */ | 56 | /* Points to an array of 1024 ints, each holding its own index. */ |
| @@ -588,7 +594,7 @@ static int invoke_set_thread_area(void) | |||
| 588 | asm volatile ("int $0x80" | 594 | asm volatile ("int $0x80" |
| 589 | : "=a" (ret), "+m" (low_user_desc) : | 595 | : "=a" (ret), "+m" (low_user_desc) : |
| 590 | "a" (243), "b" (low_user_desc) | 596 | "a" (243), "b" (low_user_desc) |
| 591 | : "flags"); | 597 | : INT80_CLOBBERS); |
| 592 | return ret; | 598 | return ret; |
| 593 | } | 599 | } |
| 594 | 600 | ||
| @@ -657,7 +663,7 @@ static void test_gdt_invalidation(void) | |||
| 657 | "+a" (eax) | 663 | "+a" (eax) |
| 658 | : "m" (low_user_desc_clear), | 664 | : "m" (low_user_desc_clear), |
| 659 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) | 665 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
| 660 | : "flags"); | 666 | : INT80_CLOBBERS); |
| 661 | 667 | ||
| 662 | if (sel != 0) { | 668 | if (sel != 0) { |
| 663 | result = "FAIL"; | 669 | result = "FAIL"; |
| @@ -688,7 +694,7 @@ static void test_gdt_invalidation(void) | |||
| 688 | "+a" (eax) | 694 | "+a" (eax) |
| 689 | : "m" (low_user_desc_clear), | 695 | : "m" (low_user_desc_clear), |
| 690 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) | 696 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
| 691 | : "flags"); | 697 | : INT80_CLOBBERS); |
| 692 | 698 | ||
| 693 | if (sel != 0) { | 699 | if (sel != 0) { |
| 694 | result = "FAIL"; | 700 | result = "FAIL"; |
| @@ -721,7 +727,7 @@ static void test_gdt_invalidation(void) | |||
| 721 | "+a" (eax) | 727 | "+a" (eax) |
| 722 | : "m" (low_user_desc_clear), | 728 | : "m" (low_user_desc_clear), |
| 723 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) | 729 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
| 724 | : "flags"); | 730 | : INT80_CLOBBERS); |
| 725 | 731 | ||
| 726 | #ifdef __x86_64__ | 732 | #ifdef __x86_64__ |
| 727 | syscall(SYS_arch_prctl, ARCH_GET_FS, &new_base); | 733 | syscall(SYS_arch_prctl, ARCH_GET_FS, &new_base); |
| @@ -774,7 +780,7 @@ static void test_gdt_invalidation(void) | |||
| 774 | "+a" (eax) | 780 | "+a" (eax) |
| 775 | : "m" (low_user_desc_clear), | 781 | : "m" (low_user_desc_clear), |
| 776 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) | 782 | [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
| 777 | : "flags"); | 783 | : INT80_CLOBBERS); |
| 778 | 784 | ||
| 779 | #ifdef __x86_64__ | 785 | #ifdef __x86_64__ |
| 780 | syscall(SYS_arch_prctl, ARCH_GET_GS, &new_base); | 786 | syscall(SYS_arch_prctl, ARCH_GET_GS, &new_base); |
diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c index b037ce9cf116..eaea92439708 100644 --- a/tools/testing/selftests/x86/ptrace_syscall.c +++ b/tools/testing/selftests/x86/ptrace_syscall.c | |||
| @@ -58,7 +58,8 @@ static void do_full_int80(struct syscall_args32 *args) | |||
| 58 | asm volatile ("int $0x80" | 58 | asm volatile ("int $0x80" |
| 59 | : "+a" (args->nr), | 59 | : "+a" (args->nr), |
| 60 | "+b" (args->arg0), "+c" (args->arg1), "+d" (args->arg2), | 60 | "+b" (args->arg0), "+c" (args->arg1), "+d" (args->arg2), |
| 61 | "+S" (args->arg3), "+D" (args->arg4), "+r" (bp)); | 61 | "+S" (args->arg3), "+D" (args->arg4), "+r" (bp) |
| 62 | : : "r8", "r9", "r10", "r11"); | ||
| 62 | args->arg5 = bp; | 63 | args->arg5 = bp; |
| 63 | #else | 64 | #else |
| 64 | sys32_helper(args, int80_and_ret); | 65 | sys32_helper(args, int80_and_ret); |
diff --git a/tools/testing/selftests/x86/single_step_syscall.c b/tools/testing/selftests/x86/single_step_syscall.c index 50c26358e8b7..a48da95c18fd 100644 --- a/tools/testing/selftests/x86/single_step_syscall.c +++ b/tools/testing/selftests/x86/single_step_syscall.c | |||
| @@ -56,9 +56,11 @@ static volatile sig_atomic_t sig_traps; | |||
| 56 | #ifdef __x86_64__ | 56 | #ifdef __x86_64__ |
| 57 | # define REG_IP REG_RIP | 57 | # define REG_IP REG_RIP |
| 58 | # define WIDTH "q" | 58 | # define WIDTH "q" |
| 59 | # define INT80_CLOBBERS "r8", "r9", "r10", "r11" | ||
| 59 | #else | 60 | #else |
| 60 | # define REG_IP REG_EIP | 61 | # define REG_IP REG_EIP |
| 61 | # define WIDTH "l" | 62 | # define WIDTH "l" |
| 63 | # define INT80_CLOBBERS | ||
| 62 | #endif | 64 | #endif |
| 63 | 65 | ||
| 64 | static unsigned long get_eflags(void) | 66 | static unsigned long get_eflags(void) |
| @@ -140,7 +142,8 @@ int main() | |||
| 140 | 142 | ||
| 141 | printf("[RUN]\tSet TF and check int80\n"); | 143 | printf("[RUN]\tSet TF and check int80\n"); |
| 142 | set_eflags(get_eflags() | X86_EFLAGS_TF); | 144 | set_eflags(get_eflags() | X86_EFLAGS_TF); |
| 143 | asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid)); | 145 | asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid) |
| 146 | : INT80_CLOBBERS); | ||
| 144 | check_result(); | 147 | check_result(); |
| 145 | 148 | ||
| 146 | /* | 149 | /* |
