Skip to contentSkip to conversation

x86/boot: Make gdt 8-byte aligned

PATCH New Xiaoyao Li 2 participants 3 messages Jun 27, 2019 x86

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH 1/1 x86/boot: Make gdt 8-byte aligned

When loading segment descriptor, it uses lock implicitly. Align gdt here to avoid potential split lock from crossing cache lines case.

---
 arch/x86/boot/compressed/head_64.S | 1 +
 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/head_64.S +1 -0
index fafb75c6c592..6233ae35d0d9 100644
@@ -659,6 +659,7 @@ no_longmode:
 gdt64:
 	.word	gdt_end - gdt
 	.quad   0
+	.balign	8
 gdt:
 	.word	gdt_end - gdt
 	.long	gdt
Signature · 1 line
2.19.1
#1 lore raw
x86/boot: Make gdt 8-byte aligned
Commit-ID:  1c30fe6cbba6997ae4740bb46910036f8a4a9edb
Gitweb:     https://git.kernel.org/tip/1c30fe6cbba6997ae4740bb46910036f8a4a9edb
Author:     Xiaoyao Li <[email protected]>
AuthorDate: Thu, 27 Jun 2019 12:55:25 +0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 27 Jun 2019 09:40:41 +0200

x86/boot: Make gdt 8-byte aligned

The segment descriptors are loaded with a implicitly locked instruction, which could trigger the split lock #AC if the variable is not properly aligned and crosses a cache line.

Align gdt proper so the descriptors are 8 byte aligned.

---
 arch/x86/boot/compressed/head_64.S | 1 +
 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/head_64.S +1 -0
index fafb75c6c592..6233ae35d0d9 100644
@@ -659,6 +659,7 @@ no_longmode:
 gdt64:
 	.word	gdt_end - gdt
 	.quad   0
+	.balign	8
 gdt:
 	.word	gdt_end - gdt
 	.long	gdt
#2 lore raw

[tip:x86/boot] x86/boot: Make the GDT 8-byte aligned

In reply to Xiaoyao Li
x86/boot: Make the GDT 8-byte aligned
Commit-ID:  2238246ff8d533a5f2327d1f953375876d8a013c
Gitweb:     https://git.kernel.org/tip/2238246ff8d533a5f2327d1f953375876d8a013c
Author:     Xiaoyao Li <[email protected]>
AuthorDate: Thu, 27 Jun 2019 12:55:25 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 27 Jun 2019 10:56:11 +0200

x86/boot: Make the GDT 8-byte aligned

The segment descriptors are loaded with an implicitly LOCK-ed instruction, which could trigger the split lock #AC exception if the variable is not properly aligned and crosses a cache line.

Align the GDT properly so the descriptors are all 8 byte aligned.

---
 arch/x86/boot/compressed/head_64.S | 1 +
 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/head_64.S +1 -0
index fafb75c6c592..6233ae35d0d9 100644
@@ -659,6 +659,7 @@ no_longmode:
 gdt64:
 	.word	gdt_end - gdt
 	.quad   0
+	.balign	8
 gdt:
 	.word	gdt_end - gdt
 	.long	gdt