Skip to content

Commit 2b2d0a7

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: smp: Remove dedicated wakeup IPI
To enable NMI backtrace and KGDB's NMI cpu roundup, we need to free up at least one dedicated IPI. On arm64 the IPI_WAKEUP IPI is only used for the ACPI parking protocol, which itself is only used on some very early ARMv8 systems which couldn't implement PSCI. Remove the IPI_WAKEUP IPI, and rely on the IPI_RESCHEDULE IPI to wake CPUs from the parked state. This will cause a tiny amonut of redundant work to check the thread flags, but this is miniscule in relation to the cost of taking and handling the IPI in the first place. We can safely handle redundant IPI_RESCHEDULE IPIs, so there should be no functional impact as a result of this change. Signed-off-by: Mark Rutland <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Tested-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/20230906090246.v13.3.I7209db47ef8ec151d3de61f59005bbc59fe8f113@changeid Signed-off-by: Catalin Marinas <[email protected]>
1 parent d0c14a7 commit 2b2d0a7

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

arch/arm64/include/asm/smp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ extern void arch_send_call_function_single_ipi(int cpu);
8989
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
9090

9191
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
92-
extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
92+
extern void arch_send_wakeup_ipi(unsigned int cpu);
9393
#else
94-
static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
94+
static inline void arch_send_wakeup_ipi(unsigned int cpu)
9595
{
9696
BUILD_BUG();
9797
}

arch/arm64/kernel/acpi_parking_protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int acpi_parking_protocol_cpu_boot(unsigned int cpu)
103103
&mailbox->entry_point);
104104
writel_relaxed(cpu_entry->gic_cpu_id, &mailbox->cpu_id);
105105

106-
arch_send_wakeup_ipi_mask(cpumask_of(cpu));
106+
arch_send_wakeup_ipi(cpu);
107107

108108
return 0;
109109
}

arch/arm64/kernel/smp.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ enum ipi_msg_type {
7272
IPI_CPU_CRASH_STOP,
7373
IPI_TIMER,
7474
IPI_IRQ_WORK,
75-
IPI_WAKEUP,
7675
NR_IPI
7776
};
7877

@@ -764,7 +763,6 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = {
764763
[IPI_CPU_CRASH_STOP] = "CPU stop (for crash dump) interrupts",
765764
[IPI_TIMER] = "Timer broadcast interrupts",
766765
[IPI_IRQ_WORK] = "IRQ work interrupts",
767-
[IPI_WAKEUP] = "CPU wake-up interrupts",
768766
};
769767

770768
static void smp_cross_call(const struct cpumask *target, unsigned int ipinr);
@@ -797,13 +795,6 @@ void arch_send_call_function_single_ipi(int cpu)
797795
smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
798796
}
799797

800-
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
801-
void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
802-
{
803-
smp_cross_call(mask, IPI_WAKEUP);
804-
}
805-
#endif
806-
807798
#ifdef CONFIG_IRQ_WORK
808799
void arch_irq_work_raise(void)
809800
{
@@ -897,14 +888,6 @@ static void do_handle_IPI(int ipinr)
897888
break;
898889
#endif
899890

900-
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
901-
case IPI_WAKEUP:
902-
WARN_ONCE(!acpi_parking_protocol_valid(cpu),
903-
"CPU%u: Wake-up IPI outside the ACPI parking protocol\n",
904-
cpu);
905-
break;
906-
#endif
907-
908891
default:
909892
pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr);
910893
break;
@@ -979,6 +962,17 @@ void arch_smp_send_reschedule(int cpu)
979962
smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
980963
}
981964

965+
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
966+
void arch_send_wakeup_ipi(unsigned int cpu)
967+
{
968+
/*
969+
* We use a scheduler IPI to wake the CPU as this avoids the need for a
970+
* dedicated IPI and we can safely handle spurious scheduler IPIs.
971+
*/
972+
arch_smp_send_reschedule(cpu);
973+
}
974+
#endif
975+
982976
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
983977
void tick_broadcast(const struct cpumask *mask)
984978
{

0 commit comments

Comments
 (0)