Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp97351img; Thu, 21 Mar 2019 15:03:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNsbE3hhWpr7Vs0tsJDqtFfSorR6IhLHLMEzR+b2P9M1l8ye/VltQlIxtWlG5Na11jT4/9 X-Received: by 2002:a17:902:9a4c:: with SMTP id x12mr5907940plv.157.1553205822375; Thu, 21 Mar 2019 15:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553205822; cv=none; d=google.com; s=arc-20160816; b=wic/nDoZ/4kYelXuRay2+R+DAujRzoB54SJ15gdy4+IEezfYGoUjD2m4JPAqIDfIHE 3OvOf8tJQvPYSgshviDylJxGUJc7jcCo0iIbNNIjlhB/PkNcr62vp8Yw5LcZtdgzyydg L6N16Vdr6Blcz6bVu56Fr8TBPMVm/ngpNnpwO9iXiT4t0SUwdzO9vK74LKD/dNgFPyq4 m8lm5a3cxQTYyl3W9Hruqvj9q9zbT8zQ4mxgrwdw+YK8euVRu6sDMJ6af2haaXQtqNzJ I16QwkXKgoQbmJhLdOiW8/xpPysEyX+M9Ot+OOmIdlMCi6bfjJ0uafdSlUtOlNZJlgaD BRFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=w20xMece/OTGotUzc/4but8mj35kG5bnoYhg/nrM0Cs=; b=Ce/reIMZ5lBIBRMppp3lvHnIHy3Hx9f+XRbHrmtBsaP+M4pkiDPiBtnfP4PhwQRtao ltvFx8KjRoVyPShYk/YrUC1elrZuW6mCgIxSpfwncqmJESzMJzxQFEp+vhC0yXuNTNYN Q9Bql7u3XbFgpSE88u0D/Biw/OwZrWDRqYEz7vIk2tpedVYGazzT3Ev0L29l+JRZx2j6 jnnm34mAxGYv3HKNwRCZaaevEDT2vMjVFoIOpwC6JRagnlFf08CKqd/2ljmAoM2rYQPp jGqa0Dbqym03E9a9RyCi4zYqKKHVvaUlV/F/2dpT0CQd2FFoQdANgz3jh81yessblGBw i3KQ== 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 s14si4964326pgs.98.2019.03.21.15.03.27; Thu, 21 Mar 2019 15:03:42 -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 S1727504AbfCUWBI (ORCPT + 99 others); Thu, 21 Mar 2019 18:01:08 -0400 Received: from mga06.intel.com ([134.134.136.31]:53197 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbfCUWA0 (ORCPT ); Thu, 21 Mar 2019 18:00:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2019 15:00:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,254,1549958400"; d="scan'208";a="216357234" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by orsmga001.jf.intel.com with ESMTP; 21 Mar 2019 15:00:23 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 2101930214C; Thu, 21 Mar 2019 15:00:23 -0700 (PDT) From: Andi Kleen To: x86@kernel.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 04/17] init: Add __noreorder and mark initcalls __noreorder Date: Thu, 21 Mar 2019 14:59:56 -0700 Message-Id: <20190321220009.29334-5-andi@firstfloor.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190321220009.29334-1-andi@firstfloor.org> References: <20190321220009.29334-1-andi@firstfloor.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen gcc 5 has a new no_reorder attribute that prevents top level reordering only for that symbol. Kernels don't like any reordering of initcalls between files, as several initcalls depend on each other. Add a __noreorder wrapper for the no_reorder attribute and use it for initcalls. LTO previously needed to use -fno-toplevel-reordering to prevent boot failures, but with noreorder this is not needed. I believe the patch is useful even without LTO because it clearly documents this dependency in the source. Signed-off-by: Andi Kleen --- include/linux/compiler_attributes.h | 11 +++++++++++ include/linux/init.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h index 6b318efd8a74..1c44ef9034bb 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -39,6 +39,7 @@ # define __GCC4_has_attribute___externally_visible__ 1 # define __GCC4_has_attribute___noclone__ 1 # define __GCC4_has_attribute___nonstring__ 0 +# define __GCC4_has_attribute___no_reorder__ 0 # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) #endif @@ -253,4 +254,14 @@ */ #define __weak __attribute__((__weak__)) +/* + * https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes + */ + +#if __has_attribute(__no_reorder__) +#define __noreorder __attribute__((no_reorder)) +#else +#define __noreorder +#endif + #endif /* __LINUX_COMPILER_ATTRIBUTES_H */ diff --git a/include/linux/init.h b/include/linux/init.h index 5255069f5a9f..49d032916604 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -190,7 +190,7 @@ extern bool initcall_debug; ".previous \n"); #else #define ___define_initcall(fn, id, __sec) \ - static initcall_t __initcall_##fn##id __used \ + static initcall_t __initcall_##fn##id __used __noreorder \ __attribute__((__section__(#__sec ".init"))) = fn; #endif -- 2.20.1