Received: by 10.223.185.111 with SMTP id b44csp44804wrg; Fri, 9 Mar 2018 00:30:43 -0800 (PST) X-Google-Smtp-Source: AG47ELvYFXB/YPJFRg8AtZHgbNANFc6Cg9K9w6Jc8LTMnxf6zLkZKsg9CMRIOHGMXpncGLbq0nQS X-Received: by 2002:a17:902:7593:: with SMTP id j19-v6mr26726206pll.408.1520584243403; Fri, 09 Mar 2018 00:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520584243; cv=none; d=google.com; s=arc-20160816; b=RIDJCsPR19p+yHCHkyBxUtX5DbUE0wvf1grBwSx5jRDGvIBBnVQmAhPt80x342FxuN yCFw2sPnp6OyrPi9a3CKvIuzWHbPXEuvPlLpTKpBIBzy51lpUePdfGF8MpIQz3c7R+yT F0OWUodYenmL63FFIay4pGKiWmi/Hv2UUf7Oni4VfSMZdLH2ObtprqjrGGyGXWwcG+2+ STr0pelgPDhGF9v0UvyH5AVoHVuviF6zrMz/7590ReFGb/rqwJZV01GG7sUKhx/NnC4v xLKNr7GIdaQ8Vmv2P+t5XsUPo1YSVpnalCQzQ0NrBSf9TGvYqhUm8KJcRfZZ6tZL+TCh zXBw== 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:arc-authentication-results; bh=SfhwLqL5ZjVRG4dn4siitacdMoLPxYhlSzy2KkWPWR4=; b=Rqp+oQxHM+WbwOo3mLWgFQpyCZhM9a4QwZZrUUgCrYvvrc8MlmUdeewUEbBIVlCJky H6MD52XZXIcIM6Mp0+HE7Egh7YCHePkKoIiFtfrDJQ4tFtj0rk/e4vpSdJpBhFZKUdQ+ 9d15pTd2zLEJAf+5KGVDFjyi7qqPfgyzNFaJcDQ18WJIzyGhUcAUgsEVuD1qPwPlRXfs TnQ49evOO2iWzsk7JZxeBK6D+cDsLynLEckdOfQljq01DhkDclaG5cBpapAMBDKq/dop 9htLi4X6txt1/i3LlM8mQ7nqtWw5cKLOi3VhGOYa1cmSW82mzqcvunmSE6kK++5QSCno t3kQ== 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 70-v6si504763pla.64.2018.03.09.00.30.27; Fri, 09 Mar 2018 00:30:43 -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; 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 S1751333AbeCII3f (ORCPT + 99 others); Fri, 9 Mar 2018 03:29:35 -0500 Received: from bmailout3.hostsharing.net ([176.9.242.62]:42539 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbeCII3e (ORCPT ); Fri, 9 Mar 2018 03:29:34 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id EBFA810176B3C; Fri, 9 Mar 2018 09:29:32 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id A15393F362; Fri, 9 Mar 2018 09:29:32 +0100 (CET) Date: Fri, 9 Mar 2018 09:29:32 +0100 From: Lukas Wunner To: Ingo Molnar Cc: Ard Biesheuvel , linux-efi@vger.kernel.org, Thomas Gleixner , Colin Ian King , linux-kernel@vger.kernel.org Subject: Re: [PATCH 12/12] efi: make const array 'apple' static Message-ID: <20180309082932.GA13228@wunner.de> References: <20180308080020.22828-1-ard.biesheuvel@linaro.org> <20180308080020.22828-13-ard.biesheuvel@linaro.org> <20180309074719.y33xe4bjkjsjsaa3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180309074719.y33xe4bjkjsjsaa3@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 09, 2018 at 08:47:19AM +0100, Ingo Molnar wrote: > * Ard Biesheuvel wrote: > > From: Colin Ian King > > > > Don't populate the const read-only array 'buf' on the stack but instead > > make it static. Makes the object code smaller by 64 bytes: > > > > Before: > > text data bss dec hex filename > > 9264 1 16 9281 2441 arch/x86/boot/compressed/eboot.o > > > > After: > > text data bss dec hex filename > > 9200 1 16 9217 2401 arch/x86/boot/compressed/eboot.o > > > > (gcc version 7.2.0 x86_64) > > > > Signed-off-by: Colin Ian King > > Signed-off-by: Ard Biesheuvel > > --- > > arch/x86/boot/compressed/eboot.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c > > index 886a9115af62..f2251c1c9853 100644 > > --- a/arch/x86/boot/compressed/eboot.c > > +++ b/arch/x86/boot/compressed/eboot.c > > @@ -423,7 +423,7 @@ static void retrieve_apple_device_properties(struct boot_params *boot_params) > > > > static void setup_quirks(struct boot_params *boot_params) > > { > > - efi_char16_t const apple[] = { 'A', 'p', 'p', 'l', 'e', 0 }; > > + static efi_char16_t const apple[] = { 'A', 'p', 'p', 'l', 'e', 0 }; > > efi_char16_t *fw_vendor = (efi_char16_t *)(unsigned long) > > efi_table_attr(efi_system_table, fw_vendor, sys_table); > > As a general policy, please don't put 'static' variables into the local > scope, use file scope instead - right before setup_quirks() would be fine. Well, I believe the end result is the same and the closer the declaration is to where it's used, the easier the code is to read and understand. I object to patches like this because they paper over a missing compiler optimization: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68725 I have told Colin before that it would be more useful to look into fixing the underlying compiler issue rather than polluting the kernel with "static" keywords, but he keeps sending these patches so I've given up responding: https://lkml.org/lkml/2017/8/25/636 > Plus an unicode string literal initializer would be pretty descriptive > as well, instead of the weird looking character array, i.e. something > like: > > static efi_char16_t const apple_unicode_str[] = u"Apple"; > > ... or so? Last time I checked this didn't work, I believe it's because it's C11 and the kernel is compiled with -std=gnu89. And I'm also not sure if the oldest gcc version that we support understands u"". Thanks, Lukas