Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp59716img; Thu, 21 Mar 2019 14:05:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoU1KFTukODq70oLXW1bSSrP6uQRYmx5sRMdzPzGZ0DQS3TWpNY33313lqhZWpsKsJlHyN X-Received: by 2002:a17:902:284b:: with SMTP id e69mr5566066plb.11.1553202308742; Thu, 21 Mar 2019 14:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553202308; cv=none; d=google.com; s=arc-20160816; b=DuDqxgMkx7qtYnfo2D6OCn3nwB/U7GNiC3JCwFE7Deilm68EF4a0qrN0u4KGWE6BdA 5q/96w/IBH5SWz6rs08ZDs4ieqNlpt1lQd40ZJFj7Q+LDniZtqAqS0+j8U188bHgn0q8 Zrkm2NtLxMKmcplLS5jXMkSF7UnsGLkAtr5vbitykZvhssr4jRmzExj4QgJh2Ij+SBvI x5dV7DezYFNISaJEOuCjOsYx/tz8hgLnWSKQEY4LvNUnkhfrwBUxleOyC1WNHUripbFk 82OVAQiKx+WG+9GrI2P+3vSezJlN+SKF8Qfabzyr051ywHrW7cmMVbxSZsmAIdaOwUO0 9vow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XLLrPHlC84DUyxUwAwrYQjiN/k4oVNNWVS2AaHdNgXc=; b=cMLVtQafPK0E4XKUdLSLjHRfWod8Yc5Op/x6WasIaIlI0W2o6QKvFgofMSkBk4Tw7m wBUII3UGxUWe/SU8q/0K7uDdE/0nHW2cqK1hKcuCBHOzM2YH2Dm6M4zNGbqsCVhJdxkQ j1WhzxHoVB7w6FnDs5jqlU19mGxaABh9RMopm/jqpyFsSPovd6YzleMx3ECIOBdLuo63 t1RNzz53kKZ0e45jCjlYyl+ZGSgLz+LHTcZgvkg7eF8mgPnvTZisPW1QFiI7zcWDm734 Inol3+q9S7Lkr0GP4S38h/Q3/gl9PCQN7N0GqHCOIr3xPUmbHW3fhipEk4pk0c12Ypt+ lq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RFNYtuMi; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si4829243pgr.456.2019.03.21.14.04.50; Thu, 21 Mar 2019 14:05:08 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=RFNYtuMi; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727099AbfCUVEF (ORCPT + 99 others); Thu, 21 Mar 2019 17:04:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48012 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbfCUVEF (ORCPT ); Thu, 21 Mar 2019 17:04:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XLLrPHlC84DUyxUwAwrYQjiN/k4oVNNWVS2AaHdNgXc=; b=RFNYtuMiQ/KCJXoem/+msq8PR VB5ri1d3xbuCv2G21/cB9Ui/CI7mS8d2SMcXZlfA2NdosemlIMF5ZoHVG6tm43qrYMB2Bk3mx6Py4 dQvVHEjop/lU/BQehIdShB4aADJpLzv/mz6XktH3d8bM06GVQs5B3M9tiCqAAvUJyofdN0de66YM1 4HM9ZgG7vcTBawBOLSRiUcisFoZwUAhHcEF5v0sBr4Feo/OMku+dYZYgCqQncKnPiK4YxbdaSFQbF V6395txZR/VecKKFSXO15evOC0JJ/hroaly2lZpiDGcqLDB1TroOzMvTd2Sqkj3VzzBg5Wne2PYKw gbvZz6+5A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h74qv-0005hq-BF; Thu, 21 Mar 2019 21:03:53 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id E430B984EEA; Thu, 21 Mar 2019 22:03:50 +0100 (CET) Date: Thu, 21 Mar 2019 22:03:50 +0100 From: Peter Zijlstra To: hpa@zytor.com Cc: Denys Vlasenko , Linus Torvalds , Thomas Gleixner , Julien Thierry , Will Deacon , Andy Lutomirski , Ingo Molnar , Catalin Marinas , James Morse , valentin.schneider@arm.com, Brian Gerst , Josh Poimboeuf , Andrew Lutomirski , Borislav Petkov , Linux List Kernel Mailing , Dmitry Vyukov , Steven Rostedt Subject: Re: [PATCH 01/25] x86: Make SMAP 64-bit only Message-ID: <20190321210350.GF2490@worktop.programming.kicks-ass.net> References: <20190318153840.906404905@infradead.org> <20190318155139.963285969@infradead.org> <20190318173657.GV6058@hirez.programming.kicks-ass.net> <20190318175135.GE6521@hirez.programming.kicks-ass.net> <33D32634-51DC-426D-BE4A-F78B862760D5@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33D32634-51DC-426D-BE4A-F78B862760D5@zytor.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 21, 2019 at 11:18:05AM -0700, hpa@zytor.com wrote: > On March 21, 2019 10:25:05 AM PDT, Denys Vlasenko wrote: > >I did not see evidence of this. In my testing, > >POPF is always ~20 cycles, even if popped flags are identical to > >current state of flags. > > I think you will find that if you change system flags it is much slower. So with all the patches in this series applied, only x86_32 will suffer this, and I don't think anybody still considers that a performance critical platform. That said, we could do something terrible like: --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -673,7 +673,8 @@ ENTRY(__switch_to_asm) #endif /* restore callee-saved registers */ - popfl + ALTERNATIVE "popl %esi", \ + "popfl", X86_FEATURE_SMAP popl %esi popl %edi popl %ebx And then you only pay the POPF penalty when you run a 32bit kernel on a SMAP enabled CPU, and we have a very good solution in that code: run a 64bit kernel.