Re: [PATCH] irqchip: gic-v3-its: fix build for !SMP

From: Valentin Schneider
Date: Mon Jan 24 2022 - 07:39:16 EST


On 22/01/22 16:16, Ard Biesheuvel wrote:
> Commit 835f442fdbce ("irqchip/gic-v3-its: Limit memreserve cpuhp state
> lifetime") added a reference to cpus_booted_once_mask, which does not
> exist on !SMP builds, breaking the build for such configurations.
>
> Given the intent of the check, short circuit it to always pass.
>
> Cc: Valentin Schneider <valentin.schneider@xxxxxxx>
> Fixes: 835f442fdbce ("irqchip/gic-v3-its: Limit memreserve cpuhp state lifetime")
> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

Sorry about that, and thanks for the fix.

This looks fine to me, though one alternative to prevent future
IS_ENABLED() proliferations would be to make cpus_booted_once_mask exist
for !SMP - the online, active, present and possible masks exist for !SMP
already after all.

---
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 407a2568f35e..7487b7061f2c 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -84,9 +84,7 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = {
.fail = CPUHP_INVALID,
};

-#ifdef CONFIG_SMP
cpumask_t cpus_booted_once_mask;
-#endif

#if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP)
static struct lockdep_map cpuhp_state_up_map =
@@ -2662,9 +2660,7 @@ void __init boot_cpu_init(void)
*/
void __init boot_cpu_hotplug_init(void)
{
-#ifdef CONFIG_SMP
cpumask_set_cpu(smp_processor_id(), &cpus_booted_once_mask);
-#endif
this_cpu_write(cpuhp_state.state, CPUHP_ONLINE);
}