Received: by 10.223.176.5 with SMTP id f5csp1049956wra; Fri, 9 Feb 2018 11:32:32 -0800 (PST) X-Google-Smtp-Source: AH8x2256kIuPMynt2vRyX6fQesv0DM8776evfW0ahfYm8NG9gYE0urLNt4XVFaLZsP974zcPdm76 X-Received: by 10.98.67.82 with SMTP id q79mr3874494pfa.144.1518204752156; Fri, 09 Feb 2018 11:32:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518204752; cv=none; d=google.com; s=arc-20160816; b=xhxdDWmmw+RCQt0K8vlwFiBtkGcRqFYMb3Ng7G+vP8y2cKKHqIkdLKq7431yhSd3dF hvt6J5CFH1Cmm2kOvBRSYXIRg9/X/RWyDeN5IuwjWjoP7f+EG4cDXkOsiszfeF7yepim 32IUVC7oka9q97+fwxR+NjzgdSA7iKoVzGceGHU/ESx0V4hV8qxzNdwjrfMK677ZUOYX uPx8Pey1SMxysWVQH+mB2QmZe5dZ292RgT1cDhcgoXRvp+L0zILzNFZB8sA2m3+n2o+P 4puZpOp+6uZ563mZO19T0oOEw18Xaln5eP3PnJxVKu/j9KiS6YgkmxNJAkTNgTUkEEiE M2jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=23adVBBkUNSiD70uO5DoUs4J9YYD/Oc0ixpW79NxSXc=; b=ERBIIMirzeWubd5cEBm+vxuweOVx1xCG4A9BmN0AYFsGZJX4SDIme7VL0baoLFoOot yM0WSSKMCkDlBPH3QvIXSm46bL2TzI6WgLAeHF4B6uZJg3Em3GivRl1H1iJ4TIUj1igB ugv1g6G4h4S/NXnBnmHPicTIXQMadH5HNIv//Sm2oASTxwFhpmjSwRI+Tyk4Hx2USqLD 8N1DJE4U3VlfFbRvph1jLxLiYao6ZOr4GiZPMCDLjjccBOiAZtoL99+ZKRlaRqiLqYm4 +Wtkwz+NviDJYvQsxd8n5q9GEVBJ27JWEGfPYUFaMCMrj72LOhbJM39NeHbxHpym5hap MPuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si2151346pfj.311.2018.02.09.11.32.18; Fri, 09 Feb 2018 11:32:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752871AbeBITbC (ORCPT + 99 others); Fri, 9 Feb 2018 14:31:02 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53930 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752403AbeBITbB (ORCPT ); Fri, 9 Feb 2018 14:31:01 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FD4A40363B6; Fri, 9 Feb 2018 19:31:00 +0000 (UTC) Received: from [10.43.17.120] (unknown [10.43.17.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53015100F9EF; Fri, 9 Feb 2018 19:30:56 +0000 (UTC) Subject: Re: [PATCH 09/31] x86/entry/32: Leave the kernel via trampoline stack 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 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 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 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 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 09 Feb 2018 19:31:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 09 Feb 2018 19:31:00 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dvlasenk@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.