Skip to contentSkip to conversation

x86_64: fix early_gdt_descr_base mangling

PATCH In review Jiri Slaby 2 participants 3 messages Feb 7, 2009 x86

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 x86_64: fix early_gdt_descr_base mangling

Commit 8c7e58e690ae60ab4215b025f433ed4af261e103
(x86: rework __per_cpu_load adjustments)
has broken resume on my machine. On every secondary_startup_64 invocation, it adds initial_gs to early_gdt_descr_base.

Fix it by initializing it to per_cpu__gdt_page and adding to it.

Cc Brian Gerst <[email protected]>
Cc Tejun Heo <[email protected]>
---
 arch/x86/kernel/head_64.S |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/head_64.S +3 -2
index a0a2b5c..dadca8d 100644
@@ -215,7 +215,8 @@ ENTRY(secondary_startup_64)
 	movq	initial_gs(%rip), %rax
 	cmpl	$0, per_cpu__cpu_number(%rax)
 	jne	1f
-	addq	%rax, early_gdt_descr_base(%rip)
+	addq	$per_cpu__gdt_page, %rax
+	movq	%rax, early_gdt_descr_base(%rip)
 1:
 #endif
 	/*
@@ -425,7 +426,7 @@ NEXT_PAGE(level2_spare_pgt)
 early_gdt_descr:
 	.word	GDT_ENTRIES*8-1
 early_gdt_descr_base:
-	.quad	per_cpu__gdt_page
+	.quad	0
 
 ENTRY(phys_base)
 	/* This must match the first entry in level2_kernel_pgt */
Signature · 1 line
1.6.1.2
#1 lore raw
Quoted 29 lines · Jiri Slaby

Commit 8c7e58e690ae60ab4215b025f433ed4af261e103
(x86: rework __per_cpu_load adjustments)
has broken resume on my machine. On every secondary_startup_64 invocation, it adds initial_gs to early_gdt_descr_base.

Fix it by initializing it to per_cpu__gdt_page and adding to it.

Cc Brian Gerst <[email protected]>
Cc Tejun Heo <[email protected]>
---
 arch/x86/kernel/head_64.S |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/head_64.S +2 -1
index a0a2b5c..dadca8d 100644
@@ -215,7 +215,8 @@ ENTRY(secondary_startup_64)
       movq    initial_gs(%rip), %rax
       cmpl    $0, per_cpu__cpu_number(%rax)
       jne     1f
-       addq    %rax, early_gdt_descr_base(%rip)
+       addq    $per_cpu__gdt_page, %rax
+       movq    %rax, early_gdt_descr_base(%rip)
 1:
 #endif
       /*

arch/x86/kernel/head_64.S NEXT_PAGE(level2_spare_pgt) · line 429

Quoted 5 lines
arch/x86/kernel/head_64.S +1 -1
@@ -425,7 +426,7 @@ NEXT_PAGE(level2_spare_pgt)
 early_gdt_descr:
       .word   GDT_ENTRIES*8-1
 early_gdt_descr_base:
-       .quad   per_cpu__gdt_page
+       .quad   0

The add of the load address isn't done on UP, so this breaks it.

Actually, hold off on this patch. I see a better way of handling this.

--
Brian Gerst

author
#2 lore raw
Quoted 8 lines · Brian Gerst

arch/x86/kernel/head_64.S NEXT_PAGE(level2_spare_pgt) · line 429

Quoted 6 lines
arch/x86/kernel/head_64.S +1 -1
@@ -425,7 +426,7 @@ NEXT_PAGE(level2_spare_pgt)
 early_gdt_descr:
       .word   GDT_ENTRIES*8-1
 early_gdt_descr_base:
-       .quad   per_cpu__gdt_page
+       .quad   0

The add of the load address isn't done on UP, so this breaks it.

Ah, I see.

Quoted 1 line

Actually, hold off on this patch.

Ok, thanks, holding on...