All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Will Deacon <will@kernel.org>, Nathan Chancellor <nathan@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH] arm64: Restrict ARM64_BTI_KERNEL to clang 12.0.0 and newer
Date: Mon, 12 Jul 2021 10:04:54 -0700	[thread overview]
Message-ID: <CAKwvOdmGhMbvtko2EVARg2E8zSX-LQKSPfdj6fbbAsCK4nw_Qg@mail.gmail.com> (raw)
In-Reply-To: <20210712122433.GA28536@willie-the-truck>

On Mon, Jul 12, 2021 at 5:24 AM Will Deacon <will@kernel.org> wrote:
>
> Hi Nathan,
>
> On Thu, Jul 08, 2021 at 05:06:27PM -0700, Nathan Chancellor wrote:
> > Commit 97fed779f2a6 ("arm64: bti: Provide Kconfig for kernel mode BTI")
> > disabled CONFIG_ARM64_BTI_KERNEL when CONFIG_GCOV_KERNEL was enabled and
> > compilign with clang because of warnings that occur because LLVM was not
>
> Typo: "compilign"
>
> > emitting PAC/BTI instructions for compiler generated functions.
> >
> > This was an adequate fix to avoid the warnings with allmodconfig until
> > commit 51c2ee6d121c ("Kconfig: Introduce ARCH_WANTS_NO_INSTR and
> > CC_HAS_NO_PROFILE_FN_ATTR"), which prevented CONFIG_GCOV_KERNEL from
> > being selected with clang 12.0.0 and older because it does not support
> > the no_profile_instrument_function attribute. As a result,
> > CONFIG_ARM64_BTI_KERNEL gets enabled and there are more warnings of this
> > nature.
>
> I'm half asleep today, but I'm struggling to follow what GCOV_KERNEL has
> to do with the warnings here. Prior to 51c2ee6d121c, you could still go
> and turn that option off and so wouldn't the same warnings be triggered
> in that configuration?

Nathan, consider if any of the below can be reused to reword the commit message?
```
Prior to 51c2ee6d121c, allmodconfig with clang-11 would not select
ARM64_BTI_KERNEL because GCOV_KERNEL already had been.

After 51c2ee6d121c, allmodconfig with clang-11 does select
ARM64_BTI_KERNEL because GCOV_KERNEL cannot be selected.

clang-11 had basic support for BTI, but failed to instrument compiler
generated functions properly.  This produces the following stream of
warnings for clang-11 allmodconfig builds of ARCH=arm64:

warning: some functions compiled with BTI and some compiled without BTI
warning: not setting BTI in feature flags

This was fixed in clang-12 via https://reviews.llvm.org/D85649.
```
Perhaps its of interest to find which config in (allmodconfig minus
GCOV_KERNEL) but not in (defconfig) produces these, since I don't
think we see them in defconfig builds of clang-11?
https://github.com/ClangBuiltLinux/continuous-integration2/runs/3009146591?check_suite_focus=true

>
> In other words, I think there are two aspects to this patch:
>
>         1. Removing the (now useless) !GCOV_KERNEL dependency
>         2. Requiring Clang >= version 12
>
> but the commit message doesn't really say where these warnings are coming
> from or why Clang 12 gets rid of them.
>
> Thanks,
>
> Will



-- 
Thanks,
~Nick Desaulniers

WARNING: multiple messages have this Message-ID (diff)
From: Nick Desaulniers <ndesaulniers@google.com>
To: Will Deacon <will@kernel.org>, Nathan Chancellor <nathan@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com
Subject: Re: [PATCH] arm64: Restrict ARM64_BTI_KERNEL to clang 12.0.0 and newer
Date: Mon, 12 Jul 2021 10:04:54 -0700	[thread overview]
Message-ID: <CAKwvOdmGhMbvtko2EVARg2E8zSX-LQKSPfdj6fbbAsCK4nw_Qg@mail.gmail.com> (raw)
In-Reply-To: <20210712122433.GA28536@willie-the-truck>

On Mon, Jul 12, 2021 at 5:24 AM Will Deacon <will@kernel.org> wrote:
>
> Hi Nathan,
>
> On Thu, Jul 08, 2021 at 05:06:27PM -0700, Nathan Chancellor wrote:
> > Commit 97fed779f2a6 ("arm64: bti: Provide Kconfig for kernel mode BTI")
> > disabled CONFIG_ARM64_BTI_KERNEL when CONFIG_GCOV_KERNEL was enabled and
> > compilign with clang because of warnings that occur because LLVM was not
>
> Typo: "compilign"
>
> > emitting PAC/BTI instructions for compiler generated functions.
> >
> > This was an adequate fix to avoid the warnings with allmodconfig until
> > commit 51c2ee6d121c ("Kconfig: Introduce ARCH_WANTS_NO_INSTR and
> > CC_HAS_NO_PROFILE_FN_ATTR"), which prevented CONFIG_GCOV_KERNEL from
> > being selected with clang 12.0.0 and older because it does not support
> > the no_profile_instrument_function attribute. As a result,
> > CONFIG_ARM64_BTI_KERNEL gets enabled and there are more warnings of this
> > nature.
>
> I'm half asleep today, but I'm struggling to follow what GCOV_KERNEL has
> to do with the warnings here. Prior to 51c2ee6d121c, you could still go
> and turn that option off and so wouldn't the same warnings be triggered
> in that configuration?

Nathan, consider if any of the below can be reused to reword the commit message?
```
Prior to 51c2ee6d121c, allmodconfig with clang-11 would not select
ARM64_BTI_KERNEL because GCOV_KERNEL already had been.

After 51c2ee6d121c, allmodconfig with clang-11 does select
ARM64_BTI_KERNEL because GCOV_KERNEL cannot be selected.

clang-11 had basic support for BTI, but failed to instrument compiler
generated functions properly.  This produces the following stream of
warnings for clang-11 allmodconfig builds of ARCH=arm64:

warning: some functions compiled with BTI and some compiled without BTI
warning: not setting BTI in feature flags

This was fixed in clang-12 via https://reviews.llvm.org/D85649.
```
Perhaps its of interest to find which config in (allmodconfig minus
GCOV_KERNEL) but not in (defconfig) produces these, since I don't
think we see them in defconfig builds of clang-11?
https://github.com/ClangBuiltLinux/continuous-integration2/runs/3009146591?check_suite_focus=true

>
> In other words, I think there are two aspects to this patch:
>
>         1. Removing the (now useless) !GCOV_KERNEL dependency
>         2. Requiring Clang >= version 12
>
> but the commit message doesn't really say where these warnings are coming
> from or why Clang 12 gets rid of them.
>
> Thanks,
>
> Will



-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-12 17:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  0:06 [PATCH] arm64: Restrict ARM64_BTI_KERNEL to clang 12.0.0 and newer Nathan Chancellor
2021-07-09  0:06 ` Nathan Chancellor
2021-07-12 12:24 ` Will Deacon
2021-07-12 12:24   ` Will Deacon
2021-07-12 17:04   ` Nick Desaulniers [this message]
2021-07-12 17:04     ` Nick Desaulniers
2021-07-12 21:46 ` [PATCH v2] " Nathan Chancellor
2021-07-12 21:46   ` Nathan Chancellor
2021-07-12 23:15   ` Nick Desaulniers
2021-07-12 23:15     ` Nick Desaulniers
2021-07-13 18:08   ` Will Deacon
2021-07-13 18:08     ` Will Deacon

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=CAKwvOdmGhMbvtko2EVARg2E8zSX-LQKSPfdj6fbbAsCK4nw_Qg@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.