Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp552304imj; Sat, 9 Feb 2019 03:20:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IbzlOU56ypoit8xNR7Yd+a7C2STqEwgL9gLQilxKpj1As2A2fsGk/JRuw5AVvmEQnWhQMT7 X-Received: by 2002:a63:2e88:: with SMTP id u130mr25358297pgu.9.1549711233067; Sat, 09 Feb 2019 03:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549711233; cv=none; d=google.com; s=arc-20160816; b=CV//Jh8uShMN2kMWDGE+b+kMnQuoU8X4rMAotzG5cn1v2uJ9eYuv0AtzGOKAokMxY/ 9/0xL7xIy+crqRY04jadnE3Z4VD+Fx1itdWNSIRcrHZ5Tsa0m7F8SQ0jnJMB6F1jMM0L DCRUOep9Y7f1yBkehI10B6Hlj0r+EQ5JBbdWeQLiLqWqrFnf5IsURGE3A6FnSRAl9Biy NyDcjHTb4rZKEJBoUaQd3l7FrlWHq1Cd9X7v/P0/GzxRrC9RE3J6VCDfOx3HRbuC9/km GfQGpBOaMpviQuu8sM1p2BipDqMxmnHW1BaEF4eQKvPXJrMB/GC4ExntRYD/xYeQELvp Htrw== 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:dkim-signature; bh=tzhsAG0RQTwUbOAvsKDS2cY/SEjFWL07YCaH23xRSKc=; b=OZtoAGX+DY3BAZ3UFKPBIWN+n0QkzW0G0Jqeqgd3yQS5kdB02aopZK83n50pJ5j35R 98Vv3DOuiOypU4udW6Yk8qkSQ7LUnC1WFRI7EBsVqLADwjDBzalvyZ7sic8wcIx8t7BM IBdzJaFUt8xJEIaf8Vs8UVk7CDqlrdxc4W9F5mG47e9cYkYkcgxOyJl5AxcxYhBLu30b rVQCLDjicJYtAMHfFO1Kir7eFXmgnZJrau2dOs2ESBLRcUR6sdO77uw0lWcNKaDZMvJ4 XMylPpi9XzD3SHfz94nQucMmO93sxrlWmRsrfdsAOTnDqO8JuARlahwTZryn/FO4U5++ tyDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sloN88Sa; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t75si4897105pfi.193.2019.02.09.03.19.45; Sat, 09 Feb 2019 03:20:33 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=sloN88Sa; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726894AbfBILTm (ORCPT + 99 others); Sat, 9 Feb 2019 06:19:42 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:32837 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbfBILTm (ORCPT ); Sat, 9 Feb 2019 06:19:42 -0500 Received: by mail-lf1-f66.google.com with SMTP id q12so4478401lfm.0 for ; Sat, 09 Feb 2019 03:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tzhsAG0RQTwUbOAvsKDS2cY/SEjFWL07YCaH23xRSKc=; b=sloN88SaOy8sTCYfiW7wToATP/SlnemMhAABePevUM5KHJtHAyf/cC/42PEaMamiAP s4QjNwYp9fz83IC7a0dgYvjfUsA2UsYNtUhT1BGX0hJydS+S5SNSMdduc37IIH790+zc n4b6niUmnBbmi0SEM+TGUmLNeH1rE2pjQA7L0xmCVy8ztXxErdTNTJQTymgp4EQkmlEA KTHLT8SmAVjZ1Z7MDfzneJpmOKEGETyaPGWSbNMm4Pkbv8CN4ldx4jsVjJaKL5xvjJNx Y4KJa/EOpJmTRihvwgdjK9InM2s0myrYzu2JyeYh/mXWL3PbXn1d08IujFo9iUaMGiAF fidg== 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=tzhsAG0RQTwUbOAvsKDS2cY/SEjFWL07YCaH23xRSKc=; b=p7GGmdD/rHubbyXTddoczcu5/Jcl3Z7knvH6xkl6/eJEyL02/m/ClkBcchYH2Z43lt haC78RtWAVVO9kHxRPwySocmtRsbfntVNqeBzTAnXnAjlhnHvU5W4Ytpjyl61hq1CosU 5CTi5FW27Kmw3yX92m1TnMfV8bsuAH4BRLA79aUYGOi2crEWTy3TZjmSd52IVnOACqIM NA6peuVDjLskWhXVrHf5Gpes8JrtjJ54jYQ6lNltwbFyofC3ZiKf5Ri9UshopVO93jk6 And6WVrWfZvEOmXPBuJ/2ryQh8UulEsSnGGFEOSNiyV27XDG0+oLalVYNSIAkDTAioa1 z88w== X-Gm-Message-State: AHQUAuaeWtvGBR6Bf9CBLCYX9O87eM9nPPyYxC2u7EdrGBIHqSsY4Yz1 0cHO24KU0r7wlSMD7dGyO9z2stjHuaLdDWpG49o= X-Received: by 2002:a19:24d5:: with SMTP id k204mr4639295lfk.88.1549711179752; Sat, 09 Feb 2019 03:19:39 -0800 (PST) MIME-Version: 1.0 References: <20190209000840.11018-1-miguel.ojeda.sandonis@gmail.com> In-Reply-To: From: Miguel Ojeda Date: Sat, 9 Feb 2019 12:19:28 +0100 Message-ID: Subject: Re: [PATCH 0/3] Clean the new GCC 9 -Wmissing-attributes warnings To: Ard Biesheuvel Cc: Linux Kernel Mailing List , Laura Abbott , Arnd Bergmann , Martin Sebor , Herbert Xu , Krzysztof Kozlowski , Catalin Marinas , Nick Desaulniers , Luc Van Oostenryck , Andrey Konovalov , Kees Cook , Sean Christopherson , Jessica Yu , Masahiro Yamada , James Morris , Mathieu Desnoyers , Borislav Petkov , Matt Mullins , Vincent Whitchurch , WANG Chao 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 Sat, Feb 9, 2019 at 11:44 AM Ard Biesheuvel wrote: > > On Sat, 9 Feb 2019 at 01:09, Miguel Ojeda > wrote: > > > > The upcoming GCC 9 release extends the -Wmissing-attributes warnings > > (enabled by -Wall) to C and aliases: it warns when particular function > > attributes are missing in the aliases but not in their target, e.g.: > > > > void __cold f(void) {} > > Apologies if I missed any discussions on this topic, but I would argue > that 'cold' is not an attribute that has to be applied to the function > pointer as well as each of its targets, since it basically decides the > placement in the binary, and it doesn't affect the nature of the code > being referenced. It also affects the optimizer in two different ways AFAIK: * For the function itself, it gets optimized for size instead of speed. * For callers, the paths that lead to the calls are treated as unlikely. So GCC reports it because you would be (likely) missing the optimizations you expected if you are using the alias instead of the target. In our case in patch 3, we do not want the optimization for callers, which is why we don't mark the extern declaration as __cold (see the commit message). Cheers, Miguel