From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754493AbeBGUoo (ORCPT ); Wed, 7 Feb 2018 15:44:44 -0500 Received: from mail-it0-f45.google.com ([209.85.214.45]:34995 "EHLO mail-it0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754154AbeBGUom (ORCPT ); Wed, 7 Feb 2018 15:44:42 -0500 X-Google-Smtp-Source: AH8x225U2JYkhFVoyZmSw5PVSsQKrI0CJ9FwYuiHMP1GlgwhthiupD8N2gUM7Ai31RI1DvQYcikFn4IL3yuuglaCngM= MIME-Version: 1.0 In-Reply-To: <20180207201517.6518-7-linux@dominikbrodowski.net> References: <20180207201517.6518-1-linux@dominikbrodowski.net> <20180207201517.6518-7-linux@dominikbrodowski.net> From: Linus Torvalds Date: Wed, 7 Feb 2018 12:44:41 -0800 X-Google-Sender-Auth: JciNhwhCqnbaG7QyMYSh5twvAto Message-ID: Subject: Re: [RFC v2 PATCH 6/7] x86/entry: get rid of ALLOC_PT_GPREGS_ON_STACK and SAVE_AND_CLEAR_REGS To: Dominik Brodowski Cc: Linux Kernel Mailing List , Ingo Molnar , "the arch/x86 maintainers" , Dan Williams , Thomas Gleixner , Andi Kleen , Andrew Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 7, 2018 at 12:15 PM, Dominik Brodowski wrote: > > Note: The testb $3, CS(%rsp) instruction in idtentry() does not need > modification. Previously %rsp was manually decreased by 15*8; with > this patch, %rsp is decreased by 15 pushq instructions. Moreover, > error_entry did and does the exact same test (with offset=8) after > the registers have been moved/pushed and cleared. So this has the problem that now those save/clear instructions will all be done in that idtentry macro. So now that code will be duplicated for all the users of that macro. The old code did the saving in the common error_entry and paranoid_entry routines, in order to be able to share all the code, and making the duplicated stub functions generated by the idtentry macro smaller. Now, admittedly the new push sequence is much smaller than the old movq sequence, so the duplication doesn't hurt as much, but it's still likely quite noticeable. So this removes lines of asm code, but it adds a lot of instructions to the end result thanks to the macro, I think. Linus