From patchwork Wed Oct 19 16:22:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 78303 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp388986edx; Wed, 19 Oct 2016 09:22:29 -0700 (PDT) X-Received: by 10.99.254.5 with SMTP id p5mr10502517pgh.124.1476894149724; Wed, 19 Oct 2016 09:22:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si41252666pfi.129.2016.10.19.09.22.29; Wed, 19 Oct 2016 09:22:29 -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 S939720AbcJSQWZ (ORCPT + 27 others); Wed, 19 Oct 2016 12:22:25 -0400 Received: from foss.arm.com ([217.140.101.70]:57162 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755171AbcJSQWW (ORCPT ); Wed, 19 Oct 2016 12:22:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B58D41478; Wed, 19 Oct 2016 09:22:20 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 884F23F218; Wed, 19 Oct 2016 09:22:20 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 4EC351AE3BDB; Wed, 19 Oct 2016 17:22:22 +0100 (BST) Date: Wed, 19 Oct 2016 17:22:22 +0100 From: Will Deacon To: Linus Torvalds Cc: Markus Trippelsdorf , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List , Peter Zijlstra , Ingo Molnar , Ard Biesheuvel , james.greenhalgh@arm.com, Gregory Clement , Stephen Boyd Subject: Re: Build failure with v4.9-rc1 and GCC trunk -- compiler weirdness Message-ID: <20161019162222.GT9193@arm.com> References: <20161017183806.GG5601@arm.com> <20161019153746.GA4411@x4> <20161019155658.GB4411@x4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 Wed, Oct 19, 2016 at 09:01:33AM -0700, Linus Torvalds wrote: > On Wed, Oct 19, 2016 at 8:56 AM, Markus Trippelsdorf > wrote: > > On 2016.10.19 at 08:55 -0700, Linus Torvalds wrote: > >> > >> Well, in the meantime we apparently have to live with it. Unless Will > >> is using some unreleased gcc version that nobody else is using and we > >> can just ignore it? > > > > Yes, he is using gcc-7 that is unreleased. (It will be released April > > next year.) > > Ahh, self-built? So it's not part of some experimental ARM distro > setup and this will be annoying lots of people? Our friendly compiler guys built it, but it's just a snapshot of trunk, so it's all heading towards GCC 7.0. AFAIU, the problematic optimisation is also a mid-end pass, so it would affect other architectures too. > If so, still think that we could just get rid of the ____ilog2_NaN() > thing as it's not _that_ important, but it's certainly not very > high-priority. Will can do it in his tree too for testing, and it can > remind people to get the gcc problem fixed. I'm carrying the diff below, which fixes arm64 defconfig, but I'm worried that we might be relying on this trick elsewhere. The arm __bad_cmpxchg function, for example. Will --->8 diff --git a/include/linux/log2.h b/include/linux/log2.h index fd7ff3d91e6a..9cf5ad69065d 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h @@ -16,12 +16,6 @@ #include /* - * deal with unrepresentable constant logarithms - */ -extern __attribute__((const, noreturn)) -int ____ilog2_NaN(void); - -/* * non-constant log of base 2 calculators * - the arch may override these in asm/bitops.h if they can be implemented * more efficiently than using fls() and fls64() @@ -85,7 +79,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) #define ilog2(n) \ ( \ __builtin_constant_p(n) ? ( \ - (n) < 1 ? ____ilog2_NaN() : \ + (n) < 1 ? 0 : \ (n) & (1ULL << 63) ? 63 : \ (n) & (1ULL << 62) ? 62 : \ (n) & (1ULL << 61) ? 61 : \ @@ -149,9 +143,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) (n) & (1ULL << 3) ? 3 : \ (n) & (1ULL << 2) ? 2 : \ (n) & (1ULL << 1) ? 1 : \ - (n) & (1ULL << 0) ? 0 : \ - ____ilog2_NaN() \ - ) : \ + 0) : \ (sizeof(n) <= 4) ? \ __ilog2_u32(n) : \ __ilog2_u64(n) \ @@ -194,7 +186,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n) * @n: parameter * * The first few values calculated by this routine: - * ob2(0) = 0 * ob2(1) = 0 * ob2(2) = 1 * ob2(3) = 2