From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id E4BB96B0068 for ; Fri, 9 Feb 2018 14:31:01 -0500 (EST) Received: by mail-qk0-f200.google.com with SMTP id l73so2259930qke.9 for ; Fri, 09 Feb 2018 11:31:01 -0800 (PST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id h190si2977454qkc.177.2018.02.09.11.31.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 11:31:01 -0800 (PST) Subject: Re: [PATCH 09/31] x86/entry/32: Leave the kernel via trampoline stack References: <1518168340-9392-1-git-send-email-joro@8bytes.org> <1518168340-9392-10-git-send-email-joro@8bytes.org> <20180209190226.lqh6twf7thfg52cq@suse.de> From: Denys Vlasenko Message-ID: <4a047ea5-7717-d089-48bf-597434be7c4c@redhat.com> Date: Fri, 9 Feb 2018 20:30:55 +0100 MIME-Version: 1.0 In-Reply-To: <20180209190226.lqh6twf7thfg52cq@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Joerg Roedel , Linus Torvalds Cc: Joerg Roedel , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , the arch/x86 maintainers , Linux Kernel Mailing List , linux-mm , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek On 02/09/2018 08:02 PM, Joerg Roedel wrote: > On Fri, Feb 09, 2018 at 09:05:02AM -0800, Linus Torvalds wrote: >> On Fri, Feb 9, 2018 at 1:25 AM, Joerg Roedel wrote: >>> + >>> + /* Copy over the stack-frame */ >>> + cld >>> + rep movsb >> >> Ugh. This is going to be horrendous. Maybe not noticeable on modern >> CPU's, but the whole 32-bit code is kind of pointless on a modern CPU. >> >> At least use "rep movsl". If the kernel stack isn't 4-byte aligned, >> you have issues. > > Okay, I used movsb because I remembered that being the recommendation > for the most efficient memcpy, and it safes me an instruction. But that > is probably only true on modern CPUs. It's fast (copies data with full-width loads and stores, up to 64-byte wide on latest Intel CPUs), but this kicks in only for largish blocks. In your case, you are copying less than 100 bytes. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org