[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 6/8] x86: enable interrupts earlier with XPTI disabled



The STI instances were moved (or added in the INT80 case) to meet TLB
flush requirements. When XPTI is disabled, they can be put back where
they were (or omitted in the INT80 case).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v4: Split off from earlier patch.
---
TBD: It is questionable whether having two back-to-back alternatives
     keyed to the same feature is a good idea. The original patch had
     them as a single instance each, but the variant here requires fewer
     (explicit) labels and hence results in overall more readable code.

--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -194,7 +194,7 @@ ENTRY(compat_post_handle_exception)
 
 /* See lstar_enter for entry register state. */
 ENTRY(cstar_enter)
-        /* sti could live here when we don't switch page tables below. */
+        ALTERNATIVE nop, sti, X86_FEATURE_NO_XPTI
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
         movq  $FLAT_KERNEL_SS,8(%rsp)
@@ -220,7 +220,7 @@ ENTRY(cstar_enter)
         mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
 .Lcstar_cr3_okay:
         ALTERNATIVE_NOP .Lcstar_cr3_start, .Lcstar_cr3_okay, 
X86_FEATURE_NO_XPTI
-        sti
+        ALTERNATIVE sti, "", X86_FEATURE_NO_XPTI
 
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
         movq  VCPU_domain(%rbx),%rcx
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -245,7 +245,7 @@ UNLIKELY_END(exit_cr3)
  * %ss must be saved into the space left by the trampoline.
  */
 ENTRY(lstar_enter)
-        /* sti could live here when we don't switch page tables below. */
+        ALTERNATIVE nop, sti, X86_FEATURE_NO_XPTI
         movq  8(%rsp),%rax /* Restore %rax. */
         movq  $FLAT_KERNEL_SS,8(%rsp)
         pushq %r11
@@ -270,7 +270,7 @@ ENTRY(lstar_enter)
         mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
 .Llstar_cr3_okay:
         ALTERNATIVE_NOP .Llstar_cr3_start, .Llstar_cr3_okay, 
X86_FEATURE_NO_XPTI
-        sti
+        ALTERNATIVE sti, "", X86_FEATURE_NO_XPTI
 
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
         testb $TF_kernel_mode,VCPU_thread_flags(%rbx)
@@ -281,7 +281,7 @@ ENTRY(lstar_enter)
         jmp   test_all_events
 
 ENTRY(sysenter_entry)
-        /* sti could live here when we don't switch page tables below. */
+        ALTERNATIVE nop, sti, X86_FEATURE_NO_XPTI
         pushq $FLAT_USER_SS
         pushq $0
         pushfq
@@ -310,7 +310,7 @@ GLOBAL(sysenter_eflags_saved)
         mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
 .Lsyse_cr3_okay:
         ALTERNATIVE_NOP .Lsyse_cr3_start, .Lsyse_cr3_okay, X86_FEATURE_NO_XPTI
-        sti
+        ALTERNATIVE sti, "", X86_FEATURE_NO_XPTI
 
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
         cmpb  $0,VCPU_sysenter_disables_events(%rbx)
@@ -363,7 +363,7 @@ ENTRY(int80_direct_trap)
         mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
 .Lint80_cr3_okay:
         ALTERNATIVE_NOP .Lint80_cr3_start, .Lint80_cr3_okay, 
X86_FEATURE_NO_XPTI
-        sti
+        ALTERNATIVE sti, "", X86_FEATURE_NO_XPTI
 
         cmpb  $0,untrusted_msi(%rip)
 UNLIKELY_START(ne, msi_check)




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.