Received: by 10.192.165.148 with SMTP id m20csp1857684imm; Thu, 3 May 2018 06:35:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoepd7ZTi+TcWiIvYLC8LYxv8RLBF9M/L64A+IFfVF0WU1a9qsSCBAE5sEy2GYQiw+McwLT X-Received: by 2002:a17:902:a60d:: with SMTP id u13-v6mr5295922plq.40.1525354541908; Thu, 03 May 2018 06:35:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525354541; cv=none; d=google.com; s=arc-20160816; b=anqfJarjDrXVlu2ucQOSxYru9FD/dQcq8JkoDlY8cM0R4acFSzdS394JTaJyuGrHTM sLdRV/Ej3WGaKiQ3Dbob5bBFVraZ2LTRZTPTeQo7lr3E9r8SrUGsLEHubiOjMQqKCO/o XKlOhKmxA2kHIdcwAI6BP8pa0iJ8FGdS7ZQZhwMu1pZcyr0huNsaqgNqvUDn6FE2VB0K m1o9q4BgEGmjpvD8QeBqqqcqdEbJ+ads7JHL4mUISQPY9XhF72sjBvS+dpwkrNM3zPWE HT+ZzzgXg9LLtl7nrzDzWCsnskky9f/nwbZ191baP9q/BpeWIDAXlKQY4iusNqGkkGYd lR1A== 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=xAAEQ/ip+vD7ZO0kVWhwvwKHBKb9OY/KnR7G1NTzqIE=; b=OD4Q/lfVqqhaOt1rbnIxYL7P+ox+M7QS2a0aOWRXGWkaceK7+2KpkB8rMa7siL2u7O ZIKPIxOThdxiLXfNNPPrDtQACl3cb1zS0NmXAlI81v17YT2FtRq4Kmdu8Bg9ur6QD+Q/ NXHaL6v4WmdOptH6N0+FTGwlSlkVaijBwlxJmAy7ScEwkpIZNuknGfp1cr8jLSewOdSp +Hjixs00QD5a6uUl9Mo8331Qxs/A888c1jx+KkT4pbHGesN4UY40jSATi+CZ+VE4Zir+ LxD/3PbccijJQX5x1ion+IbLhXy5mq1qjxtRCdekAlMSNj6imXhx/IcMbAolhWEKIvwt FqLA== 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 b78si13732400pfj.2.2018.05.03.06.35.28; Thu, 03 May 2018 06:35:41 -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 S1751508AbeECNfU (ORCPT + 99 others); Thu, 3 May 2018 09:35:20 -0400 Received: from mga06.intel.com ([134.134.136.31]:7807 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751465AbeECNfO (ORCPT ); Thu, 3 May 2018 09:35:14 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 06:35:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="42784238" Received: from gvt-dell.bj.intel.com (HELO intel.com) ([10.238.154.59]) by fmsmga002.fm.intel.com with SMTP; 03 May 2018 06:35:10 -0700 Date: Thu, 3 May 2018 21:25:08 +0800 From: "Du, Changbin" To: Steven Rostedt Cc: changbin.du@intel.com, yamada.masahiro@socionext.com, michal.lkml@markovi.net, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org, rdunlap@infradead.org, x86@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, arnd@arndb.de, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH v2 5/5] asm-generic: fix build error in fix_to_virt with CONFIG_DEBUG_EXPERIENCE Message-ID: <20180503132508.qudxf67tyijvjndo@intel.com> References: <1525268700-10631-1-git-send-email-changbin.du@intel.com> <1525268700-10631-6-git-send-email-changbin.du@intel.com> <20180502101930.25a5437d@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180502101930.25a5437d@gandalf.local.home> User-Agent: NeoMutt/20180323-6-5ca392 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 02, 2018 at 10:19:30AM -0400, Steven Rostedt wrote: > On Wed, 2 May 2018 21:45:00 +0800 > changbin.du@intel.com wrote: > > > From: Changbin Du > > > > With '-Og' optimization level, GCC would not optimize a count for a loop > > as a constant value. But BUILD_BUG_ON() only accept compile-time constant > > values. > > > > arch/arm/mm/mmu.o: In function `fix_to_virt': > > /home/changbin/work/linux/./include/asm-generic/fixmap.h:31: undefined reference to `__compiletime_assert_31' > > Makefile:1051: recipe for target 'vmlinux' failed > > make: *** [vmlinux] Error 1 > > > > Signed-off-by: Changbin Du > > --- > > include/asm-generic/fixmap.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h > > index 827e4d3..a6576d4 100644 > > --- a/include/asm-generic/fixmap.h > > +++ b/include/asm-generic/fixmap.h > > @@ -28,7 +28,8 @@ > > */ > > static __always_inline unsigned long fix_to_virt(const unsigned int idx) > > { > > - BUILD_BUG_ON(idx >= __end_of_fixed_addresses); > > + BUILD_BUG_ON(__builtin_constant_p(idx) && > > + idx >= __end_of_fixed_addresses); > > Hmm, this changes the check slightly. Perhaps we should only do this > when your config is active: > > { > BUILD_BUG_ON( > /* CONFIG_DEBUG_OPTIMIZE may cause idx not to be constant */ > #ifdef CONFIG_DEBUG_OPTIMIZE > __builtin_constant_p(idx) && > #endif > idx >= __end_of_fixed_addresses); > > } I think fix_to_virt() is designed for constant idx only. So I think we should fix it at the caller side by replacing it with __fix_to_virt(). --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1599,7 +1599,7 @@ static void __init early_fixmap_shutdown(void) pte_t *pte; struct map_desc map; - map.virtual = fix_to_virt(i); + map.virtual = __fix_to_virt(i); pte = pte_offset_early_fixmap(pmd_off_k(map.virtual), map.virtual); > > -- Steve > > > return __fix_to_virt(idx); > > } > > > -- Thanks, Changbin Du