Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5381569imb; Thu, 7 Mar 2019 14:25:19 -0800 (PST) X-Google-Smtp-Source: APXvYqzdYPyLZHiIDxybpUGdNsHsga9AgkAJu6DAyrG9i6WRGnzBk11lr28dswljQ4YTrqudN/Ha X-Received: by 2002:a17:902:a24:: with SMTP id 33mr3622558plo.275.1551997519471; Thu, 07 Mar 2019 14:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551997519; cv=none; d=google.com; s=arc-20160816; b=WAx7m4s1lZZkpc0f+oTJzeLEBksrJaXEIDeyPiPeR18c4GGHfxyETpMkO9jz/WTNIn 6iGqc9NbBz1Dg1X5GiK2yW64BGJ4Xw9bnsG9XoRcsTelydFFUfSVXjTgx8IufYCCp+dE fH59Rj6XNv9GPvvSfI15N9PXj1o3uAKz4hGaB/+UBAf/8egFOpONjL7vvmys0DhVOHFn 2lICIvpiXbCSoRK11Iea1NF+FpPujidmBiUkvtTCJLD0PqME8AbZyLJ0YYwZDihqACpu RbBP/SfSRVnlopz32/tmuuuXeSYlsJOVNgWxK8t7FYUy3MUoHlF3jPjy7uwV1guAfFMf lQgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=MVSDyuojxDr8yKM2hUZArTW3td5unUmPpSnGlPnhrLA=; b=SGI51dra0UeDXGUjUEAp0uuchkpYHlipm5wT2tNkXsrvTvwcfWtJAODKWU9sg9R4H5 +dPdcFQIqu1ZAqDNBCdFIKMDyCNcfX4f/SEG5eI3JQzX+eNNG/rMZcv7nrM2vl466uu9 UpAZ5v/qW3qBgjXHSpgI0MYZ3LOb69ARHq5dBpiF1urS3JBDjYmGRB2equQgCr5Se7Z1 W+BRvjz5AL2BuPIysvgIIBpY4yP+jIq7ULNKdTEomiD+lOKrQXSyyuRtvn4vc7KLl+mz OUHma1yn9EPrk6zkccUPv0Q0AGQOWMMv42I0Tu8JhaLi/nklg2KeDUReKeSF8gAwPF2+ 3zHQ== 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 e2si4851664pgm.568.2019.03.07.14.25.03; Thu, 07 Mar 2019 14:25:19 -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 S1726264AbfCGWYo (ORCPT + 99 others); Thu, 7 Mar 2019 17:24:44 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:38651 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfCGWYn (ORCPT ); Thu, 7 Mar 2019 17:24:43 -0500 Received: by mail-qt1-f194.google.com with SMTP id s1so19118268qte.5 for ; Thu, 07 Mar 2019 14:24:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MVSDyuojxDr8yKM2hUZArTW3td5unUmPpSnGlPnhrLA=; b=Z3BirsmqKDZtstrgnAnuGYb6p9K+3MdnF1jSli5vondQicCQRapn0TLQovbM+IDZg/ uIEpOiytmwwCEpypLqAfcCol3fSiTqGz+Ul39Za3mMH54lgRckbj79VJSoUQctOOr0CP QuT/oBB+lNDcEYkBoqSF8TSmStmCH8olFYnkqHt3fLLl/vC3YcdvzOOi4SjRt0hK29M6 2di1WzUnQdqZbCkIBOq30xPkYn9NFfLaL+qnc09NQVlG/AIjSkglOho4w1Asq0kYD3Jd oOd52skhw8x3w+cgy5hYGa9Km4sNvYB4p/Le/B3Y56f3EzAgeKcxfA/C3a9adJKjxIYH xtIQ== X-Gm-Message-State: APjAAAXezpYVUTgPMv1MbFuuZDu3jVW1j2fFOBWBIrzvu+UXbtpCt4+U w565MBpINWDFn/148XnTZpL6Ng5h7mxh72KISOA= X-Received: by 2002:a0c:b501:: with SMTP id d1mr12833709qve.115.1551997482641; Thu, 07 Mar 2019 14:24:42 -0800 (PST) MIME-Version: 1.0 References: <20190307091514.2489338-1-arnd@arndb.de> <20190307182102.GA12466@archlinux-ryzen> In-Reply-To: <20190307182102.GA12466@archlinux-ryzen> From: Arnd Bergmann Date: Thu, 7 Mar 2019 23:24:26 +0100 Message-ID: Subject: Re: [PATCH 1/2] futex: mark futex_detect_cmpxchg() as 'noinline' To: Nathan Chancellor Cc: Nick Desaulniers , Russell King , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Elena Reshetova , Greg Kroah-Hartman , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 7, 2019 at 7:21 PM Nathan Chancellor wrote: > > On Thu, Mar 07, 2019 at 10:12:11AM -0800, Nick Desaulniers wrote: > > On Thu, Mar 7, 2019 at 1:15 AM Arnd Bergmann wrote: > > > > > > On 32-bit ARM, I got a link failure in futex_init() when building > > > with clang in some random configurations: > > > > > > kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text' > > > > Do we know what function from the fixup text section is calling > > futex_detect_cmpxchg? I'm curious if this is maybe another case of > > -Wsection where some function may be in the wrong section? > > > > Looks like this is the call stack: > > futex_init -> > futex_detect_cmpxchg -> > cmpxchg_futex_value_locked -> > futex_atomic_cmpxchg_inatomic > > This is the same issue I reported: https://github.com/ClangBuiltLinux/linux/issues/325 > > Marking arm's futex_atomic_cmpxchg_inatomic as noinline also fixes this > so maybe that's it? I think part of the problem is the linker sometimes failing to generate veneers for long calls. I've seen this in the past with relocations in non-executable sections, but it's possible that the problem here is having a relocation to a section that doesn't start with ".text". I have not analyzed the linker behavior in more detail, but have experimentally shown that the problem doesn't happen if the relocation is from the .text.fixup segment to .text rather than .init.text. It's also possible that this is simply a result of the relative distance of the locations in memory as Russell said, so it could come back if the kernel grows further. Arnd