2009-10-20 16:55:04

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH -tip perf/probes 0/2] x86 insn decoder bugfixes

Hi Ingo,

Here are x86 insn decoder bugfixes.
I checked it with your config and allyesconfig too.

Thank you,

---

Masami Hiramatsu (2):
x86: Add AES opcodes to opcode map
x86: Fix group attribute decoding bug


arch/x86/lib/inat.c | 2 +-
arch/x86/lib/x86-opcode-map.txt | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: [email protected]


2009-10-20 16:55:20

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH -tip perf/probes 1/2] x86: Fix group attribute decoding bug

Fix a typo in inat_get_group_attribute() which should refer
inat_group_tables, not inat_escape_tables.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
---

arch/x86/lib/inat.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/inat.c b/arch/x86/lib/inat.c
index 054656a..3fb5998 100644
--- a/arch/x86/lib/inat.c
+++ b/arch/x86/lib/inat.c
@@ -68,7 +68,7 @@ insn_attr_t inat_get_group_attribute(insn_byte_t modrm, insn_byte_t last_pfx,
if (!table)
return inat_group_common_attribute(grp_attr);
if (inat_has_variant(table[X86_MODRM_REG(modrm)]) && m) {
- table = inat_escape_tables[n][m];
+ table = inat_group_tables[n][m];
if (!table)
return inat_group_common_attribute(grp_attr);
}


--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]

2009-10-20 16:55:17

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH -tip perf/probes 2/2] x86: Add AES opcodes to opcode map

Add Intel AES opcodes to x86 opcode map. These opcodes are
used in arch/x86/crypt/aesni-intel_asm.S.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
---

arch/x86/lib/x86-opcode-map.txt | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt
index 894497f..701c467 100644
--- a/arch/x86/lib/x86-opcode-map.txt
+++ b/arch/x86/lib/x86-opcode-map.txt
@@ -567,7 +567,7 @@ fe: paddd Pq,Qq | paddd Vdq,Wdq (66)
ff:
EndTable

-Table: 3-byte opcode 1
+Table: 3-byte opcode 1 (0x0f 0x38)
Referrer: 3-byte escape 1
# 0x0f 0x38 0x00-0x0f
00: pshufb Pq,Qq | pshufb Vdq,Wdq (66)
@@ -642,11 +642,16 @@ Referrer: 3-byte escape 1
41: phminposuw Vdq,Wdq (66)
80: INVEPT Gd/q,Mdq (66)
81: INVPID Gd/q,Mdq (66)
+db: aesimc Vdq,Wdq (66)
+dc: aesenc Vdq,Wdq (66)
+dd: aesenclast Vdq,Wdq (66)
+de: aesdec Vdq,Wdq (66)
+df: aesdeclast Vdq,Wdq (66)
f0: MOVBE Gv,Mv | CRC32 Gd,Eb (F2)
f1: MOVBE Mv,Gv | CRC32 Gd,Ev (F2)
EndTable

-Table: 3-byte opcode 2
+Table: 3-byte opcode 2 (0x0f 0x3a)
Referrer: 3-byte escape 2
# 0x0f 0x3a 0x00-0xff
08: roundps Vdq,Wdq,Ib (66)
@@ -671,6 +676,7 @@ Referrer: 3-byte escape 2
61: pcmpestri Vdq,Wdq,Ib (66)
62: pcmpistrm Vdq,Wdq,Ib (66)
63: pcmpistri Vdq,Wdq,Ib (66)
+df: aeskeygenassist Vdq,Wdq,Ib (66)
EndTable

GrpTable: Grp1


--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]

2009-10-21 11:26:38

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip perf/probes 0/2] x86 insn decoder bugfixes


* Masami Hiramatsu <[email protected]> wrote:

> Hi Ingo,
>
> Here are x86 insn decoder bugfixes.
> I checked it with your config and allyesconfig too.
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (2):
> x86: Add AES opcodes to opcode map
> x86: Fix group attribute decoding bug
>
>
> arch/x86/lib/inat.c | 2 +-
> arch/x86/lib/x86-opcode-map.txt | 10 ++++++++--
> 2 files changed, 9 insertions(+), 3 deletions(-)

Applied to tip:perf/probes, thanks Masami!

Ingo

2009-10-21 12:22:11

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip perf/probes 0/2] x86 insn decoder bugfixes


there's still build failures:

TEST posttest
Error: ffffffff8103b917: c5 59 fc ff vpaddb %xmm7,%xmm4,%xmm15
Error: objdump says 4 bytes, but insn_get_length() says 3 (attr:8000)
make[1]: *** [posttest] Error 2
make: *** [bzImage] Error 2

config attached.

Ingo


Attachments:
(No filename) (292.00 B)
config (95.76 kB)
Download all attachments

2009-10-21 14:39:41

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH -tip perf/probes 0/2] x86 insn decoder bugfixes

Ingo Molnar wrote:
>
> there's still build failures:
>
> TEST posttest
> Error: ffffffff8103b917: c5 59 fc ff vpaddb %xmm7,%xmm4,%xmm15
> Error: objdump says 4 bytes, but insn_get_length() says 3 (attr:8000)
> make[1]: *** [posttest] Error 2
> make: *** [bzImage] Error 2

Aah, that's the AVX code...
I assume, random-data-byte-sequence in the kernel binary
contains it.

> config attached.

I'll try to reproduce and fix it.
Thank you!

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]

2009-10-21 15:53:59

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH -tip perf/probes 0/2] x86 insn decoder bugfixes

Masami Hiramatsu wrote:
> Ingo Molnar wrote:
>>
>> there's still build failures:
>>
>> TEST posttest
>> Error: ffffffff8103b917: c5 59 fc ff vpaddb %xmm7,%xmm4,%xmm15
>> Error: objdump says 4 bytes, but insn_get_length() says 3 (attr:8000)
>> make[1]: *** [posttest] Error 2
>> make: *** [bzImage] Error 2
>
> Aah, that's the AVX code...
> I assume, random-data-byte-sequence in the kernel binary
> contains it.

Hmm, I've found the actual code.

ffffffff81043917 <xen_sysret32_reloc>:
ffffffff81043917: c5 59 fc ff vpaddb %xmm7,%xmm4,%xmm15

---
ENTRY(xen_sysret32)
/*
* We're already on the usermode stack at this point, but
* still with the kernel gs, so we can easily switch back
*/
movq %rsp, PER_CPU_VAR(old_rsp)
movq PER_CPU_VAR(kernel_stack), %rsp

pushq $__USER32_DS
pushq PER_CPU_VAR(old_rsp)
pushq %r11
pushq $__USER32_CS
pushq %rcx

pushq $VGCF_in_syscall
1: jmp hypercall_iret
ENDPATCH(xen_sysret32)
RELOC(xen_sysret32, 1b+1)
---
#define RELOC(x, v) .globl x##_reloc; x##_reloc=v
---

OK, it's not a random, but a data in kernel text.
Anyway, I'll add AVX support then.

Thank you,

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]

2009-10-24 01:04:56

by Masami Hiramatsu

[permalink] [raw]
Subject: [tip:branch?] x86: Fix group attribute decoding bug

Commit-ID: 06ed6ba5ecb771cc3a967838a4bb1d9cbd8786b9
Gitweb: http://git.kernel.org/tip/06ed6ba5ecb771cc3a967838a4bb1d9cbd8786b9
Author: Masami Hiramatsu <[email protected]>
AuthorDate: Tue, 20 Oct 2009 12:55:24 -0400
Committer: Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2009 13:25:28 +0200

x86: Fix group attribute decoding bug

Fix a typo in inat_get_group_attribute() which should refer
inat_group_tables, not inat_escape_tables.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: systemtap<[email protected]>
Cc: DLE <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/lib/inat.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/inat.c b/arch/x86/lib/inat.c
index 054656a..3fb5998 100644
--- a/arch/x86/lib/inat.c
+++ b/arch/x86/lib/inat.c
@@ -68,7 +68,7 @@ insn_attr_t inat_get_group_attribute(insn_byte_t modrm, insn_byte_t last_pfx,
if (!table)
return inat_group_common_attribute(grp_attr);
if (inat_has_variant(table[X86_MODRM_REG(modrm)]) && m) {
- table = inat_escape_tables[n][m];
+ table = inat_group_tables[n][m];
if (!table)
return inat_group_common_attribute(grp_attr);
}

2009-10-24 01:06:48

by Masami Hiramatsu

[permalink] [raw]
Subject: [tip:branch?] x86: Add AES opcodes to opcode map

Commit-ID: 9983d60d74db9e544c6cb6f65351849fe8e9c1de
Gitweb: http://git.kernel.org/tip/9983d60d74db9e544c6cb6f65351849fe8e9c1de
Author: Masami Hiramatsu <[email protected]>
AuthorDate: Tue, 20 Oct 2009 12:55:31 -0400
Committer: Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2009 13:25:29 +0200

x86: Add AES opcodes to opcode map

Add Intel AES opcodes to x86 opcode map. These opcodes are
used in arch/x86/crypt/aesni-intel_asm.S.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: systemtap<[email protected]>
Cc: DLE <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/lib/x86-opcode-map.txt | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt
index 894497f..701c467 100644
--- a/arch/x86/lib/x86-opcode-map.txt
+++ b/arch/x86/lib/x86-opcode-map.txt
@@ -567,7 +567,7 @@ fe: paddd Pq,Qq | paddd Vdq,Wdq (66)
ff:
EndTable

-Table: 3-byte opcode 1
+Table: 3-byte opcode 1 (0x0f 0x38)
Referrer: 3-byte escape 1
# 0x0f 0x38 0x00-0x0f
00: pshufb Pq,Qq | pshufb Vdq,Wdq (66)
@@ -642,11 +642,16 @@ Referrer: 3-byte escape 1
41: phminposuw Vdq,Wdq (66)
80: INVEPT Gd/q,Mdq (66)
81: INVPID Gd/q,Mdq (66)
+db: aesimc Vdq,Wdq (66)
+dc: aesenc Vdq,Wdq (66)
+dd: aesenclast Vdq,Wdq (66)
+de: aesdec Vdq,Wdq (66)
+df: aesdeclast Vdq,Wdq (66)
f0: MOVBE Gv,Mv | CRC32 Gd,Eb (F2)
f1: MOVBE Mv,Gv | CRC32 Gd,Ev (F2)
EndTable

-Table: 3-byte opcode 2
+Table: 3-byte opcode 2 (0x0f 0x3a)
Referrer: 3-byte escape 2
# 0x0f 0x3a 0x00-0xff
08: roundps Vdq,Wdq,Ib (66)
@@ -671,6 +676,7 @@ Referrer: 3-byte escape 2
61: pcmpestri Vdq,Wdq,Ib (66)
62: pcmpistrm Vdq,Wdq,Ib (66)
63: pcmpistri Vdq,Wdq,Ib (66)
+df: aeskeygenassist Vdq,Wdq,Ib (66)
EndTable

GrpTable: Grp1

2009-10-24 01:04:53

by Ingo Molnar

[permalink] [raw]
Subject: [tip:branch?] x86, instruction decoder: Fix test_get_len build rules

Commit-ID: 9bf4e7fba8006d19846fec877b6da0616b2772de
Gitweb: http://git.kernel.org/tip/9bf4e7fba8006d19846fec877b6da0616b2772de
Author: Ingo Molnar <[email protected]>
AuthorDate: Wed, 21 Oct 2009 14:39:51 +0200
Committer: Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2009 14:42:56 +0200

x86, instruction decoder: Fix test_get_len build rules

Add the kernel source include file as well to the include files
search path, to fix this build bug:

In file included from arch/x86/tools/test_get_len.c:28:
arch/x86/lib/insn.c:21:26: error: linux/string.h: No such file or directory

Cc: Masami Hiramatsu <[email protected]>
Cc: systemtap<[email protected]>
Cc: DLE <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/tools/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index 1bd006c..5e295d9 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -8,8 +8,8 @@ posttest: $(obj)/test_get_len vmlinux
hostprogs-y := test_get_len

# -I needed for generated C source and C source which in the kernel tree.
-HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/
+HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/

-# Dependancies are also needed.
+# Dependencies are also needed.
$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c