Re: [PATCH 3/4] x86: save user rsp in pt_regs->sp on SYSCALL64 fastpath
From: Denys Vlasenko
Date: Tue Mar 10 2015 - 10:00:52 EST
On Tue, Mar 10, 2015 at 2:26 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> usersp is IMO tolerable. The nasty thing is the FIXUP_TOP_OF_STACK /
> RESTORE_TOP_OF_STACK garbage, and this patch is the main step toward
> killing that off completely. I've still never convinced myself that
> there aren't ptrace-related info leaks in there.
> Denys, did you ever benchmark what happens if we use push instead of
> mov? I bet that we get that cycle back and more, not to mention much
> less icache usage.
Yes, I did.
Push conversion seems to perform the same as current, MOV-based code.
The expected win there that we lose two huge 12-byte insns
which store __USER_CS and __USER_DS in iret frame.
MOVQ imm,ofs(%rsp) has a very unfortunate encoding in x86:
- needs REX prefix
- no sing-extending imm8 form exists for it
- ofs in our case can't fit into 8 bits
- (%esp) requires SIB byte
In my tests, each such instruction adds one cycle.
Compare this to PUSH imm8, which is 2 bytes only.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/