diff mbox series

[3/3] RISC-V: build: Allow LTO to be selected

Message ID 20210719205339.1023572-1-twd2.me@gmail.com (mailing list archive)
State New, archived
Headers show
Series RISC-V: build: Allow LTO to be selected | expand

Commit Message

twd2 July 19, 2021, 8:53 p.m. UTC
Signed-off-by: Wende Tan <twd2.me@gmail.com>
---
 arch/riscv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

Comments

Nick Desaulniers July 19, 2021, 9:25 p.m. UTC | #1
On Mon, Jul 19, 2021 at 1:53 PM Wende Tan <twd2.me@gmail.com> wrote:

Consider adding a little more detail to the commit message.

In our experience with other architectures, we've hit numerous
compiler and kernel issues especially with allyesconfigs. Has that
been your experience with riscv?  It would be good to know if you've
hit issues with LTO plus certain configs, so that we have confirmation
others have seen these issues and so that we can triage fixes.

>
> Signed-off-by: Wende Tan <twd2.me@gmail.com>
> ---
>  arch/riscv/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 8fcceb8eda07..b593e5031c79 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -34,6 +34,8 @@ config RISCV
>         select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
>         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
>         select ARCH_SUPPORTS_HUGETLBFS if MMU
> +       select ARCH_SUPPORTS_LTO_CLANG
> +       select ARCH_SUPPORTS_LTO_CLANG_THIN
>         select ARCH_USE_MEMTEST
>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
>         select ARCH_WANT_FRAME_POINTERS
> --
twd2 July 20, 2021, 6:29 p.m. UTC | #2
Hi, I just tried to compile with this patch and `allyesconfig` except
COMPILE_TEST, FTRACE, KASAN, GCOV, and XFS [1].  It finishes with no
issue, and takes ~22 min and ~25 GiB.  BTW, the kernel panics during boot
even built with GCC, so I didn't do further tests :( .

Command used: ARCH=riscv LLVM=1 LLVM_IAS=1 make HOSTCC=gcc vmlinux -j16
Kernel version: commit 2734d6c1b1a0 ("Linux 5.14-rc2")
LLVM version: commit 1b61d837b9d0 ("[Inline] Add test for PR50589 (NFC)")
The `.config` file is attached.

[1] https://github.com/ClangBuiltLinux/linux/issues/1215

On 2021/7/20 5:25, Nick Desaulniers wrote:
> On Mon, Jul 19, 2021 at 1:53 PM Wende Tan <twd2.me@gmail.com> wrote:
>
> Consider adding a little more detail to the commit message.
>
> In our experience with other architectures, we've hit numerous
> compiler and kernel issues especially with allyesconfigs. Has that
> been your experience with riscv?  It would be good to know if you've
> hit issues with LTO plus certain configs, so that we have confirmation
> others have seen these issues and so that we can triage fixes.
>
>> Signed-off-by: Wende Tan <twd2.me@gmail.com>
>> ---
>>  arch/riscv/Kconfig | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 8fcceb8eda07..b593e5031c79 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -34,6 +34,8 @@ config RISCV
>>         select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
>>         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
>>         select ARCH_SUPPORTS_HUGETLBFS if MMU
>> +       select ARCH_SUPPORTS_LTO_CLANG
>> +       select ARCH_SUPPORTS_LTO_CLANG_THIN
>>         select ARCH_USE_MEMTEST
>>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
>>         select ARCH_WANT_FRAME_POINTERS
>> --
twd2 July 20, 2021, 9:18 p.m. UTC | #3
Also, I tried `defconfig` with Full/Thin LTO.  It can boot and the
busybox shell works.

I'll put this information into the next version of the patch series.


Thanks.
Wende


On 2021/7/21 2:29, twd2 wrote:
> Hi, I just tried to compile with this patch and `allyesconfig` except
> COMPILE_TEST, FTRACE, KASAN, GCOV, and XFS [1].  It finishes with no
> issue, and takes ~22 min and ~25 GiB.  BTW, the kernel panics during boot
> even built with GCC, so I didn't do further tests :( .
>
> Command used: ARCH=riscv LLVM=1 LLVM_IAS=1 make HOSTCC=gcc vmlinux -j16
> Kernel version: commit 2734d6c1b1a0 ("Linux 5.14-rc2")
> LLVM version: commit 1b61d837b9d0 ("[Inline] Add test for PR50589 (NFC)")
> The `.config` file is attached.
>
> [1] https://github.com/ClangBuiltLinux/linux/issues/1215
>
> On 2021/7/20 5:25, Nick Desaulniers wrote:
>> On Mon, Jul 19, 2021 at 1:53 PM Wende Tan <twd2.me@gmail.com> wrote:
>>
>> Consider adding a little more detail to the commit message.
>>
>> In our experience with other architectures, we've hit numerous
>> compiler and kernel issues especially with allyesconfigs. Has that
>> been your experience with riscv?  It would be good to know if you've
>> hit issues with LTO plus certain configs, so that we have confirmation
>> others have seen these issues and so that we can triage fixes.
>>
>>> Signed-off-by: Wende Tan <twd2.me@gmail.com>
>>> ---
>>>  arch/riscv/Kconfig | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>>> index 8fcceb8eda07..b593e5031c79 100644
>>> --- a/arch/riscv/Kconfig
>>> +++ b/arch/riscv/Kconfig
>>> @@ -34,6 +34,8 @@ config RISCV
>>>         select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
>>>         select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
>>>         select ARCH_SUPPORTS_HUGETLBFS if MMU
>>> +       select ARCH_SUPPORTS_LTO_CLANG
>>> +       select ARCH_SUPPORTS_LTO_CLANG_THIN
>>>         select ARCH_USE_MEMTEST
>>>         select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
>>>         select ARCH_WANT_FRAME_POINTERS
>>> --
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 8fcceb8eda07..b593e5031c79 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -34,6 +34,8 @@  config RISCV
 	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
 	select ARCH_SUPPORTS_HUGETLBFS if MMU
+	select ARCH_SUPPORTS_LTO_CLANG
+	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_USE_MEMTEST
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
 	select ARCH_WANT_FRAME_POINTERS