Skip to contentSkip to conversation

x86/entry: Fix !PV build

PATCH In review Andrew Cooper 2 participants 3 messages Aug 22, 2022 – Aug 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/entry: Fix !PV build

early_page_fault() needs to outside of #ifdef CONFIG_PV

Spotted by Gitlab CI.

Fixes fe3f50726e87 ("x86/entry: move .init.text section higher up in the code for readability")

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/x86_64/entry.S | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
xen/arch/x86/x86_64/entry.S +11 -9
index 9b34150bc7ab..b0efe48192d5 100644
@@ -22,6 +22,17 @@
 #endif
 .endm
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
+        .text
+
 #ifdef CONFIG_PV
 /* %rbx: struct vcpu */
 switch_to_kernel:
@@ -140,15 +151,6 @@ process_trap:
         call create_bounce_frame
         jmp  test_all_events
 
-        .section .init.text, "ax", @progbits
-ENTRY(early_page_fault)
-        ENDBR64
-        movl  $TRAP_page_fault, 4(%rsp)
-        SAVE_ALL
-        movq  %rsp, %rdi
-        call  do_early_page_fault
-        jmp   restore_all_xen
-
         .section .text.entry, "ax", @progbits
 
 /* %rbx: struct vcpu, interrupts disabled */
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Andrew Cooper

early_page_fault() needs to outside of #ifdef CONFIG_PV

Spotted by Gitlab CI.

Fixes fe3f50726e87 ("x86/entry: move .init.text section higher up in the code for readability")

Makes me wonder whether the original change then really was worth it.

Quoted 10 lines
xen/arch/x86/x86_64/entry.S +4 -0
@@ -22,6 +22,17 @@
 #endif
 .endm
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)

xen/arch/x86/x86_64/entry.S line 38

Quoted 10 lines
xen/arch/x86/x86_64/entry.S +7 -0
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
+        .text
+
 #ifdef CONFIG_PV
 /* %rbx: struct vcpu */
 switch_to_kernel:

Rather than putting it at the very top of the file, may I suggest to put it immediately after

/* --- CODE BELOW THIS LINE (MOSTLY) NOT GUEST RELATED --- */

or yet a few more lines down between continue_pv_domain and restore_all_xen? Which, as a minor gain, then also doesn't require you to add a new .text (or other section) directive. Preferably that way

Jan

#2 lore raw
Quoted 8 lines · Jan Beulich
Quoted 6 lines · Andrew Cooper

early_page_fault() needs to outside of #ifdef CONFIG_PV

Spotted by Gitlab CI.

Fixes fe3f50726e87 ("x86/entry: move .init.text section higher up in the code for readability")

Makes me wonder whether the original change then really was worth it.

It was, IMO.  In it's previous location, it was a single area of non .text.entry hidden in a large .text.entry block.

Quoted 24 lines
Quoted 11 lines
xen/arch/x86/x86_64/entry.S +4 -0
@@ -22,6 +22,17 @@
 #endif
 .endm
 
+        .section .init.text, "ax", @progbits
+ENTRY(early_page_fault)
+        ENDBR64
+        movl  $TRAP_page_fault, 4(%rsp)

xen/arch/x86/x86_64/entry.S line 38

Quoted 10 lines
xen/arch/x86/x86_64/entry.S +7 -0
+        SAVE_ALL
+        movq  %rsp, %rdi
+        call  do_early_page_fault
+        jmp   restore_all_xen
+
+        .text
+
 #ifdef CONFIG_PV
 /* %rbx: struct vcpu */
 switch_to_kernel:

Rather than putting it at the very top of the file, may I suggest to put it immediately after

Quoted 6 lines

/* --- CODE BELOW THIS LINE (MOSTLY) NOT GUEST RELATED --- */

or yet a few more lines down between continue_pv_domain and restore_all_xen? Which, as a minor gain, then also doesn't require you to add a new .text (or other section) directive. Preferably that way

Done.  Thanks.

~Andrew