amd64: only check for error != 0 in the inlined part of l1d flush check

this replaces the following near the syscall exit:
cmp    $0x39,%rax
ja     0xffffffff8108f82c
movabs $0x200001800060005,%rcx
bt     %rax,%rcx
jae    0xffffffff8108f82c

with:
test   %edi,%edi
jne    0xffffffff8091a49c
This commit is contained in:
Mateusz Guzik 2020-02-14 13:14:19 +00:00
parent 2f7292437d
commit ed8cd4795c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357914

View File

@ -1068,25 +1068,32 @@ flush_l1d_hw(void)
wrmsr(MSR_IA32_FLUSH_CMD, IA32_FLUSH_CMD_L1D);
}
static void __inline
amd64_syscall_ret_flush_l1d_inline(int error)
static void __noinline
amd64_syscall_ret_flush_l1d_check(int error)
{
void (*p)(void);
if (error != 0 && error != EEXIST && error != EAGAIN &&
error != EXDEV && error != ENOENT && error != ENOTCONN &&
error != EINPROGRESS) {
p = syscall_ret_l1d_flush;
if (error != EEXIST && error != EAGAIN && error != EXDEV &&
error != ENOENT && error != ENOTCONN && error != EINPROGRESS) {
p = (void *)atomic_load_ptr(&syscall_ret_l1d_flush);
if (p != NULL)
p();
}
}
static void __inline
amd64_syscall_ret_flush_l1d_check_inline(int error)
{
if (__predict_false(error != 0))
amd64_syscall_ret_flush_l1d_check(error);
}
void
amd64_syscall_ret_flush_l1d(int error)
{
amd64_syscall_ret_flush_l1d_inline(error);
amd64_syscall_ret_flush_l1d_check_inline(error);
}
void
@ -1190,5 +1197,5 @@ amd64_syscall(struct thread *td, int traced)
if (__predict_false(td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS))
set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
amd64_syscall_ret_flush_l1d_inline(td->td_errno);
amd64_syscall_ret_flush_l1d_check_inline(td->td_errno);
}