From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756722AbbCRVNY (ORCPT ); Wed, 18 Mar 2015 17:13:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43763 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755076AbbCRVNV (ORCPT ); Wed, 18 Mar 2015 17:13:21 -0400 Message-ID: <5509EA52.7080904@redhat.com> Date: Wed, 18 Mar 2015 22:12:50 +0100 From: Denys Vlasenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andy Lutomirski CC: Linus Torvalds , Steven Rostedt , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , X86 ML , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/3] x86: entry_64.S: use PUSH insns to build pt_regs on stack References: <1426708056-2785-1-git-send-email-dvlasenk@redhat.com> <1426708056-2785-2-git-send-email-dvlasenk@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/18/2015 10:01 PM, Andy Lutomirski wrote: > On Wed, Mar 18, 2015 at 12:47 PM, Denys Vlasenko wrote: >> We lose a number of large insns there: >> >> text data bss dec hex filename >> 9863 0 0 9863 2687 entry_64_before.o >> 9671 0 0 9671 25c7 entry_64.o >> >> What's more important, we convert two "MOVQ $imm,off(%rsp)" to "PUSH $imm" >> (the ones which fill pt_regs->cs,ss). >> >> Before this patch, placing them on fast path was slowing it down by two cycles: >> this form of MOV is very large, 12 bytes, and this probably reduces decode bandwidth >> to one insn per cycle when it meets them. >> Therefore they were living in FIXUP_TOP_OF_STACK instead (away from hot path). > > Does that mean that this has zero performance impact, or is it > actually a speedup? No, it's not a speedup because those big bad instructions weren't on hot path to begin with. We want them to be there. Inserting them in a form of MOVs into hot path (say, in order to eliminate FIXUP_TOP_OF_STACK) *would be* a slowdown. But we switch to PUSH method, and then inserting them _as PUSHes_ seems to be a wash.