x86/insn: perf tools: Add a few new x86 instructions
Subsystems (2)
Adrian Hunter
reviewerv2 cover x86/insn: perf tools: Add a few new x86 instructions
Hi
Here is version 2.
perf tools has a copy of the x86 instruction decoder for decoding Intel PT. This patch set adds a perf tools test to use it to test new instructions. Subsequent patches add a few new x86 instructions, or very slightly modify them in the case of MPX. Those changes affect both perf tools and x86/insn.
I suggest Arnaldo takes all these patches as they mainly affect perf tools, at least in terms of lines-of-code.
Changes in V2:
perf tools: Display build warning if x86 instruction decoder differs from kernel
New patch (slightly modified from the proposal and so without Jiri's Ack)
x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
Tweaked comment to refer to: tools/perf/perf test "x86 ins"
x86/insn: perf tools: Add new SHA instructions
Tweaked comment to refer to: tools/perf/perf test "x86 ins"
x86/insn: perf tools: Add new memory instructions
Tweaked comment to refer to: tools/perf/perf test "x86 ins"
x86/insn: perf tools: Add new memory protection keys instructions
New patch
x86/insn: perf tools: Add new xsave instructions
New patch
Adrian Hunter (7):
perf tools: Display build warning if x86 instruction decoder differs from kernel perf tools: Add a test for decoding of new x86 instructions x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions x86/insn: perf tools: Add new SHA instructions
x86/insn: perf tools: Add new memory instructions
x86/insn: perf tools: Add new memory protection keys instructions x86/insn: perf tools: Add new xsave instructions
arch/x86/lib/x86-opcode-map.txt | 24 +- tools/perf/tests/Build | 3 + tools/perf/tests/builtin-test.c | 8 + tools/perf/tests/gen-insn-x86-dat.awk | 75 ++ tools/perf/tests/gen-insn-x86-dat.sh | 43 + tools/perf/tests/insn-x86-dat-32.c | 658 ++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 768 ++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 877 +++++++++++++++++++++ tools/perf/tests/insn-x86.c | 184 +++++ tools/perf/tests/tests.h | 1 + tools/perf/util/intel-pt-decoder/Build | 13 +- .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 24 +- 12 files changed, 2667 insertions(+), 11 deletions(-) create mode 100644 tools/perf/tests/gen-insn-x86-dat.awk create mode 100755 tools/perf/tests/gen-insn-x86-dat.sh create mode 100644 tools/perf/tests/insn-x86-dat-32.c create mode 100644 tools/perf/tests/insn-x86-dat-64.c create mode 100644 tools/perf/tests/insn-x86-dat-src.c create mode 100644 tools/perf/tests/insn-x86.c
Regards
Adrian
Adrian Hunter
reviewerPATCH v2 1/7 perf tools: Display build warning if x86 instruction decoder differs from kernel
perf tools has a copy of the x86 instruction decoder used by the kernel. The expectation is that the copy will be kept more-or-less in-synch with the kernel version. Consequently it is helpful to know if there are differences. This patch adds a check into the perf tools build so that a diff is done on the sources, and a warning is printed if they are different. Note that the warning is not fatal and the build continues as normal.
The check is done as part of building the instruction decoder, so, like a compiler warning, it is not seen unless the instruction decoder has to be re-compiled. e.g.
$ make -C tools/perf >/dev/null
$ echo "/* blah */" >> tools/perf/util/intel-pt-decoder/inat_types.h
$ make -C tools/perf >/dev/null
Warning: Intel PT: x86 instruction decoder differs from kernel
$ make -C tools/perf >/dev/null
$--- tools/perf/util/intel-pt-decoder/Build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/Build +12 -1
@@ -7,6 +7,17 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table $(call rule_mkdir) @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@ -$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c +$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/intel-pt-insn-decoder.c util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c + @(test -d ../../kernel -a -d ../../tools -a -d ../perf && (( \ + diff -B -I'^#include' util/intel-pt-decoder/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ + diff -B util/intel-pt-decoder/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ + diff -B util/intel-pt-decoder/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ + || echo "Warning: Intel PT: x86 instruction decoder differs from kernel" >&2 )) || true + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c) CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder -Wno-override-init
Signature · 1 line
1.9.1
RE: [PATCH V2 1/7] perf tools: Display build warning if x86 instruction decoder differs from kernel
Quoted 14 lines
From: Adrian Hunter [mailto:[email protected]]
perf tools has a copy of the x86 instruction decoder used by the kernel. The expectation is that the copy will be kept more-or-less in-synch with the kernel version. Consequently it is helpful to know if there are differences. This patch adds a check into the perf tools build so that a diff is done on the sources, and a warning is printed if they are different. Note that the warning is not fatal and the build continues as normal.
The check is done as part of building the instruction decoder, so, like a compiler warning, it is not seen unless the instruction decoder has to be re-compiled. e.g.
Quoted 6 lines
$ make -C tools/perf >/dev/null
$ echo "/* blah */" >> tools/perf/util/intel-pt-decoder/inat_types.h
$ make -C tools/perf >/dev/null
Warning: Intel PT: x86 instruction decoder differs from kernel
$ make -C tools/perf >/dev/null
$Looks good to me :)
Thanks you!
Quoted 32 lines
Signed-off-by Adrian Hunter <[email protected]>--- tools/perf/util/intel-pt-decoder/Build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)tools/perf/util/intel-pt-decoder/Build +0
-1@@ -7,6 +7,17 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table $(call rule_mkdir) @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@ -$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c$(OUTPUT)util/intel-pt-decoder/inat-tables.c +$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o:
util/intel-pt-decoder/intel-pt-insn-decoder.cutil/intel-pt-decoder/inat.c$(OUTPUT)util/intel-pt-decoder/inat-tables.ctools/perf/util/intel-pt-decoder/Build +11
-1+ @(test -d ../../kernel -a -d ../../tools -a -d ../perf && (( \ + diff -B -I'^#include' util/intel-pt-decoder/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ + diff -B util/intel-pt-decoder/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ + diff -B util/intel-pt-decoder/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ + || echo "Warning: Intel PT: x86 instruction decoder differs from kernel" >&2 )) || true + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c) CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder -Wno-override-init --
Quoted 1 line
1.9.1
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf tools: Display build warning if x86 instruction decoder differs from kernel
In reply to Adrian Hunterperf tools: Display build warning if x86 instruction decoder differs from kernel
Commit-ID: 3a9d7723145a6c1be6e9afbb661e3ad7768be2e0 Gitweb: http://git.kernel.org/tip/3a9d7723145a6c1be6e9afbb661e3ad7768be2e0 Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:25 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:01 -0300
perf tools: Display build warning if x86 instruction decoder differs from kernel
perf tools has a copy of the x86 instruction decoder used by the kernel. The expectation is that the copy will be kept more-or-less in-synch with the kernel version. Consequently it is helpful to know if there are differences.
This patch adds a check into the perf tools build so that a diff is done on the sources, and a warning is printed if they are different. Note that the warning is not fatal and the build continues as normal.
The check is done as part of building the instruction decoder, so, like a compiler warning, it is not seen unless the instruction decoder has to be re-compiled. e.g.
$ make -C tools/perf >/dev/null $ echo "/* blah */" >> tools/perf/util/intel-pt-decoder/inat_types.h $ make -C tools/perf >/dev/null Warning: Intel PT: x86 instruction decoder differs from kernel $ make -C tools/perf >/dev/null $
--- tools/perf/util/intel-pt-decoder/Build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/Build +12 -1
@@ -7,6 +7,17 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table $(call rule_mkdir) @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@ -$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c +$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/intel-pt-insn-decoder.c util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c + @(test -d ../../kernel -a -d ../../tools -a -d ../perf && (( \ + diff -B -I'^#include' util/intel-pt-decoder/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ + diff -B util/intel-pt-decoder/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ + diff -B util/intel-pt-decoder/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ + diff -B -I'^#include' util/intel-pt-decoder/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ + || echo "Warning: Intel PT: x86 instruction decoder differs from kernel" >&2 )) || true + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c) CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder -Wno-override-init
Adrian Hunter
reviewerPATCH v2 2/7 perf tools: Add a test for decoding of new x86 instructions
In reply to Adrian HunterAdd a new test titled:
Test x86 instruction decoder - new instructions
The purpose of this test is to check the instruction decoder after new instructions have been added. Initially, MPX instructions are tested which are already supported, but the definitions in x86-opcode-map.txt will be tweaked in a subsequent patch, after which this test can be run to verify those changes.
The data for the test comes from assembly language instructions in insn-x86-dat-src.c which is converted into bytes by the scripts gen-insn-x86-dat.sh and gen-insn-x86-dat.awk, and included into the test program insn-x86.c as insn-x86-dat-32.c and insn-x86-dat-64.c. The conversion is not done as part of the perf tools build because the test data must be under (git) change control in order for the test to be repeatably-correct. Also it may require a recent version of binutils.
--- tools/perf/tests/Build | 3 + tools/perf/tests/builtin-test.c | 8 + tools/perf/tests/gen-insn-x86-dat.awk | 75 ++++++ tools/perf/tests/gen-insn-x86-dat.sh | 43 ++++ tools/perf/tests/insn-x86-dat-32.c | 324 ++++++++++++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 340 +++++++++++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 416 ++++++++++++++++++++++++++++++++++ tools/perf/tests/insn-x86.c | 180 +++++++++++++++ tools/perf/tests/tests.h | 1 + 9 files changed, 1390 insertions(+) create mode 100644 tools/perf/tests/gen-insn-x86-dat.awk create mode 100755 tools/perf/tests/gen-insn-x86-dat.sh create mode 100644 tools/perf/tests/insn-x86-dat-32.c create mode 100644 tools/perf/tests/insn-x86-dat-64.c create mode 100644 tools/perf/tests/insn-x86-dat-src.c create mode 100644 tools/perf/tests/insn-x86.c
tools/perf/tests/Build +3 -0
@@ -35,6 +35,9 @@ perf-y += thread-map.o perf-y += llvm.o perf-$(CONFIG_X86) += perf-time-to-tsc.o +ifdef CONFIG_AUXTRACE +perf-$(CONFIG_X86) += insn-x86.o +endif ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64)) perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
tools/perf/tests/builtin-test.c +8 -0
@@ -178,6 +178,14 @@ static struct test { .desc = "Test LLVM searching and compiling", .func = test__llvm, }, +#ifdef HAVE_AUXTRACE_SUPPORT +#if defined(__x86_64__) || defined(__i386__) + { + .desc = "Test x86 instruction decoder - new instructions", + .func = test__insn_x86, + }, +#endif +#endif { .func = NULL, },
tools/perf/tests/gen-insn-x86-dat.awk new file +75 -0
75 lines not on this page · raw message
tools/perf/tests/gen-insn-x86-dat.sh new file +43 -0
43 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-32.c new file +324 -0
324 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-64.c new file +340 -0
340 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-src.c new file +416 -0
416 lines not on this page · raw message
tools/perf/tests/insn-x86.c new file +180 -0
180 lines not on this page · raw message
tools/perf/tests/tests.h +1 -0
@@ -63,6 +63,7 @@ int test__fdarray__add(void);int test__kmod_path__parse (void );int test__thread_map (void );int test__llvm (void ); +int test__insn_x86 (void );#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)#ifdef HAVE_DWARF_UNWIND_SUPPORT
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf tools: Add a test for decoding of new x86 instructions
perf tools: Add a test for decoding of new x86 instructions
Commit-ID: 98e4619f2b2bb80d310feaac5589b44c000aecc1 Gitweb: http://git.kernel.org/tip/98e4619f2b2bb80d310feaac5589b44c000aecc1 Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:26 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:02 -0300
perf tools: Add a test for decoding of new x86 instructions
Add a new test titled:
Test x86 instruction decoder - new instructions
The purpose of this test is to check the instruction decoder after new instructions have been added. Initially, MPX instructions are tested which are already supported, but the definitions in x86-opcode-map.txt will be tweaked in a subsequent patch, after which this test can be run to verify those changes.
The data for the test comes from assembly language instructions in insn-x86-dat-src.c which is converted into bytes by the scripts gen-insn-x86-dat.sh and gen-insn-x86-dat.awk, and included into the test program insn-x86.c as insn-x86-dat-32.c and insn-x86-dat-64.c.
The conversion is not done as part of the perf tools build because the test data must be under (git) change control in order for the test to be repeatably-correct. Also it may require a recent version of binutils.
Commiter notes:
Using it:
# perf test decoder 39: Test x86 instruction decoder - new instructions : Ok # perf test -v decoder 39: Test x86 instruction decoder - new instructions : --- start --- test child forked, pid 21970 Decoded ok: 0f 31 rdtsc Decoded ok: f3 0f 1b 00 bndmk (%eax),%bnd0 Decoded ok: f3 0f 1b 05 78 56 34 12 bndmk 0x12345678,%bnd0 Decoded ok: f3 0f 1b 18 bndmk (%eax),%bnd3 <SNIP> Decoded ok: f2 e9 00 00 00 00 bnd jmpq 402 <main+0x402> Decoded ok: f2 e9 00 00 00 00 bnd jmpq 408 <main+0x408> Decoded ok: 67 f2 ff 21 bnd jmpq *(%ecx) Decoded ok: f2 0f 85 00 00 00 00 bnd jne 413 <main+0x413> test child finished with 0 ---- end ---- Test x86 instruction decoder - new instructions: Ok #
--- tools/perf/tests/Build | 3 + tools/perf/tests/builtin-test.c | 8 + tools/perf/tests/gen-insn-x86-dat.awk | 75 ++++++ tools/perf/tests/gen-insn-x86-dat.sh | 43 ++++ tools/perf/tests/insn-x86-dat-32.c | 324 ++++++++++++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 340 +++++++++++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 416 ++++++++++++++++++++++++++++++++++ tools/perf/tests/insn-x86.c | 180 +++++++++++++++ tools/perf/tests/tests.h | 1 + 9 files changed, 1390 insertions(+)
tools/perf/tests/Build +3 -0
@@ -35,6 +35,9 @@ perf-y += thread-map.o perf-y += llvm.o perf-$(CONFIG_X86) += perf-time-to-tsc.o +ifdef CONFIG_AUXTRACE +perf-$(CONFIG_X86) += insn-x86.o +endif ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64)) perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
tools/perf/tests/builtin-test.c +8 -0
@@ -178,6 +178,14 @@ static struct test { .desc = "Test LLVM searching and compiling", .func = test__llvm, }, +#ifdef HAVE_AUXTRACE_SUPPORT +#if defined(__x86_64__) || defined(__i386__) + { + .desc = "Test x86 instruction decoder - new instructions", + .func = test__insn_x86, + }, +#endif +#endif { .func = NULL, },
tools/perf/tests/gen-insn-x86-dat.awk new file +75 -0
75 lines not on this page · raw message
tools/perf/tests/gen-insn-x86-dat.sh new file +43 -0
43 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-32.c new file +324 -0
324 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-64.c new file +340 -0
340 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-src.c new file +416 -0
416 lines not on this page · raw message
tools/perf/tests/insn-x86.c new file +180 -0
180 lines not on this page · raw message
tools/perf/tests/tests.h +1 -0
@@ -63,6 +63,7 @@ int test__fdarray__add(void);int test__kmod_path__parse (void );int test__thread_map (void );int test__llvm (void ); +int test__insn_x86 (void );#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)#ifdef HAVE_DWARF_UNWIND_SUPPORT
Adrian Hunter
reviewerPATCH v2 3/7 x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
In reply to Adrian HunterThe MPX instructions are presently not described in the SDM opcode maps, and there are not encoding characters for bnd registers, address method or operand type. So the kernel opcode map is using 'Gv' for bnd registers and 'Ev' for everything else. That is fine because the instruction decoder does not use that information anyway, except as an indication that there is a ModR/M byte.
Nevertheless, in some cases the 'Gv' and 'Ev' are the wrong way around, BNDLDX and BNDSTX have 2 operands not 3, and it wouldn't hurt to identify the mandatory prefixes.
This has no effect on the decoding of valid instructions, but the addition of the mandatory prefixes will cause some invalid instructions to error out that wouldn't have previously.
Note that perf tools has a copy of the instruction decoder and provides a test for new instructions which includes MPX instructions e.g.
$ perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ perf test -v "x86 ins"
--- arch/x86/lib/x86-opcode-map.txt | 8 ++++++-- tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
arch/x86/lib/x86-opcode-map.txt +6 -2
@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +6 -2
@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:
Signature · 1 line
1.9.1
RE: [PATCH V2 3/7] x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
Quoted 23 lines
From: Adrian Hunter [mailto:[email protected]]
The MPX instructions are presently not described in the SDM opcode maps, and there are not encoding characters for bnd registers, address method or operand type. So the kernel opcode map is using 'Gv' for bnd registers and 'Ev' for everything else. That is fine because the instruction decoder does not use that information anyway, except as an indication that there is a ModR/M byte.
Nevertheless, in some cases the 'Gv' and 'Ev' are the wrong way around, BNDLDX and BNDSTX have 2 operands not 3, and it wouldn't hurt to identify the mandatory prefixes.
This has no effect on the decoding of valid instructions, but the addition of the mandatory prefixes will cause some invalid instructions to error out that wouldn't have previously.
Note that perf tools has a copy of the instruction decoder and provides a test for new instructions which includes MPX instructions e.g.
Quoted 6 lines
$ perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ perf test -v "x86 ins"
Thanks for fixing it :)
Quoted 46 lines
Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/lib/x86-opcode-map.txt | 8 ++++++-- tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)arch/x86/lib/x86-opcode-map.txt +6
-2@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +6
-3@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e: --
Quoted 1 line
1.9.1
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Adrian Hunter
merge bot[tip:perf/core] x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
In reply to Adrian Hunterx86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
Commit-ID: 78173ec6311a22ca9f42cf949cf37754a8b71633 Gitweb: http://git.kernel.org/tip/78173ec6311a22ca9f42cf949cf37754a8b71633 Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:27 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:02 -0300
x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
The MPX instructions are presently not described in the SDM opcode maps, and there are not encoding characters for bnd registers, address method or operand type. So the kernel opcode map is using 'Gv' for bnd registers and 'Ev' for everything else. That is fine because the instruction decoder does not use that information anyway, except as an indication that there is a ModR/M byte.
Nevertheless, in some cases the 'Gv' and 'Ev' are the wrong way around, BNDLDX and BNDSTX have 2 operands not 3, and it wouldn't hurt to identify the mandatory prefixes.
This has no effect on the decoding of valid instructions, but the addition of the mandatory prefixes will cause some invalid instructions to error out that wouldn't have previously.
Note that perf tools has a copy of the instruction decoder and provides a test for new instructions which includes MPX instructions e.g.
$ perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ perf test -v "x86 ins"
Commiter notes:
And to see these MPX instructions specifically:
$ perf test -v "x86 ins" 2>&1 | grep bndldx | head -3 Decoded ok: 0f 1a 00 bndldx (%eax),%bnd0 Decoded ok: 0f 1a 05 78 56 34 12 bndldx 0x12345678,%bnd0 Decoded ok: 0f 1a 18 bndldx (%eax),%bnd3 $ perf test -v "x86 ins" 2>&1 | grep bndstx | head -3 Decoded ok: 0f 1b 00 bndstx %bnd0,(%eax) Decoded ok: 0f 1b 05 78 56 34 12 bndstx %bnd0,0x12345678 Decoded ok: 0f 1b 18 bndstx %bnd3,(%eax) $
--- arch/x86/lib/x86-opcode-map.txt | 8 ++++++-- tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
arch/x86/lib/x86-opcode-map.txt +6 -2
@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +6 -2
@@ -353,8 +353,12 @@ AVXcode: 1 17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1) 18: Grp16 (1A) 19: -1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv -1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv +# Intel SDM opcode map does not list MPX instructions. For now using Gv for +# bnd registers and Ev for everything else is OK because the instruction +# decoder does not use the information except as an indication that there is +# a ModR/M byte. +1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev +1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv 1c: 1d: 1e:
Adrian Hunter
reviewerPATCH v2 4/7 x86/insn: perf tools: Add new SHA instructions
In reply to Adrian HunterIntel SHA Extensions are explained in the Intel Architecture Instruction Set Extensions Programing Reference (Oct 2014). There are 7 new instructions. Add them to the op code map and the perf tools new instructions test. e.g.
$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep sha
--- arch/x86/lib/x86-opcode-map.txt | 7 + tools/perf/tests/insn-x86-dat-32.c | 294 ++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 364 ++++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 373 +++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 7 + 5 files changed, 1045 insertions(+)
arch/x86/lib/x86-opcode-map.txt +7 -0
@@ -736,6 +736,12 @@ bd: vfnmadd231ss/d Vx,Hx,Wx (66),(v),(v1) be: vfnmsub231ps/d Vx,Hx,Wx (66),(v) bf: vfnmsub231ss/d Vx,Hx,Wx (66),(v),(v1) # 0x0f 0x38 0xc0-0xff +c8: sha1nexte Vdq,Wdq +c9: sha1msg1 Vdq,Wdq +ca: sha1msg2 Vdq,Wdq +cb: sha256rnds2 Vdq,Wdq +cc: sha256msg1 Vdq,Wdq +cd: sha256msg2 Vdq,Wdq db: VAESIMC Vdq,Wdq (66),(v1) dc: VAESENC Vdq,Hdq,Wdq (66),(v1) dd: VAESENCLAST Vdq,Hdq,Wdq (66),(v1)
@@ -794,6 +800,7 @@ AVXcode: 3 61: vpcmpestri Vdq,Wdq,Ib (66),(v1) 62: vpcmpistrm Vdq,Wdq,Ib (66),(v1) 63: vpcmpistri Vdq,Wdq,Ib (66),(v1) +cc: sha1rnds4 Vdq,Wdq,Ib df: VAESKEYGEN Vdq,Wdq,Ib (66),(v1) f0: RORX Gy,Ey,Ib (F2),(v) EndTable
tools/perf/tests/insn-x86-dat-32.c +294 -0
297 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-64.c +364 -0
367 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-src.c +373 -0
385 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +7 -0
@@ -736,6 +736,12 @@ bd: vfnmadd231ss/d Vx,Hx,Wx (66),(v),(v1) be: vfnmsub231ps/d Vx,Hx,Wx (66),(v) bf: vfnmsub231ss/d Vx,Hx,Wx (66),(v),(v1) # 0x0f 0x38 0xc0-0xff +c8: sha1nexte Vdq,Wdq +c9: sha1msg1 Vdq,Wdq +ca: sha1msg2 Vdq,Wdq +cb: sha256rnds2 Vdq,Wdq +cc: sha256msg1 Vdq,Wdq +cd: sha256msg2 Vdq,Wdq db: VAESIMC Vdq,Wdq (66),(v1) dc: VAESENC Vdq,Hdq,Wdq (66),(v1) dd: VAESENCLAST Vdq,Hdq,Wdq (66),(v1)
@@ -794,6 +800,7 @@ AVXcode: 3 61: vpcmpestri Vdq,Wdq,Ib (66),(v1) 62: vpcmpistrm Vdq,Wdq,Ib (66),(v1) 63: vpcmpistri Vdq,Wdq,Ib (66),(v1) +cc: sha1rnds4 Vdq,Wdq,Ib df: VAESKEYGEN Vdq,Wdq,Ib (66),(v1) f0: RORX Gy,Ey,Ib (F2),(v) EndTable
Signature · 1 line
1.9.1
tip-bot for Adrian Hunter
merge bot[tip:perf/core] x86/insn: perf tools: Add new SHA instructions
x86/insn: perf tools: Add new SHA instructions
Commit-ID: 3fe78d6af9e2f08c4014fd3ccbf9e1ff312dedf1 Gitweb: http://git.kernel.org/tip/3fe78d6af9e2f08c4014fd3ccbf9e1ff312dedf1 Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:28 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:03 -0300
x86/insn: perf tools: Add new SHA instructions
Intel SHA Extensions are explained in the Intel Architecture Instruction Set Extensions Programing Reference (Oct 2014). There are 7 new instructions. Add them to the op code map and the perf tools new instructions test. e.g.
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep sha
Committer note:
3 lines of details, for the curious:
$ perf test -v "x86 ins" 2>&1 | grep sha256msg1 | tail -3 Decoded ok: 0f 38 cc 84 08 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,1),%xmm0 Decoded ok: 0f 38 cc 84 c8 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,8),%xmm0 Decoded ok: 44 0f 38 cc bc c8 78 56 34 12 sha256msg1 0x12345678(%rax,%rcx,8),%xmm15 $
--- arch/x86/lib/x86-opcode-map.txt | 7 + tools/perf/tests/insn-x86-dat-32.c | 294 ++++++++++++++++ tools/perf/tests/insn-x86-dat-64.c | 364 ++++++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 373 +++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 7 + 5 files changed, 1045 insertions(+)
arch/x86/lib/x86-opcode-map.txt +7 -0
@@ -736,6 +736,12 @@ bd: vfnmadd231ss/d Vx,Hx,Wx (66),(v),(v1) be: vfnmsub231ps/d Vx,Hx,Wx (66),(v) bf: vfnmsub231ss/d Vx,Hx,Wx (66),(v),(v1) # 0x0f 0x38 0xc0-0xff +c8: sha1nexte Vdq,Wdq +c9: sha1msg1 Vdq,Wdq +ca: sha1msg2 Vdq,Wdq +cb: sha256rnds2 Vdq,Wdq +cc: sha256msg1 Vdq,Wdq +cd: sha256msg2 Vdq,Wdq db: VAESIMC Vdq,Wdq (66),(v1) dc: VAESENC Vdq,Hdq,Wdq (66),(v1) dd: VAESENCLAST Vdq,Hdq,Wdq (66),(v1)
@@ -794,6 +800,7 @@ AVXcode: 3 61: vpcmpestri Vdq,Wdq,Ib (66),(v1) 62: vpcmpistrm Vdq,Wdq,Ib (66),(v1) 63: vpcmpistri Vdq,Wdq,Ib (66),(v1) +cc: sha1rnds4 Vdq,Wdq,Ib df: VAESKEYGEN Vdq,Wdq,Ib (66),(v1) f0: RORX Gy,Ey,Ib (F2),(v) EndTable
tools/perf/tests/insn-x86-dat-32.c +294 -0
297 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-64.c +364 -0
367 lines not on this page · raw message
tools/perf/tests/insn-x86-dat-src.c +373 -0
385 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +7 -0
@@ -736,6 +736,12 @@ bd: vfnmadd231ss/d Vx,Hx,Wx (66),(v),(v1) be: vfnmsub231ps/d Vx,Hx,Wx (66),(v) bf: vfnmsub231ss/d Vx,Hx,Wx (66),(v),(v1) # 0x0f 0x38 0xc0-0xff +c8: sha1nexte Vdq,Wdq +c9: sha1msg1 Vdq,Wdq +ca: sha1msg2 Vdq,Wdq +cb: sha256rnds2 Vdq,Wdq +cc: sha256msg1 Vdq,Wdq +cd: sha256msg2 Vdq,Wdq db: VAESIMC Vdq,Wdq (66),(v1) dc: VAESENC Vdq,Hdq,Wdq (66),(v1) dd: VAESENCLAST Vdq,Hdq,Wdq (66),(v1)
@@ -794,6 +800,7 @@ AVXcode: 3 61: vpcmpestri Vdq,Wdq,Ib (66),(v1) 62: vpcmpistrm Vdq,Wdq,Ib (66),(v1) 63: vpcmpistri Vdq,Wdq,Ib (66),(v1) +cc: sha1rnds4 Vdq,Wdq,Ib df: VAESKEYGEN Vdq,Wdq,Ib (66),(v1) f0: RORX Gy,Ey,Ib (F2),(v) EndTable
Adrian Hunter
reviewerPATCH v2 5/7 x86/insn: perf tools: Add new memory instructions
In reply to Adrian HunterIntel Architecture Instruction Set Extensions Programing Reference (Oct 2014) describes 3 new memory instructions, namely clflushopt, clwb and pcommit. Add them to the op code map and the perf tools new instructions test. e.g.
$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins"
--- arch/x86/lib/x86-opcode-map.txt | 4 +- tools/perf/tests/insn-x86-dat-32.c | 22 +++++++++++ tools/perf/tests/insn-x86-dat-64.c | 34 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 46 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 4 +- 5 files changed, 106 insertions(+), 4 deletions(-)
arch/x86/lib/x86-opcode-map.txt +2 -2
@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16
tools/perf/tests/insn-x86-dat-32.c +22 -0
@@ -616,3 +616,25 @@ "0f 38 cd 84 08 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,1),%xmm0",}, {{0x0f, 0x38, 0xcd, 0x84, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,8),%xmm0",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%eax)",}, +{{0x66, 0x0f, 0xae, 0x3d, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 3d 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%eax)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%eax)",}, +{{0x66, 0x0f, 0xae, 0x35, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 35 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%eax)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-64.c +34 -0
@@ -702,3 +702,37 @@ "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm0",}, {{0x44, 0x0f, 0x38, 0xcd, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", "44 0f 38 cd bc c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm15",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x38, }, 5, 0, "", "", +"66 41 0f ae 38 \tclflushopt (%r8)",}, +{{0x66, 0x0f, 0xae, 0x3c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 3c 25 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%rax)",}, +{{0x41, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"41 0f ae 38 \tclflush (%r8)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x30, }, 5, 0, "", "", +"66 41 0f ae 30 \tclwb (%r8)",}, +{{0x66, 0x0f, 0xae, 0x34, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 34 25 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%rax)",}, +{{0x41, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"41 0f ae 30 \txsaveopt (%r8)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-src.c +46 -0
60 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +2 -2
@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16
Signature · 1 line
1.9.1
RE: [PATCH V2 5/7] x86/insn: perf tools: Add new memory instructions
Quoted 1 line
From: Adrian Hunter [mailto:[email protected]]
sn: perf tools: Add new memory instructions
Quoted 6 lines
Intel Architecture Instruction Set Extensions Programing Reference (Oct 2014) describes 3 new memory instructions, namely clflushopt, clwb and pcommit. Add them to the op code map and the perf tools new instructions test. e.g.
Quoted 7 lines
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins"
OK, I've checked that on the reference.
Thanks!
Quoted 178 lines
Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/lib/x86-opcode-map.txt | 4 +- tools/perf/tests/insn-x86-dat-32.c | 22 +++++++++++ tools/perf/tests/insn-x86-dat-64.c | 34 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 46 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 4 +- 5 files changed, 106 insertions(+), 4 deletions(-)arch/x86/lib/x86-opcode-map.txt +2
-2@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16tools/perf/tests/insn-x86-dat-32.c +22
-0@@ -616,3 +616,25 @@ "0f 38 cd 84 08 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,1),%xmm0",}, {{0x0f, 0x38, 0xcd, 0x84, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,8),%xmm0",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%eax)",}, +{{0x66, 0x0f, 0xae, 0x3d, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 3d 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%eax)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%eax)",}, +{{0x66, 0x0f, 0xae, 0x35, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 35 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%eax)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},tools/perf/tests/insn-x86-dat-64.c +34
-0@@ -702,3 +702,37 @@ "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm0",}, {{0x44, 0x0f, 0x38, 0xcd, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", "44 0f 38 cd bc c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm15",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x38, }, 5, 0, "", "", +"66 41 0f ae 38 \tclflushopt (%r8)",}, +{{0x66, 0x0f, 0xae, 0x3c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 3c 25 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%rax)",}, +{{0x41, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"41 0f ae 38 \tclflush (%r8)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x30, }, 5, 0, "", "", +"66 41 0f ae 30 \tclwb (%r8)",}, +{{0x66, 0x0f, 0xae, 0x34, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 34 25 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%rax)",}, +{{0x41, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"41 0f ae 30 \txsaveopt (%r8)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},tools/perf/tests/insn-x86-dat-src.c +46
-0@@ -421,6 +421,30 @@ int main(void) asmvolatile ("sha256msg2 0x12345678(%rax,%rcx,8), %xmm0" ); asmvolatile ("sha256msg2 0x12345678(%rax,%rcx,8), %xmm15" ); +/* clflushopt m8 */ + + asmvolatile ("clflushopt (%rax)" ); + asmvolatile ("clflushopt (%r8)" ); + asmvolatile ("clflushopt (0x12345678)" ); + asmvolatile ("clflushopt 0x12345678(%rax,%rcx,8)" ); + asmvolatile ("clflushopt 0x12345678(%r8,%rcx,8)" ); +/* Also check instructions in the same group encoding as clflushopt */ + asmvolatile ("clflush (%rax)" ); + asmvolatile ("clflush (%r8)" ); + asmvolatile ("sfence" ); + +/* clwb m8 */ + + asmvolatile ("clwb (%rax)" ); + asmvolatile ("clwb (%r8)" ); + asmvolatile ("clwb (0x12345678)" ); + asmvolatile ("clwb 0x12345678(%rax,%rcx,8)" ); + asmvolatile ("clwb 0x12345678(%r8,%rcx,8)" ); +/* Also check instructions in the same group encoding as clwb */ + asmvolatile ("xsaveopt (%rax)" ); + asmvolatile ("xsaveopt (%r8)" ); + asmvolatile ("mfence" ); +#else /* #ifdef __x86_64__ */ /* bndmk m32, bnd */ @@ -780,8 +804,30 @@ int main(void) asmvolatile ("sha256msg2 0x12345678(%eax,%ecx,1), %xmm0" ); asmvolatile ("sha256msg2 0x12345678(%eax,%ecx,8), %xmm0" ); +/* clflushopt m8 */ + + asmvolatile ("clflushopt (%eax)" ); + asmvolatile ("clflushopt (0x12345678)" ); + asmvolatile ("clflushopt 0x12345678(%eax,%ecx,8)" ); +/* Also check instructions in the same group encoding as clflushopt */ + asmvolatile ("clflush (%eax)" ); + asmvolatile ("sfence" ); + +/* clwb m8 */ + + asmvolatile ("clwb (%eax)" ); + asmvolatile ("clwb (0x12345678)" ); + asmvolatile ("clwb 0x12345678(%eax,%ecx,8)" ); +/* Also check instructions in the same group encoding as clwb */ + asmvolatile ("xsaveopt (%eax)" ); + asmvolatile ("mfence" ); +#endif /* #ifndef __x86_64__ */ +/* pcommit */ + + asmvolatile ("pcommit" ); +/* Following line is a marker for the awk script - do not change */ asmvolatile ("rdtsc" );/* Stop here */ tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +2
-3@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16 --
Quoted 1 line
1.9.1
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Adrian Hunter
merge bot[tip:perf/core] x86/insn: perf tools: Add new memory instructions
In reply to Adrian Hunterx86/insn: perf tools: Add new memory instructions
Commit-ID: ac1c8859a81e2fc45db1dbff30bdc572005734ca Gitweb: http://git.kernel.org/tip/ac1c8859a81e2fc45db1dbff30bdc572005734ca Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:29 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:03 -0300
x86/insn: perf tools: Add new memory instructions
Intel Architecture Instruction Set Extensions Programing Reference (Oct 2014) describes 3 new memory instructions, namely clflushopt, clwb and pcommit. Add them to the op code map and the perf tools new instructions test. e.g.
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins"
--- arch/x86/lib/x86-opcode-map.txt | 4 +- tools/perf/tests/insn-x86-dat-32.c | 22 +++++++++++ tools/perf/tests/insn-x86-dat-64.c | 34 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 46 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 4 +- 5 files changed, 106 insertions(+), 4 deletions(-)
arch/x86/lib/x86-opcode-map.txt +2 -2
@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16
tools/perf/tests/insn-x86-dat-32.c +22 -0
@@ -616,3 +616,25 @@ "0f 38 cd 84 08 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,1),%xmm0",}, {{0x0f, 0x38, 0xcd, 0x84, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%eax,%ecx,8),%xmm0",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%eax)",}, +{{0x66, 0x0f, 0xae, 0x3d, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 3d 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%eax)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%eax)",}, +{{0x66, 0x0f, 0xae, 0x35, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"66 0f ae 35 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%eax)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-64.c +34 -0
@@ -702,3 +702,37 @@ "0f 38 cd 84 c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm0",}, {{0x44, 0x0f, 0x38, 0xcd, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", "44 0f 38 cd bc c8 78 56 34 12 \tsha256msg2 0x12345678(%rax,%rcx,8),%xmm15",}, +{{0x66, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"66 0f ae 38 \tclflushopt (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x38, }, 5, 0, "", "", +"66 41 0f ae 38 \tclflushopt (%r8)",}, +{{0x66, 0x0f, 0xae, 0x3c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 3c 25 78 56 34 12 \tclflushopt 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xbc, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae bc c8 78 56 34 12 \tclflushopt 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x38, }, 3, 0, "", "", +"0f ae 38 \tclflush (%rax)",}, +{{0x41, 0x0f, 0xae, 0x38, }, 4, 0, "", "", +"41 0f ae 38 \tclflush (%r8)",}, +{{0x0f, 0xae, 0xf8, }, 3, 0, "", "", +"0f ae f8 \tsfence ",}, +{{0x66, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"66 0f ae 30 \tclwb (%rax)",}, +{{0x66, 0x41, 0x0f, 0xae, 0x30, }, 5, 0, "", "", +"66 41 0f ae 30 \tclwb (%r8)",}, +{{0x66, 0x0f, 0xae, 0x34, 0x25, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae 34 25 78 56 34 12 \tclwb 0x12345678",}, +{{0x66, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"66 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%rax,%rcx,8)",}, +{{0x66, 0x41, 0x0f, 0xae, 0xb4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 10, 0, "", "", +"66 41 0f ae b4 c8 78 56 34 12 \tclwb 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xae, 0x30, }, 3, 0, "", "", +"0f ae 30 \txsaveopt (%rax)",}, +{{0x41, 0x0f, 0xae, 0x30, }, 4, 0, "", "", +"41 0f ae 30 \txsaveopt (%r8)",}, +{{0x0f, 0xae, 0xf0, }, 3, 0, "", "", +"0f ae f0 \tmfence ",}, +{{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", +"66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-src.c +46 -0
60 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +2 -2
@@ -943,8 +943,8 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE 5: XRSTOR | lfence (11B) -6: XSAVEOPT | mfence (11B) -7: clflush | sfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) +7: clflush | clflushopt (66) | sfence (11B) | pcommit (66),(11B) EndTable GrpTable: Grp16
Adrian Hunter
reviewerPATCH v2 6/7 x86/insn: perf tools: Add new memory protection keys instructions
In reply to Adrian HunterAdd rdpkru and wrpkru to the op code map and the perf tools new instructions test. In the case of the test, only the bytes can be tested at the moment since binutils doesn't support the instructions yet. To run the test:
$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep pkru
For information about rdpkru and wrpkru, refer the Intel SDM.
--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/perf/tests/insn-x86.c | 4 ++++ tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable
tools/perf/tests/insn-x86.c +4 -0
@@ -17,11 +17,15 @@ struct test_data {struct test_data test_data_32[] = { #include "insn-x86-dat-32.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };struct test_data test_data_64[] = { #include "insn-x86-dat-64.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +1 -1
@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable
Signature · 1 line
1.9.1
RE: [PATCH V2 6/7] x86/insn: perf tools: Add new memory protection keys instructions
Quoted 7 lines
From: Adrian Hunter [mailto:[email protected]]
Add rdpkru and wrpkru to the op code map and the perf tools new instructions test. In the case of the test, only the bytes can be tested at the moment since binutils doesn't support the instructions yet. To run the test:
Quoted 8 lines
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep pkruFor information about rdpkru and wrpkru, refer the Intel SDM.
Looks very nice to me.
Thanks!
Quoted 55 lines
Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/perf/tests/insn-x86.c | 4 ++++ tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)arch/x86/lib/x86-opcode-map.txt +1
-1@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTabletools/perf/tests/insn-x86.c +4
-0@@ -17,11 +17,15 @@ struct test_data {struct test_data test_data_32[] = { #include "insn-x86-dat-32.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };struct test_data test_data_64[] = { #include "insn-x86-dat-64.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +1
-2@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable --
Quoted 1 line
1.9.1
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Adrian Hunter
merge bot[tip:perf/core] x86/insn: perf tools: Add new memory protection keys instructions
In reply to Adrian Hunterx86/insn: perf tools: Add new memory protection keys instructions
Commit-ID: 978260cdbec3e34a3dfb2277ffc0aa1809457362 Gitweb: http://git.kernel.org/tip/978260cdbec3e34a3dfb2277ffc0aa1809457362 Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:30 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:03 -0300
x86/insn: perf tools: Add new memory protection keys instructions
Add rdpkru and wrpkru to the op code map and the perf tools new instructions test. In the case of the test, only the bytes can be tested at the moment since binutils doesn't support the instructions yet. To run the test:
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep pkru
For information about rdpkru and wrpkru, refer the Intel SDM.
--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/perf/tests/insn-x86.c | 4 ++++ tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable
tools/perf/tests/insn-x86.c +4 -0
@@ -17,11 +17,15 @@ struct test_data {struct test_data test_data_32[] = { #include "insn-x86-dat-32.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };struct test_data test_data_64[] = { #include "insn-x86-dat-64.c" + {{0x0f ,0x01 ,0xee },3 ,0 ,NULL ,NULL ,"0f 01 ee \trdpkru" }, + {{0x0f ,0x01 ,0xef },3 ,0 ,NULL ,NULL ,"0f 01 ef \twrpkru" }, {{0 },0 ,0 ,NULL ,NULL ,NULL }, };
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +1 -1
@@ -885,7 +885,7 @@ GrpTable: Grp7 2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) 3: LIDT Ms 4: SMSW Mw/Rv -5: +5: rdpkru (110),(11B) | wrpkru (111),(11B) 6: LMSW Ew 7: INVLPG Mb | SWAPGS (o64),(000),(11B) | RDTSCP (001),(11B) EndTable
Adrian Hunter
reviewerPATCH v2 7/7 x86/insn: perf tools: Add new xsave instructions
In reply to Adrian HunterAdd xsavec, xsaves and xrstors to the op code map and the perf tools new instructions test. To run the test:
$ tools/perf/perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep 'xsave\|xrst'
For information about xsavec, xsaves and xrstors, refer the Intel SDM.
--- arch/x86/lib/x86-opcode-map.txt | 3 ++ tools/perf/tests/insn-x86-dat-32.c | 18 ++++++++++ tools/perf/tests/insn-x86-dat-64.c | 30 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 42 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 3 ++ 5 files changed, 96 insertions(+)
arch/x86/lib/x86-opcode-map.txt +3 -0
@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable
tools/perf/tests/insn-x86-dat-32.c +18 -0
@@ -636,5 +636,23 @@ "0f ae 30 \txsaveopt (%eax)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%eax)",}, +{{0x0f, 0xc7, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%eax)",}, +{{0x0f, 0xc7, 0x2d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 2d 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%eax)",}, +{{0x0f, 0xc7, 0x1d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 1d 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%eax,%ecx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-64.c +30 -0
@@ -734,5 +734,35 @@ "41 0f ae 30 \txsaveopt (%r8)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x20, }, 4, 0, "", "", +"41 0f c7 20 \txsavec (%r8)",}, +{{0x0f, 0xc7, 0x24, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 24 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x28, }, 4, 0, "", "", +"41 0f c7 28 \txsaves (%r8)",}, +{{0x0f, 0xc7, 0x2c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 2c 25 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x18, }, 4, 0, "", "", +"41 0f c7 18 \txrstors (%r8)",}, +{{0x0f, 0xc7, 0x1c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 1c 25 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%r8,%rcx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-src.c +42 -0
54 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +3 -0
@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable
Signature · 1 line
1.9.1
RE: [PATCH V2 7/7] x86/insn: perf tools: Add new xsave instructions
Quoted 5 lines
From: Adrian Hunter [mailto:[email protected]]
Add xsavec, xsaves and xrstors to the op code map and the perf tools new instructions test. To run the test:
Quoted 8 lines
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : OkOr to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep 'xsave\|xrst'For information about xsavec, xsaves and xrstors, refer the Intel SDM.
Hmm, it seems that the Intel SDM(June 2015)'s "opcode map" is not updated yet (but yes, I've found these in instruction set reference ...). Please ask the manual maintainers to update that :)
Thanks!
Quoted 167 lines
Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/lib/x86-opcode-map.txt | 3 ++ tools/perf/tests/insn-x86-dat-32.c | 18 ++++++++++ tools/perf/tests/insn-x86-dat-64.c | 30 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 42 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 3 ++ 5 files changed, 96 insertions(+)arch/x86/lib/x86-opcode-map.txt +3
-0@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTabletools/perf/tests/insn-x86-dat-32.c +18
-0@@ -636,5 +636,23 @@ "0f ae 30 \txsaveopt (%eax)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%eax)",}, +{{0x0f, 0xc7, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%eax)",}, +{{0x0f, 0xc7, 0x2d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 2d 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%eax)",}, +{{0x0f, 0xc7, 0x1d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 1d 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%eax,%ecx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},tools/perf/tests/insn-x86-dat-64.c +30
-0@@ -734,5 +734,35 @@ "41 0f ae 30 \txsaveopt (%r8)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x20, }, 4, 0, "", "", +"41 0f c7 20 \txsavec (%r8)",}, +{{0x0f, 0xc7, 0x24, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 24 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x28, }, 4, 0, "", "", +"41 0f c7 28 \txsaves (%r8)",}, +{{0x0f, 0xc7, 0x2c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 2c 25 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x18, }, 4, 0, "", "", +"41 0f c7 18 \txrstors (%r8)",}, +{{0x0f, 0xc7, 0x1c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 1c 25 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%r8,%rcx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},tools/perf/tests/insn-x86-dat-src.c +42
-0@@ -445,6 +445,30 @@ int main(void) asmvolatile ("xsaveopt (%r8)" ); asmvolatile ("mfence" ); +/* xsavec mem */ + + asmvolatile ("xsavec (%rax)" ); + asmvolatile ("xsavec (%r8)" ); + asmvolatile ("xsavec (0x12345678)" ); + asmvolatile ("xsavec 0x12345678(%rax,%rcx,8)" ); + asmvolatile ("xsavec 0x12345678(%r8,%rcx,8)" ); + +/* xsaves mem */ + + asmvolatile ("xsaves (%rax)" ); + asmvolatile ("xsaves (%r8)" ); + asmvolatile ("xsaves (0x12345678)" ); + asmvolatile ("xsaves 0x12345678(%rax,%rcx,8)" ); + asmvolatile ("xsaves 0x12345678(%r8,%rcx,8)" ); + +/* xrstors mem */ + + asmvolatile ("xrstors (%rax)" ); + asmvolatile ("xrstors (%r8)" ); + asmvolatile ("xrstors (0x12345678)" ); + asmvolatile ("xrstors 0x12345678(%rax,%rcx,8)" ); + asmvolatile ("xrstors 0x12345678(%r8,%rcx,8)" ); +#else /* #ifdef __x86_64__ */ /* bndmk m32, bnd */ @@ -822,6 +846,24 @@ int main(void) asmvolatile ("xsaveopt (%eax)" ); asmvolatile ("mfence" ); +/* xsavec mem */ + + asmvolatile ("xsavec (%eax)" ); + asmvolatile ("xsavec (0x12345678)" ); + asmvolatile ("xsavec 0x12345678(%eax,%ecx,8)" ); + +/* xsaves mem */ + + asmvolatile ("xsaves (%eax)" ); + asmvolatile ("xsaves (0x12345678)" ); + asmvolatile ("xsaves 0x12345678(%eax,%ecx,8)" ); + +/* xrstors mem */ + + asmvolatile ("xrstors (%eax)" ); + asmvolatile ("xrstors (0x12345678)" ); + asmvolatile ("xrstors 0x12345678(%eax,%ecx,8)" ); +#endif /* #ifndef __x86_64__ */ /* pcommit */ tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +3
-1@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable --
Quoted 1 line
1.9.1
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Adrian Hunter
merge bot[tip:perf/core] x86/insn: perf tools: Add new xsave instructions
In reply to Adrian Hunterx86/insn: perf tools: Add new xsave instructions
Commit-ID: f83b6b64eba155cfb43ab8a5d9c422c3e7f603e6 Gitweb: http://git.kernel.org/tip/f83b6b64eba155cfb43ab8a5d9c422c3e7f603e6 Author: Adrian Hunter <[email protected]> AuthorDate: Wed, 2 Sep 2015 15:15:31 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 4 Sep 2015 12:01:04 -0300
x86/insn: perf tools: Add new xsave instructions
Add xsavec, xsaves and xrstors to the op code map and the perf tools new instructions test. To run the test:
$ tools/perf/perf test "x86 ins" 39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ tools/perf/perf test -v "x86 ins" 2>&1 | grep 'xsave\|xrst'
For information about xsavec, xsaves and xrstors, refer the Intel SDM.
--- arch/x86/lib/x86-opcode-map.txt | 3 ++ tools/perf/tests/insn-x86-dat-32.c | 18 ++++++++++ tools/perf/tests/insn-x86-dat-64.c | 30 ++++++++++++++++ tools/perf/tests/insn-x86-dat-src.c | 42 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 3 ++ 5 files changed, 96 insertions(+)
arch/x86/lib/x86-opcode-map.txt +3 -0
@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable
tools/perf/tests/insn-x86-dat-32.c +18 -0
@@ -636,5 +636,23 @@ "0f ae 30 \txsaveopt (%eax)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%eax)",}, +{{0x0f, 0xc7, 0x25, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%eax)",}, +{{0x0f, 0xc7, 0x2d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 2d 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%eax,%ecx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%eax)",}, +{{0x0f, 0xc7, 0x1d, 0x78, 0x56, 0x34, 0x12, }, 7, 0, "", "", +"0f c7 1d 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%eax,%ecx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-64.c +30 -0
@@ -734,5 +734,35 @@ "41 0f ae 30 \txsaveopt (%r8)",}, {{0x0f, 0xae, 0xf0, }, 3, 0, "", "", "0f ae f0 \tmfence ",}, +{{0x0f, 0xc7, 0x20, }, 3, 0, "", "", +"0f c7 20 \txsavec (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x20, }, 4, 0, "", "", +"41 0f c7 20 \txsavec (%r8)",}, +{{0x0f, 0xc7, 0x24, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 24 25 78 56 34 12 \txsavec 0x12345678",}, +{{0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xa4, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 a4 c8 78 56 34 12 \txsavec 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x28, }, 3, 0, "", "", +"0f c7 28 \txsaves (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x28, }, 4, 0, "", "", +"41 0f c7 28 \txsaves (%r8)",}, +{{0x0f, 0xc7, 0x2c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 2c 25 78 56 34 12 \txsaves 0x12345678",}, +{{0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0xac, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 ac c8 78 56 34 12 \txsaves 0x12345678(%r8,%rcx,8)",}, +{{0x0f, 0xc7, 0x18, }, 3, 0, "", "", +"0f c7 18 \txrstors (%rax)",}, +{{0x41, 0x0f, 0xc7, 0x18, }, 4, 0, "", "", +"41 0f c7 18 \txrstors (%r8)",}, +{{0x0f, 0xc7, 0x1c, 0x25, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 1c 25 78 56 34 12 \txrstors 0x12345678",}, +{{0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 8, 0, "", "", +"0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%rax,%rcx,8)",}, +{{0x41, 0x0f, 0xc7, 0x9c, 0xc8, 0x78, 0x56, 0x34, 0x12, }, 9, 0, "", "", +"41 0f c7 9c c8 78 56 34 12 \txrstors 0x12345678(%r8,%rcx,8)",}, {{0x66, 0x0f, 0xae, 0xf8, }, 4, 0, "", "", "66 0f ae f8 \tpcommit ",},
tools/perf/tests/insn-x86-dat-src.c +42 -0
54 lines not on this page · raw message
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +3 -0
@@ -899,6 +899,9 @@ EndTable GrpTable: Grp9 1: CMPXCHG8B/16B Mq/Mdq +3: xrstors +4: xsavec +5: xsaves 6: VMPTRLD Mq | VMCLEAR Mq (66) | VMXON Mq (F3) | RDRAND Rv (11B) 7: VMPTRST Mq | VMPTRST Mq (F3) | RDSEED Rv (11B) EndTable
Em Wed, Sep 02, 2015 at 03:15:24PM +0300, Adrian Hunter escreveu:
Quoted 4 lines
Changes in V2:
perf tools: Display build warning if x86 instruction decoder differs from kernel
New patch (slightly modified from the proposal and so without Jiri's Ack)
Applied.
But please consider doing some extra work on at least showing what are the difference.
I think those diff calls should be moved to a separate shell script, that would either do what they do now, i.e. show that one line "things changed!" or would produce a diff file that would then have its contents shown, this way one could go on removing such differences, building again, rinse, repeat, till the warning is gone.
Thanks a lot!
- Arnaldo
Adrian Hunter
reviewerQuoted 7 lines · Arnaldo Carvalho de Melo
Em Wed, Sep 02, 2015 at 03:15:24PM +0300, Adrian Hunter escreveu:
Quoted 4 lines
Changes in V2:
perf tools: Display build warning if x86 instruction decoder differs from kernel
New patch (slightly modified from the proposal and so without Jiri's Ack)Applied.
Thank you!
Quoted 9 lines
But please consider doing some extra work on at least showing what are the difference.
I think those diff calls should be moved to a separate shell script, that would either do what they do now, i.e. show that one line "things changed!" or would produce a diff file that would then have its contents shown, this way one could go on removing such differences, building again, rinse, repeat, till the warning is gone.
OK