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/5f189fa41ad1
branches: trunk
changeset: 320487:5f189fa41ad1
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 9207a8ce948d -r 5f189fa41ad1 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