Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp438579rdb; Tue, 5 Dec 2023 09:22:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEv37uIIXLwH0FrGxJ0KIQ1BH1Yq5EjVU5lNPRWVjA1wOuHHZTmC5RNfGnUp8sqZ0TrX5JJ X-Received: by 2002:a25:ced3:0:b0:db9:91c3:63a1 with SMTP id x202-20020a25ced3000000b00db991c363a1mr783059ybe.54.1701796968019; Tue, 05 Dec 2023 09:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701796967; cv=none; d=google.com; s=arc-20160816; b=zyHjEmiWkTlSwZSKCKHR7C8D1/5JFxd0AzHAleS9h4jvcaCTCl8ZwLfmSCVfMU0eyj urUK3QFFmUykWKvXO7Hc/4v4pNgjRcm5ymzhwWNskqYotEP5cl6D7/xbvKATdbfjo0J5 Gcpbr8AcJBkr9/ai5Y5oh1IjcDdgn2MteswV2IGf7SP8fALo1N3jrTKUAYGHJ3UdaQFb ZU+FOleYu+HqTL+RZbUphfKiWBC7lkxCjDj+Nbwpdo2xysu16bBPMpyyOlnZFFDBvVIv gkSaqz2x1/Gw/DaO/wnkyjL01noVHYUBPUAViHj6ai5iuyp0B6Z1TncjNO+qDP40WATb lFBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VZ8zqh+me940DPTlLSnT/ao9Oo/jausDLZ6rcozYDaY=; fh=lb6IMT5QvqmIxnTWM61L/Na5gaXk19AITv+eMnCbG4c=; b=rHdazNPNWuykY+KQaR9xDbjYOEON4jI/T91Fh2P5mg9cJTGNCcFdrQ2RK9YiPw8BOR AjUpNi5NWPu9WFa3gdG5BGHQkfNIH9P8rfjyYKOVVu6stiCj66dNbMrwEVMIkTlv8Q5o kkf+vdUlTQQ5gJMLAB5L/IQ525ozlc6fU3T/CR3uIs0ofRr43eMFF8wr4bsrRk4uJ5/A yhx+ZFEvZXeql5HlV8lMqbP6/TswUQKT78p6+YuN2Yq1amKkBeXpils7ZQSRVsUwizVc ufJz//Oh0lLycQzasBgBTMC3/dksnBLjp21A9pNSaVi5vEvcPyf4XLYpidwa4TgFznoD wSCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SVvOED5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id f23-20020a63f117000000b0059779ae5899si9897461pgi.836.2023.12.05.09.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 09:22:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SVvOED5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5D7A18079739; Tue, 5 Dec 2023 09:21:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345778AbjLERVb (ORCPT + 99 others); Tue, 5 Dec 2023 12:21:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345550AbjLERVa (ORCPT ); Tue, 5 Dec 2023 12:21:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E1ADBA for ; Tue, 5 Dec 2023 09:21:36 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9187CC433C8; Tue, 5 Dec 2023 17:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701796896; bh=qQhFD5km7iam6ql60v2yvQ1cEjm2HjSDpoeTEUpsrRk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SVvOED5TQV7w6aix5CSUmAgTtyEnO62rBkggKujtvoSWaIHBF/KbD6e14Hk2JPqz6 3jXmvJUZek6eE5B+WZSrqApTnf1DIlnTzGjhSMK2NoICzENS/IKes8mJEFE1Wxoha8 qR+IyfxpQ1Faqi/sTdJ2HjSERHq0z1khOYRmfF8y/go/CicJFNQrVVx8vTzPsfDurZ 2lWey7UGuMC2z1W9gPskSHANViFPfSn8Dd/DWwCQIRZc0AYMthmCCwGeREnKHRcVgp nlIIWKz6cR+Tc2xLEuqggbwBVW7MLF1jZm0aBfqAfPSPj7M9cRhbPBuUIV2Uw4xwO5 4KG2CE7WvT/ww== Date: Tue, 5 Dec 2023 10:21:33 -0700 From: Nathan Chancellor To: Sylvestre Ledru Cc: Arnd Bergmann , Naresh Kamboju , clang-built-linux , Linux ARM , open list , Linux Regressions , lkft-triage@lists.linaro.org, Russell King , Nick Desaulniers , Matthias Klose Subject: Re: clang-nightly: vdso/compat_gettimeofday.h:152:15: error: instruction variant requires ARMv6 or later Message-ID: <20231205172133.GA462711@dev-arch.thelio-3990X> References: <20231204181304.GA2043538@dev-arch.thelio-3990X> <20231204223317.GA2053629@dev-arch.thelio-3990X> <36a25113-731c-4b28-a695-f3fbb0996d6e@app.fastmail.com> <20231205150417.GA349053@dev-arch.thelio-3990X> <3523ca62-be8b-4b08-8d0c-5b97ece9aad8@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3523ca62-be8b-4b08-8d0c-5b97ece9aad8@debian.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 05 Dec 2023 09:21:49 -0800 (PST) On Tue, Dec 05, 2023 at 04:13:29PM +0100, Sylvestre Ledru wrote: > Le 05/12/2023 ? 16:04, Nathan Chancellor a ?crit?: > > On Tue, Dec 05, 2023 at 07:34:40AM +0100, Arnd Bergmann wrote: > > > On Mon, Dec 4, 2023, at 23:33, Nathan Chancellor wrote: > > > > On Mon, Dec 04, 2023 at 11:13:04AM -0700, Nathan Chancellor wrote: > > > > > > > > > I am still investigating into what (if anything) can be done to resolve > > > > > this on the kernel side. We could potentially revert commit > > > > > ddc72c9659b5 ("kbuild: clang: do not use CROSS_COMPILE for target > > > > > triple") but I am not sure that will save us from that change, as > > > > > tuxmake's CROSS_COMPILE=arm-linux-gnueabihf will cause us to have an > > > > > armv7 CPU even though we may not be building for armv7. > > > > > > > > Okay, this is a pretty awful situation the more I look into it :( > > > > > > > > The arm64 compat vDSO build is easy enough to fix because we require use > > > > of the integrated assembler, which means we can add '-mcpu=generic' (the > > > > default in LLVM for those files based on my debugging) to those files > > > > and be done with it: > > > > > > > > diff --git a/arch/arm64/kernel/vdso32/Makefile > > > > b/arch/arm64/kernel/vdso32/Makefile > > > > index 1f911a76c5af..5f5cb722cfc2 100644 > > > > --- a/arch/arm64/kernel/vdso32/Makefile > > > > +++ b/arch/arm64/kernel/vdso32/Makefile > > > > @@ -9,6 +9,10 @@ include $(srctree)/lib/vdso/Makefile > > > > ifeq ($(CONFIG_CC_IS_CLANG), y) > > > > CC_COMPAT ?= $(CC) > > > > CC_COMPAT += --target=arm-linux-gnueabi > > > > +# Some distributions (such as Debian) change the default CPU for the > > > > +# arm-linux-gnueabi target triple, which can break the build. > > > > Explicitly set > > > > +# the CPU to generic, which is the default for Linux in LLVM. > > > > +CC_COMPAT += -mcpu=generic > > > > else > > > > CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc > > > > endif > > > > > > I'm still trying to follow what is actually going on. I > > > see that we pass > > > > > > VDSO_CAFLAGS += -march=armv8-a > > > > > > which is meant to tell the compiler that we want it to > > > use ARMv8 compatible instructions. Is the problem that > > > clang ignores this flag, or do we not pass it correctly? > > > > > > I would have expected -march=armv8-a to be better than > > > -mcpu=generic here, as it allows the compiler to use > > > a wider set of instructions that is still guaranteed to > > > be available on everything it will run on. > > > > I should have made it clearer in that message that adding > > '-mcpu=generic' was only to avoid the logic added by that Debian LLVM > > change, not because I believe the kernel is doing something incorrectly > > now. From what I could tell following through LLVM's code, '-march=' > > determines the default CPU, which is then used to further inform the > > full target triple and by overriding the CPU where that patch did, it > > was just blowing away the user's request. By providing an '-mcpu=' > > option explicitly, it would avoid the default selection logic and we > > would get what we asked for. > > > > > > Sylvestre, I strongly believe you should consider reverting that change > > > > or give us some compiler flag that allows us to fallback to upstream > > > > LLVM's default CPU selection logic. I think that hardcoding Debian's > > > > architecture defintions based on the target triple into the compiler > > > > could cause issues for other projects as well. For example, > > > > '--target=arm-linux-gnueabi -march=armv7-a' won't actually target ARMv7: > > > > > > > > $ echo 'int main(void) { asm("dsb"); return 0; }' | \ > > > > clang --target=arm-linux-gnueabi -march=armv7-a \ > > > > -x c -c -o /dev/null -v - > > > > ... > > > > "/usr/bin/clang-17" -cc1 -triple armv7-unknown-linux-gnueabi ... > > > > ... > > > > > > > > vs. > > > > > > > > $ echo 'int main(void) { asm("dsb"); return 0; }' | \ > > > > clang --target=arm-linux-gnueabi -march=armv7-a \ > > > > -x c -c -o /dev/null -v - > > > > ... > > > > "/bin/clang-18" -cc1 -triple armv5e-unknown-linux-gnueabi ... > > > > ... > > > > > > Right, the kernel definitely relies on -march= taking > > > precedence over the default CPU, the same way that we > > > tell the compiler to pick a non-default endianess or ABI. > > > > Agreed, I have yet to test the new version of the patch but I see you > > and Ard have given input on it, so hopefully it does not have any > > problems like this. > > Matthias, as cc, pushed a potential fix for debian/ubuntu packages! > https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/01a06b481e5a2610c7387149b58978c3ec281f2c Thanks, that version survives my basic testing of both ARCH=arm and ARCH=arm64 defconfig. I'll holler if our full matrix explodes later (we have another regression in LLVM right now so we are not testing the snapshots daily at the moment). Cheers, Nathan