From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ED7B3D86 for ; Mon, 6 Jun 2022 22:18:15 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id w20so3830510lfa.11 for ; Mon, 06 Jun 2022 15:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AEicuTVMgg6V1QO4zYkGhfVsMSgQk+TbKCz6HyUOuSA=; b=FkSl67D1qpP1+e0AN36ByGsngSb94JD7VibKCDEBSYAW+ITNExRg12fzsjXYaV90DT jm1r1bBlSEfzPb8K+SYZd/MsmF8+qdcHXxXcLri6n5Yx8FuwqWSmDg1nR30rH9WXM0Y1 JzbtyBLhaeJAJKe0IeoXtpBwF0qG6UqATVHTRxALfhBH2fPGLh/K9COzRk7WW8k4QWXs jbGQjW6B/arT7ePxRTUXT7X+7f8T3nyHhycTNv/8HZZ6k/JO7gOVM5ZJKQsoTNik5IUQ /RYVVrwVQOnBzUsHzxrR7cQB8M0RNqjbazVxl0V4VkqKEFCLeqfI6VX1D8Ave1Jq5/KS ty0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AEicuTVMgg6V1QO4zYkGhfVsMSgQk+TbKCz6HyUOuSA=; b=JeZyuByOukG97p4dKrtQhTJhdedED1qWMEJS0dWB24tEprAPMNMdllf5+V/FBfhAFG gQwao7LTm7uIvU0dKZHf7Yu+haBkE8zzNkFKsa3rMWgukrZw51JaQEQEJrIhszcUKV7f JuAyipBsFFdyUprcIrWKuJBrqHKEPlAHWmF7nl0L0Fwo2CkyvbJaGAlSU+7DFBbkGSez kcMr5Zf3AuKxYHGchVW8ihZhu+YsRsS9pPL6lARvEtfQYiMJp1h/uvKtSZRCmPFCDTSb yoGYvqyt6Cg2qgPKuhQaAGx2t4YlUDusmc3nXSY2a1yyqEuMwD8SUrFx6GX5NG5e6mn9 E4/A== X-Gm-Message-State: AOAM532Xk9HMzTD0RReT6zc3vtmHYOADG33yTANFBTRuXrrNuqPKIeEz 7hbiSTrH74zX02mfBmPDOGl+JACNG6+NpgSjlgoPJnOypg0/sg== X-Google-Smtp-Source: ABdhPJxqUrw4xLKP5o5CLTHUeWbcjcktYubJ5FZ6j5Aaz3e7EZAb3xtgpXPy5aj6klZoufbg/PxodtMNEea0nw4iYqs= X-Received: by 2002:ac2:454b:0:b0:479:1131:f2ff with SMTP id j11-20020ac2454b000000b004791131f2ffmr14826098lfm.626.1654553893157; Mon, 06 Jun 2022 15:18:13 -0700 (PDT) Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Nick Desaulniers Date: Mon, 6 Jun 2022 15:18:01 -0700 Message-ID: Subject: Re: arch/x86/entry/entry: RFC on recent kernels building error with llvm 11.0.2 internal assembler To: Mauro Rossi Cc: Nathan Chancellor , Chih-Wei Huang , Linux Kernel Mailing List , clang-built-linux Content-Type: text/plain; charset="UTF-8" On Mon, Jun 6, 2022 at 2:57 PM Mauro Rossi wrote: > > On Sat, Jun 4, 2022 at 12:13 AM Nick Desaulniers > wrote: > > > > On Wed, Jun 1, 2022 at 5:57 AM Mauro Rossi wrote: > > > > > > On Wed, Jun 1, 2022 at 12:09 AM Nick Desaulniers > > > wrote: > > > > > > > > As Nathan noted, I messed up the commit "ANDROID: x86: entry: work > > > > around LLVM_IAS=1 bug in LSL". Please see: > > > > https://android-review.googlesource.com/c/kernel/common/+/1521061 > > > > https://android-review.googlesource.com/c/kernel/common/+/1560152/ > > > > > > > > If you're using an older toolchain, you'll need just the first. If > > > > you're using a newer toolchain, you'll need BOTH (or none, including > > > > dropping "ANDROID: x86: entry: work around LLVM_IAS=1 bug in LSL"). > > > > > > Thanks Nick, > > > > > > I had already applied the squashed commit composed of "ANDROID: x86: > > > entry: work around LLVM_IAS=1 bug in LSL" (the one using .quad) and > > > "ANDROID: x86: entry: fix LSL open coding", so I have already: > > > > > > .macro LOAD_CPU_AND_NODE_SEG_LIMIT reg:req > > > movq $__CPUNODE_SEG, \reg > > > +#ifdef __clang__ > > > +.long 0xc0030f48 > > > > LGTM > > > > > +#else > > > lsl \reg, \reg > > > +#endif > > > .endm > > > > > > > > > So in principle my kernel image should boot when built with LLVM_IAS=1 > > > but to my surprise all my systems (Sony VAIO i7, Intel NUC DN2820FYKH > > > with Celeron D2830, Athlon 200GE) are affected by hard reboot when > > > executing the kernel image > > > > Might need more info. Do they boot when LLVM_IAS=0 is explicitly set > > with your command line invocation of make? i.e. `make LLVM=1 > > LLVM_IAS=0 ...`? Can you launch these kernels in qemu? > > Yes, kernel 5.17 and 5.18 built with LLVM=1 LLVM_IAS=0 do not cause > instantaneus hard reboot and proceed in the boot stages > > The complete list of make variables Ihave used is as follows: > > LLVM=1 LLVM_IAS=0 \ > CC=$(abspath $(LLVM_PREBUILTS_PATH)/clang) \ > LD=$(abspath $(LLVM_PREBUILTS_PATH)/ld.lld) \ > AR=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-ar) \ > NM=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-nm) \ > OBJCOPY=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-objcopy) \ > OBJDUMP=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-objdump) \ > READELF=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-readelf) \ > OBJSIZE=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-size) \ > STRIP=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-strip) \ > HOSTCC=$(abspath $(LLVM_PREBUILTS_PATH)/clang) \ > HOSTCXX=$(abspath $(LLVM_PREBUILTS_PATH)/clang++) \ > HOSTLD=$(abspath $(LLVM_PREBUILTS_PATH)/ld.lld) \ > HOSTLDFLAGS=-fuse-ld=lld \ > HOSTAR=$(abspath $(LLVM_PREBUILTS_PATH)/llvm-ar) You could probably simplify the above to: $ PATH=$PATH:$LLVM_PREBUILTS_PATH make LLVM=1 LLVM_IAS=0 > > > > > > > > > I'm trying to understand how to build (and boot) with LLVM_IAS=1 and > > > using clang 11.0.2 shipped with AOSP Android 11 Can you try a newer version of LLVM? AOSP LLVM 11 is technically a pre-release version somewhere between the LLVM 10 and 11 releases. We no longer support LLVM 10 with mainline, so it's hard to say if AOSP LLVM 11.0.2 contains or does not contain problematic or necessary commits. Also, do you have a kernel tree I can fetch? I'd be happy to try to boot the result in QEMU. Have you tried that? > > > > I think this combo should work; we are testing x86_64 with mainline > > https://github.com/ClangBuiltLinux/continuous-integration2/blob/95b9a12cad31675118d61c26d0b541fa4e3c8f09/generator.yml#L1694 > > > > Could be something in your .config files though. > > -- > > Thanks, > > ~Nick Desaulniers > -- Thanks, ~Nick Desaulniers