From: Nathan Chancellor <nathan@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, conor@kernel.org, trix@redhat.com,
samitolvanen@google.com, twd2.me@gmail.com,
linux-riscv@lists.infradead.org, llvm@lists.linux.dev,
patches@lists.linux.dev
Subject: Re: [PATCH v3] RISC-V: build: Allow LTO to be selected
Date: Tue, 10 Oct 2023 12:52:47 -0700 [thread overview]
Message-ID: <20231010195247.GA2233717@dev-arch.thelio-3990X> (raw)
In-Reply-To: <CAKwvOdnMeM4YArw=hyVkev11cLfks5gaXWXNK+Wo0bcbeuMZHg@mail.gmail.com>
On Tue, Oct 10, 2023 at 10:03:15AM -0700, Nick Desaulniers wrote:
> On Tue, Oct 3, 2023 at 12:17 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > From: Wende Tan <twd2.me@gmail.com>
> >
> > Allow LTO to be selected for RISC-V, only when LLD >= 14, since there is an
> > issue [1] in prior LLD versions that prevents LLD to generate proper
> > machine code for RISC-V when writing `nop`s.
> >
> > I have tested enabling LTO for `defconfig`. The LLD took ~2m21s and ~3GiB
> > on our Intel Xeon Gold 6140 server and produced an 18MiB Image. The image
> > can boot to shell using an archriscv rootfs on QEMU.
> >
> > I have also tested it for `allyesconfig` without COMPILE_TEST, FTRACE,
> > KASAN, and GCOV. The LLD took ~7h03m and ~335GiB on the server,
> > successfully producing a 1.7GiB Image. Unfortunately, we cannot boot this
> > image because the `create_kernel_page_table()` -> `alloc_pmd_early()` ->
> > `BUG_ON()` logic limits the image to be < 1GiB. Maybe we can fix it in a
> > separate patch further.
> >
> > Disable LTO for arch/riscv/kernel/pi, as llvm-objcopy expects an ELF
> > object file when manipulating the files in that subfolder, rather than
> > LLVM bitcode.
> >
> > [1] https://github.com/llvm/llvm-project/issues/50505, resolved by LLVM
> > commit e63455d5e0e5 ("[MC] Use local MCSubtargetInfo in writeNops")
> >
> > Tested-by: Wende Tan <twd2.me@gmail.com>
> > Signed-off-by: Wende Tan <twd2.me@gmail.com>
> > Co-developed-by: Nathan Chancellor <nathan@kernel.org>
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Perhaps worth a v4 due to linker relaxation resulting in boot failures
> you observed:
> https://github.com/ClangBuiltLinux/linux/issues/1942 ?
Yes, agreed. RISC-V patchwork folks, consider marking this as "Changes
Requested" or whatever other status there is that indicates that I need
to send a v4 working around that issue, at least until we better
understand the issue.
Cheers,
Natha
next prev parent reply other threads:[~2023-10-10 19:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 19:16 [PATCH v3] RISC-V: build: Allow LTO to be selected Nathan Chancellor
2023-10-04 7:33 ` twd2
2023-10-04 9:51 ` Alexandre Ghiti
2023-10-04 15:21 ` Nathan Chancellor
2023-10-10 17:03 ` Nick Desaulniers
2023-10-10 19:52 ` Nathan Chancellor [this message]
2023-10-10 21:02 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231010195247.GA2233717@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=conor@kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=palmer@dabbelt.com \
--cc=patches@lists.linux.dev \
--cc=paul.walmsley@sifive.com \
--cc=samitolvanen@google.com \
--cc=trix@redhat.com \
--cc=twd2.me@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox