From: Douglas Anderson <dianders@chromium.org> To: Mark Rutland <mark.rutland@arm.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Sumit Garg <sumit.garg@linaro.org>, Daniel Thompson <daniel.thompson@linaro.org>, Marc Zyngier <maz@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, "Masayoshi Mizuma" <msys.mizuma@gmail.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, "Chen-Yu Tsai" <wens@csie.org>, "Lecopzer Chen" <lecopzer.chen@mediatek.com>, "Tomohiro Misono" <misono.tomohiro@fujitsu.com>, "Stephane Eranian" <eranian@google.com>, kgdb-bugreport@lists.sourceforge.net, "Peter Zijlstra" <peterz@infradead.org>, "Thomas Gleixner" <tglx@linutronix.de>, "Stephen Boyd" <swboyd@chromium.org>, ito-yuichi@fujitsu.com, linux-perf-users@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>, "Douglas Anderson" <dianders@chromium.org>, "D Scott Phillips" <scott@os.amperecomputing.com>, "Josh Poimboeuf" <jpoimboe@kernel.org>, "Kees Cook" <keescook@chromium.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Sami Tolvanen" <samitolvanen@google.com>, "Valentin Schneider" <vschneid@redhat.com>, linux-kernel@vger.kernel.org Subject: [PATCH v12 3/7] arm64: smp: Remove dedicated wakeup IPI Date: Wed, 30 Aug 2023 12:11:24 -0700 [thread overview] Message-ID: <20230830121115.v12.3.I7209db47ef8ec151d3de61f59005bbc59fe8f113@changeid> (raw) In-Reply-To: <20230830191314.1618136-1-dianders@chromium.org> From: Mark Rutland <mark.rutland@arm.com> 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 <mark.rutland@arm.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Will Deacon <will@kernel.org> --- I have no idea how to test this. I just took Mark's patch and jammed it into my series. Logicially the patch seems reasonable to me. (no changes since v11) Changes in v11: - arch_send_wakeup_ipi() now takes an unsigned int. Changes in v10: - ("arm64: smp: Remove dedicated wakeup IPI") new for v10. arch/arm64/include/asm/smp.h | 4 ++-- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- arch/arm64/kernel/smp.c | 28 +++++++++-------------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index 9b31e6d0da17..efb13112b408 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -89,9 +89,9 @@ extern void arch_send_call_function_single_ipi(int cpu); extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL -extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); +extern void arch_send_wakeup_ipi(unsigned int cpu); #else -static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) +static inline void arch_send_wakeup_ipi(unsigned int cpu) { BUILD_BUG(); } diff --git a/arch/arm64/kernel/acpi_parking_protocol.c b/arch/arm64/kernel/acpi_parking_protocol.c index b1990e38aed0..e1be29e608b7 100644 --- a/arch/arm64/kernel/acpi_parking_protocol.c +++ b/arch/arm64/kernel/acpi_parking_protocol.c @@ -103,7 +103,7 @@ static int acpi_parking_protocol_cpu_boot(unsigned int cpu) &mailbox->entry_point); writel_relaxed(cpu_entry->gic_cpu_id, &mailbox->cpu_id); - arch_send_wakeup_ipi_mask(cpumask_of(cpu)); + arch_send_wakeup_ipi(cpu); return 0; } diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 960b98b43506..a5848f1ef817 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -72,7 +72,6 @@ enum ipi_msg_type { IPI_CPU_CRASH_STOP, IPI_TIMER, IPI_IRQ_WORK, - IPI_WAKEUP, NR_IPI }; @@ -764,7 +763,6 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = { [IPI_CPU_CRASH_STOP] = "CPU stop (for crash dump) interrupts", [IPI_TIMER] = "Timer broadcast interrupts", [IPI_IRQ_WORK] = "IRQ work interrupts", - [IPI_WAKEUP] = "CPU wake-up interrupts", }; 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) smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); } -#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL -void arch_send_wakeup_ipi_mask(const struct cpumask *mask) -{ - smp_cross_call(mask, IPI_WAKEUP); -} -#endif - #ifdef CONFIG_IRQ_WORK void arch_irq_work_raise(void) { @@ -897,14 +888,6 @@ static void do_handle_IPI(int ipinr) break; #endif -#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL - case IPI_WAKEUP: - WARN_ONCE(!acpi_parking_protocol_valid(cpu), - "CPU%u: Wake-up IPI outside the ACPI parking protocol\n", - cpu); - break; -#endif - default: pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr); break; @@ -979,6 +962,17 @@ void arch_smp_send_reschedule(int cpu) smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); } +#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL +void arch_send_wakeup_ipi(unsigned int cpu) +{ + /* + * We use a scheduler IPI to wake the CPU as this avoids the need for a + * dedicated IPI and we can safely handle spurious scheduler IPIs. + */ + arch_smp_send_reschedule(cpu); +} +#endif + #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST void tick_broadcast(const struct cpumask *mask) { -- 2.42.0.283.g2d96d420d3-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: Mark Rutland <mark.rutland@arm.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Sumit Garg <sumit.garg@linaro.org>, Daniel Thompson <daniel.thompson@linaro.org>, Marc Zyngier <maz@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, "Masayoshi Mizuma" <msys.mizuma@gmail.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, "Chen-Yu Tsai" <wens@csie.org>, "Lecopzer Chen" <lecopzer.chen@mediatek.com>, "Tomohiro Misono" <misono.tomohiro@fujitsu.com>, "Stephane Eranian" <eranian@google.com>, kgdb-bugreport@lists.sourceforge.net, "Peter Zijlstra" <peterz@infradead.org>, "Thomas Gleixner" <tglx@linutronix.de>, "Stephen Boyd" <swboyd@chromium.org>, ito-yuichi@fujitsu.com, linux-perf-users@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>, "Douglas Anderson" <dianders@chromium.org>, "D Scott Phillips" <scott@os.amperecomputing.com>, "Josh Poimboeuf" <jpoimboe@kernel.org>, "Kees Cook" <keescook@chromium.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Sami Tolvanen" <samitolvanen@google.com>, "Valentin Schneider" <vschneid@redhat.com>, linux-kernel@vger.kernel.org Subject: [PATCH v12 3/7] arm64: smp: Remove dedicated wakeup IPI Date: Wed, 30 Aug 2023 12:11:24 -0700 [thread overview] Message-ID: <20230830121115.v12.3.I7209db47ef8ec151d3de61f59005bbc59fe8f113@changeid> (raw) In-Reply-To: <20230830191314.1618136-1-dianders@chromium.org> From: Mark Rutland <mark.rutland@arm.com> 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 <mark.rutland@arm.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Will Deacon <will@kernel.org> --- I have no idea how to test this. I just took Mark's patch and jammed it into my series. Logicially the patch seems reasonable to me. (no changes since v11) Changes in v11: - arch_send_wakeup_ipi() now takes an unsigned int. Changes in v10: - ("arm64: smp: Remove dedicated wakeup IPI") new for v10. arch/arm64/include/asm/smp.h | 4 ++-- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- arch/arm64/kernel/smp.c | 28 +++++++++-------------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index 9b31e6d0da17..efb13112b408 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -89,9 +89,9 @@ extern void arch_send_call_function_single_ipi(int cpu); extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL -extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); +extern void arch_send_wakeup_ipi(unsigned int cpu); #else -static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) +static inline void arch_send_wakeup_ipi(unsigned int cpu) { BUILD_BUG(); } diff --git a/arch/arm64/kernel/acpi_parking_protocol.c b/arch/arm64/kernel/acpi_parking_protocol.c index b1990e38aed0..e1be29e608b7 100644 --- a/arch/arm64/kernel/acpi_parking_protocol.c +++ b/arch/arm64/kernel/acpi_parking_protocol.c @@ -103,7 +103,7 @@ static int acpi_parking_protocol_cpu_boot(unsigned int cpu) &mailbox->entry_point); writel_relaxed(cpu_entry->gic_cpu_id, &mailbox->cpu_id); - arch_send_wakeup_ipi_mask(cpumask_of(cpu)); + arch_send_wakeup_ipi(cpu); return 0; } diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 960b98b43506..a5848f1ef817 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -72,7 +72,6 @@ enum ipi_msg_type { IPI_CPU_CRASH_STOP, IPI_TIMER, IPI_IRQ_WORK, - IPI_WAKEUP, NR_IPI }; @@ -764,7 +763,6 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = { [IPI_CPU_CRASH_STOP] = "CPU stop (for crash dump) interrupts", [IPI_TIMER] = "Timer broadcast interrupts", [IPI_IRQ_WORK] = "IRQ work interrupts", - [IPI_WAKEUP] = "CPU wake-up interrupts", }; 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) smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); } -#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL -void arch_send_wakeup_ipi_mask(const struct cpumask *mask) -{ - smp_cross_call(mask, IPI_WAKEUP); -} -#endif - #ifdef CONFIG_IRQ_WORK void arch_irq_work_raise(void) { @@ -897,14 +888,6 @@ static void do_handle_IPI(int ipinr) break; #endif -#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL - case IPI_WAKEUP: - WARN_ONCE(!acpi_parking_protocol_valid(cpu), - "CPU%u: Wake-up IPI outside the ACPI parking protocol\n", - cpu); - break; -#endif - default: pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr); break; @@ -979,6 +962,17 @@ void arch_smp_send_reschedule(int cpu) smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); } +#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL +void arch_send_wakeup_ipi(unsigned int cpu) +{ + /* + * We use a scheduler IPI to wake the CPU as this avoids the need for a + * dedicated IPI and we can safely handle spurious scheduler IPIs. + */ + arch_smp_send_reschedule(cpu); +} +#endif + #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST void tick_broadcast(const struct cpumask *mask) { -- 2.42.0.283.g2d96d420d3-goog
next prev parent reply other threads:[~2023-08-30 19:14 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-30 19:11 [PATCH v12 0/7] arm64: Add IPI for backtraces / kgdb; try to use NMI for some IPIs Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-30 19:11 ` [PATCH v12 1/7] irqchip/gic-v3: Enable support for SGIs to act as NMIs Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-31 8:53 ` Mark Rutland 2023-08-31 8:53 ` Mark Rutland 2023-08-31 15:31 ` Doug Anderson 2023-08-31 15:31 ` Doug Anderson 2023-08-31 15:45 ` Mark Rutland 2023-08-31 15:45 ` Mark Rutland 2023-08-30 19:11 ` [PATCH v12 2/7] arm64: idle: Tag the arm64 idle functions as __cpuidle Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson [this message] 2023-08-30 19:11 ` [PATCH v12 3/7] arm64: smp: Remove dedicated wakeup IPI Douglas Anderson 2023-08-30 19:11 ` [PATCH v12 4/7] arm64: smp: Add arch support for backtrace using pseudo-NMI Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-30 19:11 ` [PATCH v12 5/7] arm64: smp: IPI_CPU_STOP and IPI_CPU_CRASH_STOP should try for NMI Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-31 10:12 ` Mark Rutland 2023-08-31 10:12 ` Mark Rutland 2023-08-30 19:11 ` [PATCH v12 6/7] arm64: kgdb: Implement kgdb_roundup_cpus() to enable pseudo-NMI roundup Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-31 10:14 ` Mark Rutland 2023-08-31 10:14 ` Mark Rutland 2023-08-30 19:11 ` [PATCH v12 7/7] arm64: smp: Mark IPI globals as __ro_after_init Douglas Anderson 2023-08-30 19:11 ` Douglas Anderson 2023-08-31 10:15 ` Mark Rutland 2023-08-31 10:15 ` Mark Rutland 2023-08-31 7:08 ` [PATCH v12 0/7] arm64: Add IPI for backtraces / kgdb; try to use NMI for some IPIs Chen-Yu Tsai 2023-08-31 7:08 ` Chen-Yu Tsai
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=20230830121115.v12.3.I7209db47ef8ec151d3de61f59005bbc59fe8f113@changeid \ --to=dianders@chromium.org \ --cc=ardb@kernel.org \ --cc=catalin.marinas@arm.com \ --cc=daniel.thompson@linaro.org \ --cc=eranian@google.com \ --cc=ito-yuichi@fujitsu.com \ --cc=jpoimboe@kernel.org \ --cc=keescook@chromium.org \ --cc=kgdb-bugreport@lists.sourceforge.net \ --cc=lecopzer.chen@mediatek.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-perf-users@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=maz@kernel.org \ --cc=misono.tomohiro@fujitsu.com \ --cc=msys.mizuma@gmail.com \ --cc=peterz@infradead.org \ --cc=philmd@linaro.org \ --cc=rafael.j.wysocki@intel.com \ --cc=samitolvanen@google.com \ --cc=scott@os.amperecomputing.com \ --cc=sumit.garg@linaro.org \ --cc=swboyd@chromium.org \ --cc=tglx@linutronix.de \ --cc=vschneid@redhat.com \ --cc=wens@csie.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: linkBe 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.