* [PATCH AUTOSEL 6.17-5.4] x86/build: Remove cc-option from stack alignment flags
@ 2025-10-06 18:17 Sasha Levin
2025-10-06 21:55 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2025-10-06 18:17 UTC (permalink / raw)
To: patches, stable
Cc: Nathan Chancellor, Borislav Petkov (AMD), Sasha Levin, tglx,
mingo, dave.hansen, x86, linux-kernel, llvm
From: Nathan Chancellor <nathan@kernel.org>
[ Upstream commit d87208128a3330c0eab18301ab39bdb419647730 ]
'-mpreferred-stack-boundary' (the GCC option) and '-mstack-alignment'
(the clang option) have been supported in their respective compilers for
some time, so it is unnecessary to check for support for them via
cc-option. '-mpreferred-stack-boundary=3' had a restriction on
'-mno-sse' until GCC 7.1 but that is irrelevant for most of the kernel,
which includes '-mno-sse'.
Move to simple Kconfig checks to avoid querying the compiler for the
flags that it supports.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/20250814-x86-min-ver-cleanups-v1-2-ff7f19457523@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Based on my comprehensive analysis of this commit, here is my
determination:
## Backport Status: NO
### Extensive Analysis
**Commit Context:**
- Upstream commit: d87208128a3330c0eab18301ab39bdb419647730 (August 14,
2025)
- Author: Nathan Chancellor
- Part of patch series: "x86-min-ver-cleanups-v1"
- Already backported to 6.17 stable as 8be33f616f1c4 via AUTOSEL
(Automatic Stable Election)
- Target tree: linux-autosel-6.17 (kernel 6.17)
**What the Commit Does:**
The commit removes runtime compiler capability checks (`cc-option`) for
stack alignment flags and replaces them with build-time Kconfig checks:
- For GCC: Uses `CONFIG_CC_IS_GCC` to unconditionally set `-mpreferred-
stack-boundary=2/3`
- For Clang: Uses `CONFIG_CC_IS_CLANG` to unconditionally set `-mstack-
alignment=4/8`
**Code Changes Analysis:**
```makefile
# OLD: Runtime check if compiler supports the flags
-ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
+ifdef CONFIG_CC_IS_GCC
cc_stack_align4 := -mpreferred-stack-boundary=2
cc_stack_align8 := -mpreferred-stack-boundary=3
-else ifneq ($(call cc-option, -mstack-alignment=16),)
+endif
+ifdef CONFIG_CC_IS_CLANG
cc_stack_align4 := -mstack-alignment=4
cc_stack_align8 := -mstack-alignment=8
endif
```
**Dependency Analysis:**
- Requires minimum GCC 8.1 for x86 (introduced in v6.15 via commit
a3e8fe814ad1)
- Requires minimum Clang 15.0.0 for x86 (commit 7861640aac52b)
- Both requirements are satisfied in 6.17 stable tree (verified via
scripts/min-tool-version.sh)
- GCC 7.1+ supports `-mpreferred-stack-boundary=3` with `-msse` (per GCC
commit 34fac449e121)
**Evaluation Against Stable Kernel Rules:**
According to Documentation/process/stable-kernel-rules.rst, stable
patches must:
1. ✅ **Already exist in mainline**: YES -
d87208128a3330c0eab18301ab39bdb419647730
2. ✅ **Obviously correct and tested**: YES - simple Makefile change, no
issues found
3. ✅ **Not bigger than 100 lines**: YES - only 5 lines changed (3
insertions, 2 deletions)
4. ✅ **Follow submitting-patches.rst rules**: YES
5. ❌ **Fix a real bug or add device ID**: **NO - This is the critical
failure**
The rules explicitly state (lines 15-31 of stable-kernel-rules.rst):
> "It must either fix a real bug that bothers people or just add a
device ID."
This commit:
- Does **NOT** fix a bug (no oops, hang, data corruption, security
issue, build error, etc.)
- Is a **cleanup/optimization** to improve build performance
- Provides **no user-visible bug fix**
- Falls under "trivial fixes without benefit for users" category (rule
line 30-31)
- The original author did **NOT** tag it with `Cc:
stable@vger.kernel.org`
**Search for Issues/Regressions:**
- Searched Linux kernel mailing lists: No issues found
- Searched for reverts: None found
- Searched for build failures: None reported
- Part of systematic cleanup series with no reported problems
**Risk Assessment:**
- **Technical risk**: Very low - simple change, dependencies satisfied
- **Regression risk**: Very low - no functionality change, just build
system optimization
- **Policy compliance**: **Does not meet stable kernel criteria**
### Conclusion
While this commit is technically safe and provides a marginal build-time
performance improvement by eliminating unnecessary runtime compiler
checks, **it does not meet the fundamental requirement for stable kernel
backporting**: it does not fix a bug that affects users.
The commit is purely a cleanup that removes obsolete code after compiler
minimum version requirements were raised. Such cleanups belong in
mainline development, not stable trees, which should focus exclusively
on fixing bugs that impact users.
The fact that it was auto-selected by AUTOSEL does not override the
documented stable kernel rules. This commit should be **rejected** from
stable backporting or **reverted** if already applied.
arch/x86/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1913d342969ba..7cfc1b31f17e1 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -37,10 +37,11 @@ export RETPOLINE_VDSO_CFLAGS
# For gcc stack alignment is specified with -mpreferred-stack-boundary,
# clang has the option -mstack-alignment for that purpose.
-ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
+ifdef CONFIG_CC_IS_GCC
cc_stack_align4 := -mpreferred-stack-boundary=2
cc_stack_align8 := -mpreferred-stack-boundary=3
-else ifneq ($(call cc-option, -mstack-alignment=16),)
+endif
+ifdef CONFIG_CC_IS_CLANG
cc_stack_align4 := -mstack-alignment=4
cc_stack_align8 := -mstack-alignment=8
endif
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH AUTOSEL 6.17-5.4] x86/build: Remove cc-option from stack alignment flags
2025-10-06 18:17 [PATCH AUTOSEL 6.17-5.4] x86/build: Remove cc-option from stack alignment flags Sasha Levin
@ 2025-10-06 21:55 ` Nathan Chancellor
2025-10-06 23:13 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2025-10-06 21:55 UTC (permalink / raw)
To: Sasha Levin
Cc: patches, stable, Borislav Petkov (AMD), tglx, mingo, dave.hansen,
x86, linux-kernel, llvm
On Mon, Oct 06, 2025 at 02:17:33PM -0400, Sasha Levin wrote:
> From: Nathan Chancellor <nathan@kernel.org>
>
> [ Upstream commit d87208128a3330c0eab18301ab39bdb419647730 ]
>
> '-mpreferred-stack-boundary' (the GCC option) and '-mstack-alignment'
> (the clang option) have been supported in their respective compilers for
> some time, so it is unnecessary to check for support for them via
> cc-option. '-mpreferred-stack-boundary=3' had a restriction on
> '-mno-sse' until GCC 7.1 but that is irrelevant for most of the kernel,
> which includes '-mno-sse'.
>
> Move to simple Kconfig checks to avoid querying the compiler for the
> flags that it supports.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Link: https://lore.kernel.org/20250814-x86-min-ver-cleanups-v1-2-ff7f19457523@kernel.org
> Signed-off-by: Sasha Levin <sashal@kernel.org>
...
> ## Backport Status: NO
...
> **Dependency Analysis:**
> - Requires minimum GCC 8.1 for x86 (introduced in v6.15 via commit
> a3e8fe814ad1)
> - Requires minimum Clang 15.0.0 for x86 (commit 7861640aac52b)
> - Both requirements are satisfied in 6.17 stable tree (verified via
> scripts/min-tool-version.sh)
> - GCC 7.1+ supports `-mpreferred-stack-boundary=3` with `-msse` (per GCC
> commit 34fac449e121)
...
> ### Conclusion
>
> While this commit is technically safe and provides a marginal build-time
> performance improvement by eliminating unnecessary runtime compiler
> checks, **it does not meet the fundamental requirement for stable kernel
> backporting**: it does not fix a bug that affects users.
>
> The commit is purely a cleanup that removes obsolete code after compiler
> minimum version requirements were raised. Such cleanups belong in
> mainline development, not stable trees, which should focus exclusively
> on fixing bugs that impact users.
>
> The fact that it was auto-selected by AUTOSEL does not override the
> documented stable kernel rules. This commit should be **rejected** from
> stable backporting or **reverted** if already applied.
Based on all of this, I would agree that it is not really suitable for
backporting (at least not beyond 6.15, whereas the subject says back to
5.4), so why was this still sent for review?
Cheers,
Nathan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH AUTOSEL 6.17-5.4] x86/build: Remove cc-option from stack alignment flags
2025-10-06 21:55 ` Nathan Chancellor
@ 2025-10-06 23:13 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2025-10-06 23:13 UTC (permalink / raw)
To: Nathan Chancellor
Cc: patches, stable, Borislav Petkov (AMD), tglx, mingo, dave.hansen,
x86, linux-kernel, llvm
On Mon, Oct 06, 2025 at 02:55:05PM -0700, Nathan Chancellor wrote:
>On Mon, Oct 06, 2025 at 02:17:33PM -0400, Sasha Levin wrote:
>> From: Nathan Chancellor <nathan@kernel.org>
>>
>> [ Upstream commit d87208128a3330c0eab18301ab39bdb419647730 ]
>>
>> '-mpreferred-stack-boundary' (the GCC option) and '-mstack-alignment'
>> (the clang option) have been supported in their respective compilers for
>> some time, so it is unnecessary to check for support for them via
>> cc-option. '-mpreferred-stack-boundary=3' had a restriction on
>> '-mno-sse' until GCC 7.1 but that is irrelevant for most of the kernel,
>> which includes '-mno-sse'.
>>
>> Move to simple Kconfig checks to avoid querying the compiler for the
>> flags that it supports.
>>
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
>> Link: https://lore.kernel.org/20250814-x86-min-ver-cleanups-v1-2-ff7f19457523@kernel.org
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>...
>> ## Backport Status: NO
>...
>> **Dependency Analysis:**
>> - Requires minimum GCC 8.1 for x86 (introduced in v6.15 via commit
>> a3e8fe814ad1)
>> - Requires minimum Clang 15.0.0 for x86 (commit 7861640aac52b)
>> - Both requirements are satisfied in 6.17 stable tree (verified via
>> scripts/min-tool-version.sh)
>> - GCC 7.1+ supports `-mpreferred-stack-boundary=3` with `-msse` (per GCC
>> commit 34fac449e121)
>...
>> ### Conclusion
>>
>> While this commit is technically safe and provides a marginal build-time
>> performance improvement by eliminating unnecessary runtime compiler
>> checks, **it does not meet the fundamental requirement for stable kernel
>> backporting**: it does not fix a bug that affects users.
>>
>> The commit is purely a cleanup that removes obsolete code after compiler
>> minimum version requirements were raised. Such cleanups belong in
>> mainline development, not stable trees, which should focus exclusively
>> on fixing bugs that impact users.
>>
>> The fact that it was auto-selected by AUTOSEL does not override the
>> documented stable kernel rules. This commit should be **rejected** from
>> stable backporting or **reverted** if already applied.
>
>Based on all of this, I would agree that it is not really suitable for
>backporting (at least not beyond 6.15, whereas the subject says back to
>5.4), so why was this still sent for review?
Sorry for the noise, I thought I dropped this one :(
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-06 23:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-06 18:17 [PATCH AUTOSEL 6.17-5.4] x86/build: Remove cc-option from stack alignment flags Sasha Levin
2025-10-06 21:55 ` Nathan Chancellor
2025-10-06 23:13 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox