diff mbox series

[1/8] x86/spec-ctrl: Fix confusion between SPEC_CTRL_EXIT_TO_XEN{,_IST}

Message ID 20230913202758.508225-2-andrew.cooper3@citrix.com (mailing list archive)
State Superseded
Headers show
Series x86/spec-ctrl: AMD DIV fix, and VERW prerequisite bugfixes | expand

Commit Message

Andrew Cooper Sept. 13, 2023, 8:27 p.m. UTC
c/s 3fffaf9c13e9 ("x86/entry: Avoid using alternatives in NMI/#MC paths")
dropped the only user, leaving behind the (incorrect) implication that Xen had
split exit paths.

Delete the unused SPEC_CTRL_EXIT_TO_XEN and rename SPEC_CTRL_EXIT_TO_XEN_IST
to SPEC_CTRL_EXIT_TO_XEN for consistency.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 8 +-------
 xen/arch/x86/x86_64/entry.S              | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)


base-commit: 6aa25c32180ab59081c73bae4c568367d9133a1f

Comments

Jan Beulich Sept. 14, 2023, 6:56 a.m. UTC | #1
On 13.09.2023 22:27, Andrew Cooper wrote:
> c/s 3fffaf9c13e9 ("x86/entry: Avoid using alternatives in NMI/#MC paths")
> dropped the only user, leaving behind the (incorrect) implication that Xen had
> split exit paths.
> 
> Delete the unused SPEC_CTRL_EXIT_TO_XEN and rename SPEC_CTRL_EXIT_TO_XEN_IST
> to SPEC_CTRL_EXIT_TO_XEN for consistency.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
albeit ...

> @@ -256,11 +255,6 @@
>      ALTERNATIVE "", __stringify(DO_SPEC_CTRL_ENTRY maybexen=1),         \
>          X86_FEATURE_SC_MSR_PV
>  
> -/* Use when exiting to Xen context. */
> -#define SPEC_CTRL_EXIT_TO_XEN                                           \
> -    ALTERNATIVE "",                                                     \
> -        DO_SPEC_CTRL_EXIT_TO_XEN, X86_FEATURE_SC_MSR_PV
> -
>  /* Use when exiting to PV guest context. */
>  #define SPEC_CTRL_EXIT_TO_PV                                            \
>      ALTERNATIVE "",                                                     \
> @@ -328,7 +322,7 @@ UNLIKELY_DISPATCH_LABEL(\@_serialise):
>  .endm
>  
>  /* Use when exiting to Xen in IST context. */
> -.macro SPEC_CTRL_EXIT_TO_XEN_IST
> +.macro SPEC_CTRL_EXIT_TO_XEN

... with the comment her updated (either by dropping "in IST" or by
explicitly mentioning both cases).

Jan
Andrew Cooper Sept. 14, 2023, 9:54 a.m. UTC | #2
On 14/09/2023 7:56 am, Jan Beulich wrote:
> On 13.09.2023 22:27, Andrew Cooper wrote:
>> c/s 3fffaf9c13e9 ("x86/entry: Avoid using alternatives in NMI/#MC paths")
>> dropped the only user, leaving behind the (incorrect) implication that Xen had
>> split exit paths.
>>
>> Delete the unused SPEC_CTRL_EXIT_TO_XEN and rename SPEC_CTRL_EXIT_TO_XEN_IST
>> to SPEC_CTRL_EXIT_TO_XEN for consistency.
>>
>> No functional change.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> albeit ...
>
>> @@ -256,11 +255,6 @@
>>      ALTERNATIVE "", __stringify(DO_SPEC_CTRL_ENTRY maybexen=1),         \
>>          X86_FEATURE_SC_MSR_PV
>>  
>> -/* Use when exiting to Xen context. */
>> -#define SPEC_CTRL_EXIT_TO_XEN                                           \
>> -    ALTERNATIVE "",                                                     \
>> -        DO_SPEC_CTRL_EXIT_TO_XEN, X86_FEATURE_SC_MSR_PV
>> -
>>  /* Use when exiting to PV guest context. */
>>  #define SPEC_CTRL_EXIT_TO_PV                                            \
>>      ALTERNATIVE "",                                                     \
>> @@ -328,7 +322,7 @@ UNLIKELY_DISPATCH_LABEL(\@_serialise):
>>  .endm
>>  
>>  /* Use when exiting to Xen in IST context. */
>> -.macro SPEC_CTRL_EXIT_TO_XEN_IST
>> +.macro SPEC_CTRL_EXIT_TO_XEN
> ... with the comment her updated (either by dropping "in IST" or by
> explicitly mentioning both cases).

The comment is rewritten from scratch in patch 4.  I'm not moving that
rewrite to here, and the comment isn't technically wrong to begin with,
but I suppose I can drop the IST part.  Just means more churn.

~Andrew
diff mbox series

Patch

diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index f48f9e75e8dc..14ec40e8d32f 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -67,7 +67,6 @@ 
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
- *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
  *
@@ -256,11 +255,6 @@ 
     ALTERNATIVE "", __stringify(DO_SPEC_CTRL_ENTRY maybexen=1),         \
         X86_FEATURE_SC_MSR_PV
 
-/* Use when exiting to Xen context. */
-#define SPEC_CTRL_EXIT_TO_XEN                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_XEN, X86_FEATURE_SC_MSR_PV
-
 /* Use when exiting to PV guest context. */
 #define SPEC_CTRL_EXIT_TO_PV                                            \
     ALTERNATIVE "",                                                     \
@@ -328,7 +322,7 @@  UNLIKELY_DISPATCH_LABEL(\@_serialise):
 .endm
 
 /* Use when exiting to Xen in IST context. */
-.macro SPEC_CTRL_EXIT_TO_XEN_IST
+.macro SPEC_CTRL_EXIT_TO_XEN
 /*
  * Requires %rbx=stack_end
  * Clobbers %rax, %rcx, %rdx
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 81dd2c74b876..a1c860f56949 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -673,7 +673,7 @@  UNLIKELY_START(ne, exit_cr3)
 UNLIKELY_END(exit_cr3)
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_XEN_IST /* Req: %rbx=end, Clob: acd */
+        SPEC_CTRL_EXIT_TO_XEN     /* Req: %rbx=end, Clob: acd */
 
         RESTORE_ALL adj=8
         iretq