From: Yu Peng pengyu@kylinos.cn
[ Upstream commit ca8313fd83399ea1d18e695c2ae9b259985c9e1f ]
Fix section mismatch warning reported by modpost:
.text:early_parse_cmdline() -> .init.data:boot_command_line
The function early_parse_cmdline() is only called during init and accesses init data, so mark it __init to match its usage.
[ bp: This happens only when the toolchain fails to inline the function and I haven't been able to reproduce it with any toolchain I'm using. Patch is obviously correct regardless. ]
Signed-off-by: Yu Peng pengyu@kylinos.cn Signed-off-by: Borislav Petkov (AMD) bp@alien8.de Link: https://patch.msgid.link/all/20251030123757.1410904-1-pengyu@kylinos.cn Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
## Analysis
### 1. COMMIT MESSAGE ANALYSIS
**Subject**: `x86/microcode: Mark early_parse_cmdline() as __init`
**Problem**: Fixes a modpost section mismatch warning: ``` .text:early_parse_cmdline() -> .init.data:boot_command_line ```
**Context**: The function is only called during init (from `load_ucode_bsp()` which is `__init`) and accesses `boot_command_line` (declared as `__initdata` in `.init.data`). The maintainer notes this occurs when the toolchain fails to inline the function, but the fix is correct regardless.
**Signals**: - No "Cc: stable@vger.kernel.org" tag - No "Fixes:" tag - Signed-off by maintainer (Borislav Petkov)
### 2. CODE CHANGE ANALYSIS
**Change**: Adds `__init` attribute to `early_parse_cmdline()`: ```c -static void early_parse_cmdline(void) +static void __init early_parse_cmdline(void) ```
**Technical details**: - `__init` places the function in `.init.text` (discarded after boot) - `boot_command_line` is `__initdata` (in `.init.data`) - A function in `.text` accessing `.init.data` triggers a section mismatch - Marking the function `__init` aligns it with its usage
**Root cause**: Missing `__init` annotation on a function only used during initialization.
**Correctness**: Correct. The function is only called from `load_ucode_bsp()` (line 172), which is `__init`, so marking it `__init` matches its usage.
### 3. CLASSIFICATION
**Type**: Build fix (section mismatch)
**Not**: - A new feature - A runtime bug fix - A security fix - A performance optimization
**Is**: - A build error fix (modpost can fail builds) - A code organization fix (correct section placement)
### 4. BUILD IMPACT ANALYSIS
From `scripts/mod/modpost.c` (lines 2373-2375): ```c if (sec_mismatch_count && !sec_mismatch_warn_only) error("Section mismatches detected.\n" "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); ```
And `scripts/Makefile.modpost` (line 49): ```makefile $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) ```
**Impact**: - Section mismatches cause build failures unless `CONFIG_SECTION_MISMATCH_WARN_ONLY=y` - This is a build error fix, which stable rules allow - Similar fixes have been backported (e.g., `b452d2c97eecc` for clocksource driver)
### 5. SCOPE AND RISK ASSESSMENT
**Lines changed**: 1 line (attribute addition)
**Files touched**: 1 file (`arch/x86/kernel/cpu/microcode/core.c`)
**Complexity**: Trivial — attribute addition only
**Risk**: Very low - No logic change - No runtime behavior change - Only affects section placement - Function already only used during init
**Subsystem**: x86 microcode (mature, critical)
### 6. USER IMPACT
**Who is affected**: - Users building kernels without `CONFIG_SECTION_MISMATCH_WARN_ONLY=y` - Distribution kernel builders - Anyone building with strict modpost checks
**Severity**: Build failure (prevents compilation)
**Frequency**: Depends on toolchain inlining behavior; can be intermittent
### 7. STABILITY INDICATORS
**Tested-by**: None **Reviewed-by**: None (maintainer signed off) **Age**: Very recent (Oct 30, 2025) — not yet in a released kernel
### 8. DEPENDENCY CHECK
**Parent commit**: `632ff61706473` ("x86/microcode: Add microcode= cmdline parsing") introduced `early_parse_cmdline()` on Aug 20, 2025, and is in v6.18.
**Dependency analysis**: - This fix only applies if the parent commit exists in the target stable tree - If the function doesn't exist in stable, this fix isn't needed - If the feature is backported, this fix should be included
**Backport considerations**: - Applies cleanly if the parent commit is present - No API changes or complex dependencies - Self-contained
### 9. STABLE KERNEL RULES EVALUATION
From `Documentation/process/stable-kernel-rules.rst`:
1. "It must be obviously correct and tested" — Yes, correct and maintainer-approved 2. "It must fix a real bug" — Yes, fixes a build error 3. "It fixes a problem like... a build error" — Yes, explicitly allowed 4. "It must be small and contained" — Yes, 1-line change 5. "It must NOT introduce new features" — Correct, no new functionality 6. "It must apply cleanly" — Yes, if parent commit exists
**Conclusion**: Meets all criteria for stable inclusion.
### 10. COMPARISON WITH SIMILAR COMMITS
Similar section mismatch fixes have been backported: - `b452d2c97eecc` ("clocksource/drivers/nxp-stm: Fix section mismatches") includes `Cc: stable@vger.kernel.org # 6.16`
This commit follows the same pattern and should be treated similarly.
### 11. FINAL ASSESSMENT
**Should this be backported?** Yes, with a caveat.
**Rationale**: 1. Fixes a build error (not just a warning) 2. Obviously correct 3. Minimal risk (attribute addition) 4. Small and self-contained 5. Meets stable kernel criteria
**Caveat**: - Only applicable if commit `632ff61706473` exists in the target stable tree - If backporting the feature, include this fix - If the feature isn't in stable, this fix isn't needed
**Recommendation**: Backport to stable trees that include the `early_parse_cmdline()` function (v6.18+ or if the feature was backported to older trees).
**YES**
arch/x86/kernel/cpu/microcode/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index f75c140906d00..539edd6d6dc8c 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -136,7 +136,7 @@ bool __init microcode_loader_disabled(void) return dis_ucode_ldr; }
-static void early_parse_cmdline(void) +static void __init early_parse_cmdline(void) { char cmd_buf[64] = {}; char *s, *p = cmd_buf;