Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1169837ybn; Wed, 2 Oct 2019 11:53:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwURcpHSLGOctU11F8/7NgEg1KLNDrizvip0Pgbu7lX/1HOp2ErHVWAgsLed2OuY1fz7iCV X-Received: by 2002:a17:906:fac5:: with SMTP id lu5mr4390838ejb.71.1570042385023; Wed, 02 Oct 2019 11:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570042385; cv=none; d=google.com; s=arc-20160816; b=Jvj9Wtfg3NhOabGng+GKr2kFPOoZV3RMtJVrUsmK9/SCRd5ijNdllz2V6m0tsFfc2r XEEh3L24AzGKAwLqmvGMWHuxc9XFfs+wYo8Tb/xA0MAeYfop38R7MkiVlLR3Avdnby+C Cd8mkMXdUdJBkeKko/RERxCTuxM/uBytMdycpfqhdHd6Grn9PtNJOxv/KQPIviXM1a1y mCqDBf4wV/ra4OfKJh4vgvYnzHG4lHhuOUQJiC4PDGdKW3PxokOaHlfbCBRHxwr1UTwD 4z8jBX+hR1s+C3Uw2EuVZ6zv6u4PsuRVb/z/DHxcA+ftXIWbI8Z387iAhXZwYWR1/JP5 tf7A== 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=QwuFckpQ+Wws5r8c2yjk+eQUyJUiFbpdGKgWzBTS3xw=; b=BHt2ZO0ynOpSGmJ5Jgs2d16Ft/eWtl13dVBL/sKrcyD39yEgWu2TypMoVInYSm1/ND k/ETV4FIG3VZrv1hTPdUH8KcnMGZ3bDpFqLIl0NvZHFzBgehYmagufSRjquz6wMzMUKv duV9b3LT90HfkN/aKOAsfSHQNEGjh4X9rhBMSO5mPsfr+SFk+35lmcbxqVOnRZfzsXgk SQzMo+VEx8m9mg8qxjnpMngFBa1ca1nqaEaMOA5dXFT5KAVU9iPb5X/OQ6Uoqiqfq8V2 7ldnxDGKSaYsUhGrV7TyPws0mll2TAMiXTDkh1qlx5fVUHdkU22BD63ZLxMFN2DgmLmX nDNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2jKtiPHB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si10990645eju.71.2019.10.02.11.52.39; Wed, 02 Oct 2019 11:53:04 -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=pass header.i=@kernel.org header.s=default header.b=2jKtiPHB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728701AbfJBSvl (ORCPT + 99 others); Wed, 2 Oct 2019 14:51:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:59688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfJBSvl (ORCPT ); Wed, 2 Oct 2019 14:51:41 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F2ED21A4C; Wed, 2 Oct 2019 18:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570042300; bh=CRQhS30YGps7394nDLglJ442PO7GILfwsW96COK8hZA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2jKtiPHBM4opCi8aDykOrFKWS3TvFjuWgksMPKcN/llJii5FgB1youQL+qF2c77I2 Py+wnMifC2SjORaWtWQzOqj1TNZQbAjIQj/DOrLGEZszPwa1f0Tk7RpUQf1h/5BTAK RX4szP/nOWesKrzE1/RKdgpHwveT8zH76rrKkQWw= Date: Wed, 2 Oct 2019 19:51:33 +0100 From: Will Deacon To: Geert Uytterhoeven Cc: Nick Desaulniers , Russell King - ARM Linux admin , Masahiro Yamada , Linus Torvalds , Nicolas Saenz Julienne , Andrew Morton , Ingo Molnar , Borislav Petkov , Miguel Ojeda , linux-arch , LKML , Catalin Marinas , Stefan Wahren , Kees Cook , Arnd Bergmann , clang-built-linux Subject: Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly Message-ID: <20191002185133.n6pldb4exyjfesfh@willie-the-truck> References: <20191001092823.z4zhlbwvtwnlotwc@willie-the-truck> <20191001170142.x66orounxuln7zs3@willie-the-truck> <20191001175512.GK25745@shell.armlinux.org.uk> <20191001181438.GL25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 02, 2019 at 02:55:50PM +0200, Geert Uytterhoeven wrote: > On Wed, Oct 2, 2019 at 6:33 AM Nick Desaulniers wrote: > > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > > wrote: > > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > > > > On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin > > > > wrote: > > > > > On Tue, Oct 01, 2019 at 10:44:43AM -0700, Nick Desaulniers wrote: > > > > > > I apologize; I don't mean to be difficult. I would just like to avoid > > > > > > surprises when code written with the assumption that it will be > > > > > > inlined is not. It sounds like we found one issue in arm32 and one in > > > > > > arm64 related to outlining. If we fix those two cases, I think we're > > > > > > close to proceeding with Masahiro's cleanup, which I view as a good > > > > > > thing for the health of the Linux kernel codebase. > > > > > > > > > > Except, using the C preprocessor for this turns the arm32 code into > > > > > yuck: > > > > > > > > > > 1. We'd need to turn get_domain() and set_domain() into multi-line > > > > > preprocessor macro definitions, using the GCC ({ }) extension > > > > > so that get_domain() can return a value. > > > > > > > > > > 2. uaccess_save_and_enable() and uaccess_restore() also need to > > > > > become preprocessor macro definitions too. > > > > > > > > > > So, we end up with multiple levels of nested preprocessor macros. > > > > > When something goes wrong, the compiler warning/error message is > > > > > going to be utterly _horrid_. > > > > > > > > That's why I preferred V1 of Masahiro's patch, that fixed the inline > > > > asm not to make use of caller saved registers before calling a > > > > function that might not be inlined. > > > > > > ... which I objected to based on the fact that this uaccess stuff is > > > supposed to add protection against the kernel being fooled into > > > accessing userspace when it shouldn't. The whole intention there is > > > that [sg]et_domain(), and uaccess_*() are _always_ inlined as close > > > as possible to the call site of the accessor touching userspace. > > > > Then use the C preprocessor to force the inlining. I'm sorry it's not > > as pretty as static inline functions. > > Which makes us lose the baby^H^H^H^Htype checking performed > on function parameters, requiring to add more ugly checks. Indeed, and the resulting mess is (at least in my opinion) considerably worse than where we were in 5.3 and earlier kernels with 'inline' defined as '__always_inline'. Will