From patchwork Wed Jan 25 14:08:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9537151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CBF22601D7 for ; Wed, 25 Jan 2017 14:08:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD18526861 for ; Wed, 25 Jan 2017 14:08:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF8FB26AE3; Wed, 25 Jan 2017 14:08:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3627C26861 for ; Wed, 25 Jan 2017 14:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbdAYOIt (ORCPT ); Wed, 25 Jan 2017 09:08:49 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:62488 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbdAYOIs (ORCPT ); Wed, 25 Jan 2017 09:08:48 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MNKx7-1cYr5B3dhh-006uSv; Wed, 25 Jan 2017 15:08:29 +0100 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Steven Rostedt , Nicolas Pitre , "Darrick J. Wong" , linux-xfs@vger.kernel.org, Dave Chinner , Brian Foster , Eric Sandeen Subject: [PATCH] [RFC] xfs: work around unlikely() profiler glitch Date: Wed, 25 Jan 2017 15:08:10 +0100 Message-Id: <20170125140821.2677725-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:jRxKyPBU1FMSJGD3MLA7uI/S7xKD/OBDUaybthUmiYm1W2TyRY4 FcXuWUXPCacEqqnsKLqcymOQ9prDSAOpilTZZSYdfHsOJ9YrByYBj6IwhvjBGhs4YFdmdQQ W/jJFWxwTZiCUyM0cfJxfjQw7u97PrhMCI8P7pzaLzVsqnibAX8HDyxiihBupEJnttP5tdf V3MSp0V7CykKg9WD/ZevA== X-UI-Out-Filterresults: notjunk:1; V01:K0:riCrSy0tF/A=:7qoY+Z7bC7nTU4PzaMkluD lwSGLbz2iNYegS++b4irwQXnnZB5Cer3yk2WCfBwFeoPmYHdmkO9cfT17ExoGL1LJRdAtWEqE EnKpUplI3vyKYdM1HYg3+joRYQQ6qJWBjyLzVIcCMYp3zW2cToVPMnJ8F2N+YmejJncLCrR5z 7tOu33zdtJU6DaMN99LyJw20UY/GfAS/8KQVkFTvVj82BKJEdOb0K4iLWQcaGWkxNSzfxzGmD ETO98cROQt9hdpDj+tQD547dKrxpa/ZP+ugC6+MN1J8ySbaeWEkGGwXEWqi2eLkT9YicoL9HF 90pxhpTRKIf6mM4JMgmjWyMAuNCCrgHBp5o8yBm3BEP/toBZap+dn2kUMksJVUVqHhl2Gqo9C /QSQIyW8E+lKQZTQH7e36wCyyJsxy4lhPZPtJSgds1BgAd8bpTCtF9Nck7PRLW0ldgElhuYXx GTHElvPWSye5rT1L+xfvqsXcx8Lqp9XKki3kEndUPaMBp7V15UOOlNb0+jPq31OTxwctAT2Hs y5qLVfT9FdVWCHjVXonw3N1XjqUoM0fw7nAuv4bNQYS9yiL75CULvmQmDhOQVU6bv53edggIn 4fqvR40YVvA8RqZ0+mdDF29sWC7o+c+rxHM4S9lhEjbzzQF7QLeiyRSw8OV7ybMoqQ+tG24Nh kU9Vjd6VlRF++AhPdMKUsNwdMtZLJP267pudi4kEf59Ffdt+kLV2Zl7bdcyTlYXg5Img= Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After a patch from Steven Rostedt to rework the profiling of unlikely(), we get a couple of link errors in XFS on ARM: fs/xfs/libxfs/xfs_bmap.o: In function `xfs_bmap_btalloc': xfs_bmap.c:(.text.xfs_bmap_btalloc+0x8cc): undefined reference to `____ilog2_NaN' xfs_bmap.c:(.text.xfs_bmap_btalloc+0xb34): undefined reference to `__aeabi_uldivmod' xfs_bmap.c:(.text.xfs_bmap_btalloc+0xb7c): undefined reference to `__aeabi_uldivmod' As I understand the problem, this is a result of the combination of __builtin_constant_p() usage in three places: unlikely(), xfs_bmap_btalloc(), and __div64_32(), where the latter attempts to use __builtin_constant_p() to decide whether to either call an out-of-line function for variable divisors or an optimized version for constant divisors. As I understand it, here we end up with a case where gcc has determined that the argument is constant in some cases but variable in other cases, and tries to split up the handling by implementing both paths and deciding at runtime. This seems to be related to the problem fixed in commit b33c8ff4431a ("tracing: Fix freak link error caused by branch tracer"). I don't know why exactly it goes wrong now, but we end up getting object code emitted for the case that should have been eliminated after the __builtin_constant_p() check. I don't think we'd ever run into the branches to ____ilog2_NaN or __aeabi_uldivmod, but we get a link error anyway. Fixes: d45ae1f7041a ("tracing: Process constants for (un)likely() profiler")i Cc: Steven Rostedt (VMware) Cc: Nicolas Pitre Signed-off-by: Arnd Bergmann --- fs/xfs/libxfs/xfs_bmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index d22f7930eb75..dca3ddd737d4 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3629,7 +3629,7 @@ xfs_bmap_btalloc( align = xfs_get_cowextsz_hint(ap->ip); else if (xfs_alloc_is_userdata(ap->datatype)) align = xfs_get_extsz_hint(ap->ip); - if (unlikely(align)) { + if (unlikely_notrace(align)) { error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, align, 0, ap->eof, 0, ap->conv, &ap->offset, &ap->length);