Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp321626ybn; Tue, 1 Oct 2019 21:47:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoknZmItJnwN4P8N/krrxevx2ciuzV/ko62hUTHL32oiI+9PGmDJWIbpkeFQ1iNYA6oW7G X-Received: by 2002:a50:ab84:: with SMTP id u4mr1777749edc.13.1569991655143; Tue, 01 Oct 2019 21:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569991655; cv=none; d=google.com; s=arc-20160816; b=u/wz3C64oFwAnFuADu8p8MkLFc3Gcd2WyRd5UJRdhbwjtILSx3GOEsYptv+WJXdaiS 61a5CIhpzyLRfsW3LiqZZyCHfyWYSoJ2/hXuvKFe9rxbZKoUWLockzcov4pXbsTtf7GQ M6WG2dgtEyQbGNb6XTtctZgBSufYFf+cesUZtmhtL1N9/xEQIu4F12wVDutIaoUesV9w mQfgQZUmgYN+f5JzbVngXdSP20z79Pt4T8EPhtEapPwuzDccnuq7Uflwu5ptj3JoJcxm bbNYMXYeWimm1eVTqyOVKZHHSNjnFUdYwcj5ucyswgv/wl+y4f0JQJSBKAw80HzdCVFR G3UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=v7MUChZMPK1zb+gMXHU9XAGkO5pYjaFnqTcVSPFdTOk=; b=y+g9KpBlLKTLLr473n+ikJH6qSQR+HWCB3poj8RJHpq+J4LHd3rgtPze+HzEeEvUgQ YTtL7qWEZ4z0eoj/U3w3t4R/pj1xxQbHwHpS+/t0EUSxMao99zY/0C++fMARn6K6iI8f /I0BPEFtn/tIG31CGYwKyNCd7tHxHkIBOJItKUA14nHw0nqKi6kxlyyHYZabC9gsWrby SaZLphAWi5TkPhu8InQJwrsP2qvBFoklonb1LBtYhM4s9KGahQJIPddnlScKvOgOvIsL AmvBvNrBaCQJ0MameO2NcK1HsVFI8VixxkrNTMRistYcNqkbGSnKhWKcWmncfRX4pcL+ 9ckw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va9si2748998ejb.126.2019.10.01.21.47.10; Tue, 01 Oct 2019 21:47:35 -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; 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 S1726668AbfJAUx7 (ORCPT + 99 others); Tue, 1 Oct 2019 16:53:59 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46989 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfJAUx7 (ORCPT ); Tue, 1 Oct 2019 16:53:59 -0400 Received: by mail-qk1-f194.google.com with SMTP id 201so12679589qkd.13; Tue, 01 Oct 2019 13:53:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v7MUChZMPK1zb+gMXHU9XAGkO5pYjaFnqTcVSPFdTOk=; b=c7F0xiJipaPPKQhVLUiiwGsk7nbi53P01pVjsfR5Oh0x37OhzjUv3MVVQbleiEgRto MxT9q0mBQpA2HByGtCTZajKYhNG5fNHZIuam6bN4LDqDrBNshfnhlXLAWd6Wh6SaADYG W+2RkhYQ0Ngyn0vl2yGxCv3S5BTSvo4G/oYw07TttSWVY9BKRJ0ZflKLtPxzDmMoatF1 NKN/TlXN+zo+cPckiQBng+jRTxMTZPqQwEcr522ZaCnPEnFMVzjYisflxf1xrBpJbE27 fAdbWgpnuQ7xn0/dCuqvMR+MkDYoPRc59AlNoI62Pc+iZRqtlt3t2OrRxrpVeK0/SVwa 9+4A== X-Gm-Message-State: APjAAAV6L+b6yKh0IJIMmfsszF3NJJPoTdsemhW6DF6cOS0JIay/dZDY D+A+gESzpYBOGUapKnEqeD6EZPHE1WAb69FI8HA= X-Received: by 2002:a37:a858:: with SMTP id r85mr72574qke.394.1569963237942; Tue, 01 Oct 2019 13:53:57 -0700 (PDT) MIME-Version: 1.0 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> <20191001181438.GL25745@shell.armlinux.org.uk> In-Reply-To: From: Arnd Bergmann Date: Tue, 1 Oct 2019 22:53:41 +0200 Message-ID: Subject: Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly To: Nick Desaulniers Cc: Russell King - ARM Linux admin , 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 , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 1, 2019 at 10:21 PM 'Nick Desaulniers' via Clang Built Linux 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: > > 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. > > So there's a very important subtly here. There's: > 1. code that adds `inline` cause "oh maybe it would be nice to inline > this, but if it isn't no big deal" > 2. code that if not inlined is somehow not correct. > 3. avoid ODR violations via `static inline` > > I'll posit that "we have soo much that is marked inline [is > predominantly case 1 or 3, not case 2]." Case 2 is a code smell, and > requires extra scrutiny. 1. is clearly the most common case, but there is also 4. Some compiler version (possibly long gone, possibly still current) makes bad inlining decisions that result in horrible but functionally correct object code for a particular function, and forcing a function to be inlined results in what we had expected the compiler to do already. The problem with 2. is that they are largely not documented, and often unintentional. This also affects functions that are simply 'static' rather than 'static inline' but are broken when not being inlined. E.g. we've had a number of kernel bugs with 'static __init' functions that gcc always inlined into a non-__init caller, but that produced an invalid call into a discarded function when clang decided to leave them out of line. Arnd