Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8660322ybn; Tue, 1 Oct 2019 11:15:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEY+NVBkUz6oGzN+EHP2ws3j8cR5BFX84xyDFjfqLqBxvQj4g89VxQ6V3vMvlgjcOObfV2 X-Received: by 2002:a17:906:c4b:: with SMTP id t11mr135676ejf.131.1569953743552; Tue, 01 Oct 2019 11:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569953743; cv=none; d=google.com; s=arc-20160816; b=V/FgLwwyoAlh2UYcu72LAQ+i/+vjwmgXhyqtaev5bGoYNWa37k2NPT1PL9XsSLCsq4 G0W4f2mTIS2xoyNBD8Yz7UilgyTWtrqrSnsNVg7slosv7Io6pjXEvTvh/5Tp+cGC+MBh IiqlGU2RznhuFlPm8Z31vhCDJ868i4rf8Kw3A17t1YrCTBTGuJE2yDpYpXFu2rYHWTAT xv+M6LRzggOyw2XejqpXesN/bSL6T6YJ0n8z5UBVAOFEB/Rsdof5TpJ3J4FX+5i5PmBv BbGVpOPZrJfJ+N3Ph75XTqS6dHYREHD9GsIQQrk/0L3YK04Ng55BiPleXlOIPl1/AWqL 5GeA== 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=oyrPcS1XZC4Pko5i+y1zI+x6hEJkNLxplC2J3GMNc+E=; b=lIihDoqMgM34ixPF1TimrnRSh8mrNNhmku3KpQ0phHPRVgHCJ4FL3ie7YUpDEBk0R4 b3vahQ2cxyruH8iXVZ7/mCphSXdDKs7d++g37g3i44uWn4s1Ifq3a2dq8c/yBpkPb63r V9u14jkuN2w+uNv6fL5kQhyk6boFe7fAdzQT1se8NdyRvugVTE3ere3OCzKR/gTdom9B l1wBqxmYfCHYJO0ve/vRt3g9cf0SNahxZnCOJE3URKRn51dVWhYht1liVb5+i9l9pd1B n/vDspOTvTUD3ipaIRItXO/LNZ/Q/uM6Q1htKhpvEgn7wy3QsrlR00kFOAzDmXxWyQVI LOEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=xkPaWta5; 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=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y50si5372628edd.237.2019.10.01.11.15.18; Tue, 01 Oct 2019 11:15:43 -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=@armlinux.org.uk header.s=pandora-2019 header.b=xkPaWta5; 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=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731948AbfJASOv (ORCPT + 99 others); Tue, 1 Oct 2019 14:14:51 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:42066 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727012AbfJASOv (ORCPT ); Tue, 1 Oct 2019 14:14:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: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=w+T1a8PNiMrEGlMgZvzDIbmdQ/0XfekRvvWFfZpowuQ=; b=xkPaWta5X24XMC5QwKitp/bpH /NN+CAbcvl4+3mfj3dRutfLjv1WrsrPUKv89jKoibs6xbo8LuOIPc0ep0grD8FzYnWAm1Vjoup9Mo BMdBWurQvLS1c9SF/OrVS8tZGaTtzPcruXTHc3cPJYd1bxkDUpCvOdKcHeHNeswKNWWMlyOzuP1U3 K7S6t1a9PDNQ7cwC1IYOlUBijcJ1wyoxWwNW5LD7E/3ubWnqpArBIP6huXj5NfoX2X0fPQ9cJ+U8L 62+qTsLAtRiWlgpCKbOUEYi4x142ss2cmwl/u60WWTjUaSWEIYyfTMq+dUl1MfAmxnpqcOQgsci/t 8WT9EV7lw==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:38854) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iFMfX-0003xe-Tn; Tue, 01 Oct 2019 19:14:40 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1iFMfW-0008Pf-5T; Tue, 01 Oct 2019 19:14:38 +0100 Date: Tue, 1 Oct 2019 19:14:38 +0100 From: Russell King - ARM Linux admin To: Nick Desaulniers Cc: Will Deacon , Masahiro Yamada , Linus Torvalds , Nicolas Saenz Julienne , Andrew Morton , Ingo Molnar , Borislav Petkov , Miguel Ojeda , linux-arch , LKML , Catalin Marinas , Stefan Wahren , Kees Cook Subject: Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly Message-ID: <20191001181438.GL25745@shell.armlinux.org.uk> References: <20190930112636.vx2qxo4hdysvxibl@willie-the-truck> <20190930121803.n34i63scet2ec7ll@willie-the-truck> <20191001092823.z4zhlbwvtwnlotwc@willie-the-truck> <20191001170142.x66orounxuln7zs3@willie-the-truck> <20191001175512.GK25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, 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. Moving it before the assignments mean that the compiler is then free to issue memory loads/stores to load up those registers, which is exactly what we want to avoid. In any case, I violently disagree with the idea that stuff we have in header files should be permitted not to be inlined because we have soo much that is marked inline. Having it moved out of line, and essentially the same function code appearing in multiple C files is really not an improvement over the current situation with excessive use of inlining. Anyone who has looked at the code resulting from dma_map_single() will know exactly what I'm talking about, which is way in excess of the few instructions we have for the uaccess_* stuff here. The right approach is to move stuff out of line - and by that, I mean _actually_ move the damn code, so that different compilation units can use the same instructions, and thereby gain from the whole point of an instruction cache. The whole "let's make inline not really mean inline" is nothing more than a band-aid to the overuse (and abuse) of "inline". -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up