Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/amd64 Small optimization: don't execute the M...



details:   https://anonhg.NetBSD.org/src/rev/d0e3fedb23f8
branches:  trunk
changeset: 363067:d0e3fedb23f8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jul 09 18:43:05 2018 +0000

description:
Small optimization: don't execute the Meltdown/SpectreV2 cswitch code if
we're leaving a softint. We were executing the softint with the LWP's
context, so no need to switch the SVS/IBRS contexts, we already are in
the desired contexts.

diffstat:

 sys/arch/amd64/amd64/locore.S |  40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)

diffs (61 lines):

diff -r 6e84bbba9385 -r d0e3fedb23f8 sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Mon Jul 09 14:54:01 2018 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Mon Jul 09 18:43:05 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.167 2018/06/29 19:21:43 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.168 2018/07/09 18:43:05 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -1088,26 +1088,6 @@
        movq    %rbp,PCB_RBP(%rax)
 .Lskip_save:
 
-#ifdef SVS
-       pushq   %rdx
-       movb    _C_LABEL(svs_enabled),%dl
-       testb   %dl,%dl
-       jz      .Lskip_svs
-       callq   _C_LABEL(svs_lwp_switch)
-.Lskip_svs:
-       popq    %rdx
-
-       /* RDI/RSI got clobbered. */
-       movq    %r13,%rdi
-       movq    %r12,%rsi
-#endif
-
-#ifndef XEN
-       pushq   %rdx
-       callq   _C_LABEL(speculation_barrier)
-       popq    %rdx
-#endif
-
        /* Switch to newlwp's stack. */
        movq    L_PCB(%r12),%r14
        movq    PCB_RSP(%r14),%rsp
@@ -1124,6 +1104,24 @@
        testb   %dl,%dl         /* returning = true ? */
        jnz     .Lswitch_return
 
+#ifdef SVS
+       pushq   %rdx
+       movb    _C_LABEL(svs_enabled),%dl
+       testb   %dl,%dl
+       jz      .Lskip_svs
+       callq   _C_LABEL(svs_lwp_switch)
+.Lskip_svs:
+       popq    %rdx
+#endif
+
+#ifndef XEN
+       pushq   %rdx
+       movq    %r13,%rdi
+       movq    %r12,%rsi
+       callq   _C_LABEL(speculation_barrier)
+       popq    %rdx
+#endif
+
        /* Switch ring0 stack */
 #ifdef SVS
        movb    _C_LABEL(svs_enabled),%al



Home | Main Index | Thread Index | Old Index