Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3930802yba; Tue, 23 Apr 2019 11:58:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPU/eeveceCyJsD4J5u58XprprmZnMfDNlhVlMsDHliL+B6fC5Rw2mwwdcShGezvYhc9se X-Received: by 2002:a63:7444:: with SMTP id e4mr26615494pgn.261.1556045924695; Tue, 23 Apr 2019 11:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556045924; cv=none; d=google.com; s=arc-20160816; b=gtqjmcxcDuzYIK3jqsl4d4LuO3MybwDUzeEzOJglIzKV6jnrUq6yZkcRsK7zsMJ3g1 iRx+aY1iUhR0MQhZDT29AjpH2wCTr84wCi6ls0MRnQRHlJqMQNcQ3sq2BHxUtzGUsd6K SqPRuf3MXvherWgw8qVeuz4DwJhMeixx/qDQnfTyajBptuuxQiNMoHjenmiLBQfLwsmi vNtsFQdnvVgWrW8aYlZRNGgqUTLt3+8bt/J+3sIFJgjeE4ZTwa3hD9oEluqlYZIqvBY2 cSJRfg+4o6u35/mYflvj1l9xGRVnMoPVlgew/zo7d8gCtltBynPaIFnYCAZZkK2AOcbc OIxQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WoxsYSmFBK83nDtbePAM0iRr5J/WBY7aawmE+1nqSWU=; b=ORqBmii4I4loxfHcIq7CghfNMv6mGe9Qu+fFx1zoBDyvcg/fvj/wE1q28DEJzgZEwD 0F18ZOTtZqOTYStv9aeeHrCh5enDFtKbMEoPv6ntneh2Khb0uATboKz1JKgJ+vtXXiQd QY3ncHRVuRxiakCoBYh1XtWWSbVRX9sJjzE87XhhobsJ5N4QvJHSu699RmIBXLGCSMAJ 3Ho/bRs3H+7L7p3UETkPixaMlleBCzJi2vS52ViJ/YnLsqgSK+6OVgqn8HUncptzNxeF UKrSy6k89K6xNpyBS5AAoAqDveLxsjRTKmFk4FyhE0EAKu0/nsb7I2DyD46/+ULaMNpQ Ka8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=oz08JNOb; 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 k5si16285396plt.179.2019.04.23.11.58.28; Tue, 23 Apr 2019 11:58:44 -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=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=oz08JNOb; 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 S1726339AbfDWS5g (ORCPT + 99 others); Tue, 23 Apr 2019 14:57:36 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58254 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbfDWS5f (ORCPT ); Tue, 23 Apr 2019 14:57:35 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To: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=RN0XQkgq/cEqemXmsR1c9nfHJ1rGNIByolIqIOEwfo0=; b=oz08JNObfyO6dXxU2v/sLkdg+P byKZsA/E2yYq9X5GjAuorCDHZ6Y/aniARhJtGjNsQ6DUuBtpIJVYIRdCQ7GJU1DchAiT1PwdEP7BF 2XNHGlEhtCuPQlDaGD911d5fZG38DZFV7DwoVmuArFzLlgenrvld2NRj9sU6TvO8mXxbRms9Zhsax BtYVZqoozUoGNJr+izAgqe3XFH3ZgAFgaEbl+uMby3/x07Tg3T8DjXgbkvFYaEafGHUE1bPL68s4X WZt3bLy+cI9xLDZeFXvP4FrMZL99Q5RiTQCER0JnJyq3EYVzdKLfkOFu4Empigiw7Fpb/wSj+phrM LnZ1SDhw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJ0bi-0006mE-MZ; Tue, 23 Apr 2019 18:57:30 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8798929C3F389; Tue, 23 Apr 2019 20:57:28 +0200 (CEST) Date: Tue, 23 Apr 2019 20:57:28 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Randy Dunlap , akpm@linux-foundation.org, broonie@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-next@vger.kernel.org, mhocko@suse.cz, mm-commits@vger.kernel.org, sfr@canb.auug.org.au, Josh Poimboeuf , Linus Torvalds , Andy Lutomirski Subject: Re: mmotm 2019-04-19-14-53 uploaded (objtool) Message-ID: <20190423185728.GX14281@hirez.programming.kicks-ass.net> References: <20190419215358.WMVFXV3bT%akpm@linux-foundation.org> <20190423082448.GY11158@hirez.programming.kicks-ass.net> <20190423173912.GJ12232@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190423173912.GJ12232@hirez.programming.kicks-ass.net> 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 Tue, Apr 23, 2019 at 07:39:12PM +0200, Peter Zijlstra wrote: > On Tue, Apr 23, 2019 at 09:07:01AM -0700, Andy Lutomirski wrote: > > > diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h > > > index 22ba683afdc2..c82abd6e4ca3 100644 > > > --- a/arch/x86/include/asm/uaccess.h > > > +++ b/arch/x86/include/asm/uaccess.h > > > @@ -427,10 +427,11 @@ do { \ > > > ({ \ > > > __label__ __pu_label; \ > > > int __pu_err = -EFAULT; \ > > > - __typeof__(*(ptr)) __pu_val; \ > > > - __pu_val = x; \ > > > + __typeof__(*(ptr)) __pu_val = (x); \ > > > + __typeof__(ptr) __pu_ptr = (ptr); \ > > > > Hmm. I wonder if this forces the address calculation to be done > > before STAC, which means that gcc can’t use mov ..., %gs:(fancy > > stuff). It probably depends on how clever the optimizer is. Have you > > looked at the generated code? > > I have not; will do before posting the real patch. x86_64-defconfig using gcc-7.3: $ ./compare.sh defconfig-build defconfig-build1 vmlinux compat_fillonedir 228 227 -1,+0 copy_fpstate_to_sigframe 446 448 +2,+0 total 11374268 11374269 +1,+0 $ ./compare.sh defconfig-build defconfig-build1 vmlinux copy_fpstate_to_sigframe ... 0000 ffffffff81027448: 90 nop \ 0000 ffffffff81027448: 8b 15 92 75 a8 01 mov 0x1a87592(%rip),%edx 0000 ffffffff81027449: 90 nop \ 0000 ffffffff8102744a: R_X86_64_PC32 fpu_user_xstate_size-0x4 0000 ffffffff8102744a: 90 nop \ 0000 ffffffff8102744e: 48 01 da add %rbx,%rdx 0000 ffffffff8102744b: 8b 15 8f 75 a8 01 mov 0x1a8758f(%rip),%edx \ 0000 ffffffff81027451: 90 nop 0000 ffffffff8102744d: R_X86_64_PC32 fpu_user_xstate_size-0x4 \ 0000 ffffffff81027452: 90 nop 0000 ffffffff81027451: c7 04 13 45 58 50 46 movl $0x46505845,(%rbx,%rdx,1) \ 0000 ffffffff81027453: 90 nop 0000 ffffffff81027458: 31 d2 xor %edx,%edx \ 0000 ffffffff81027454: c7 02 45 58 50 46 movl $0x46505845,(%rdx) 0000 ffffffff8102745a: 90 nop \ 0000 ffffffff8102745a: 31 d2 xor %edx,%edx 0000 ffffffff8102745b: 90 nop \ 0000 ffffffff8102745c: 90 nop 0000 ffffffff8102745c: 90 nop \ 0000 ffffffff8102745d: 90 nop 0000 ffffffff8102745d: 90 nop \ 0000 ffffffff8102745e: 90 nop 0000 ffffffff8102745e: 90 nop \ 0000 ffffffff8102745f: 90 nop 0000 ffffffff8102745f: 90 nop \ 0000 ffffffff81027460: 90 nop 0000 ffffffff81027460: 90 nop \ 0000 ffffffff81027461: 90 nop 0000 ffffffff81027461: 90 nop \ 0000 ffffffff81027462: 90 nop 0000 ffffffff81027462: 90 nop \ 0000 ffffffff81027463: 90 nop 0000 ffffffff81027463: 31 c9 xor %ecx,%ecx \ 0000 ffffffff81027464: 90 nop ... So yes, it changes some code, but meh.