From: Mark Rutland <mark.rutland@arm.com> To: Sumit Garg <sumit.garg@linaro.org> Cc: Doug Anderson <dianders@chromium.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Daniel Thompson <daniel.thompson@linaro.org>, Marc Zyngier <maz@kernel.org>, linux-perf-users@vger.kernel.org, ito-yuichi@fujitsu.com, Chen-Yu Tsai <wens@csie.org>, Ard Biesheuvel <ardb@kernel.org>, Stephen Boyd <swboyd@chromium.org>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, Masayoshi Mizuma <msys.mizuma@gmail.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Lecopzer Chen <lecopzer.chen@mediatek.com>, Andrey Konovalov <andreyknvl@gmail.com>, Ben Dooks <ben-linux@fluff.org>, Frederic Weisbecker <frederic@kernel.org>, "Gautham R. Shenoy" <gautham.shenoy@amd.com>, Ingo Molnar <mingo@kernel.org>, Jason Wessel <jason.wessel@windriver.com>, Josh Poimboeuf <jpoimboe@kernel.org>, Masahiro Yamada <masahiroy@kernel.org>, Valentin Schneider <vschneid@redhat.com>, Wei Li <liwei391@huawei.com>, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 0/7] arm64: Add debug IPI for backtraces / kgdb; try to use NMI for it Date: Mon, 7 Aug 2023 15:43:46 +0100 [thread overview] Message-ID: <ZNEDIlst3OVZF7P2@FVFF77S0Q05N.cambridge.arm.com> (raw) In-Reply-To: <CAFA6WYMD4TRR5psUyhu2jhZ2XBMUfav3D7_eH1HE8VJfXc7Fuw@mail.gmail.com> On Mon, Aug 07, 2023 at 06:16:24PM +0530, Sumit Garg wrote: > On Mon, 7 Aug 2023 at 16:11, Mark Rutland <mark.rutland@arm.com> wrote: > > On Mon, Jul 24, 2023 at 08:55:44AM -0700, Doug Anderson wrote: > > > On Thu, Jun 1, 2023 at 2:37 PM Douglas Anderson <dianders@chromium.org> wrote: > > I'd also strongly prefer if we > > could have separate IPI_CPU_BACKTRACE and IPI_CPU_KGDB IPIs, > > With current logic of single debug IPI, it is not required for a user > to enable KGDB in order to use that IPI for backtrace. The original > motivation for this logic was that the IPIs are a scarce resource on > arm64 as per comments from Marc. So I am fine either way to keep them > separate or unified. > > > and I think we can > > do that either by unifying IPI_CPU_STOP && IPI_CPU_CRASH_STOP or by reclaiming > > IPI_WAKEUP by reusing a different IPI for the parking protocol (e.g. > > IPI_RESCHEDULE). > > That sounds like a good cleanup. I took a quick stab at removing IPI_WAKEUP, and it seems simple enough; patch below. Mark. ----<8---- From 267401824576c1dd3bb6d380142c92f710098b67 Mon Sep 17 00:00:00 2001 From: Mark Rutland <mark.rutland@arm.com> Date: Mon, 7 Aug 2023 15:05:47 +0100 Subject: [PATCH] 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 <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Douglas Anderson <dianders@chromium.org> Cc: Marc Zyngier <maz@kernel.org> Cc: Sumit Garg <sumit.garg@linaro.org> Cc: Will Deacon <will@kernel.org> --- 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 9b31e6d0da174..798fd76a883a0 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(int cpu); #else -static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) +static inline void arch_send_wakeup_ipi(int cpu) { BUILD_BUG(); } diff --git a/arch/arm64/kernel/acpi_parking_protocol.c b/arch/arm64/kernel/acpi_parking_protocol.c index b1990e38aed0a..e1be29e608b71 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 edd63894d61e8..be00c8c5c1711 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(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.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com> To: Sumit Garg <sumit.garg@linaro.org> Cc: Doug Anderson <dianders@chromium.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Daniel Thompson <daniel.thompson@linaro.org>, Marc Zyngier <maz@kernel.org>, linux-perf-users@vger.kernel.org, ito-yuichi@fujitsu.com, Chen-Yu Tsai <wens@csie.org>, Ard Biesheuvel <ardb@kernel.org>, Stephen Boyd <swboyd@chromium.org>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, Masayoshi Mizuma <msys.mizuma@gmail.com>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Lecopzer Chen <lecopzer.chen@mediatek.com>, Andrey Konovalov <andreyknvl@gmail.com>, Ben Dooks <ben-linux@fluff.org>, Frederic Weisbecker <frederic@kernel.org>, "Gautham R. Shenoy" <gautham.shenoy@amd.com>, Ingo Molnar <mingo@kernel.org>, Jason Wessel <jason.wessel@windriver.com>, Josh Poimboeuf <jpoimboe@kernel.org>, Masahiro Yamada <masahiroy@kernel.org>, Valentin Schneider <vschneid@redhat.com>, Wei Li <liwei391@huawei.com>, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 0/7] arm64: Add debug IPI for backtraces / kgdb; try to use NMI for it Date: Mon, 7 Aug 2023 15:43:46 +0100 [thread overview] Message-ID: <ZNEDIlst3OVZF7P2@FVFF77S0Q05N.cambridge.arm.com> (raw) In-Reply-To: <CAFA6WYMD4TRR5psUyhu2jhZ2XBMUfav3D7_eH1HE8VJfXc7Fuw@mail.gmail.com> On Mon, Aug 07, 2023 at 06:16:24PM +0530, Sumit Garg wrote: > On Mon, 7 Aug 2023 at 16:11, Mark Rutland <mark.rutland@arm.com> wrote: > > On Mon, Jul 24, 2023 at 08:55:44AM -0700, Doug Anderson wrote: > > > On Thu, Jun 1, 2023 at 2:37 PM Douglas Anderson <dianders@chromium.org> wrote: > > I'd also strongly prefer if we > > could have separate IPI_CPU_BACKTRACE and IPI_CPU_KGDB IPIs, > > With current logic of single debug IPI, it is not required for a user > to enable KGDB in order to use that IPI for backtrace. The original > motivation for this logic was that the IPIs are a scarce resource on > arm64 as per comments from Marc. So I am fine either way to keep them > separate or unified. > > > and I think we can > > do that either by unifying IPI_CPU_STOP && IPI_CPU_CRASH_STOP or by reclaiming > > IPI_WAKEUP by reusing a different IPI for the parking protocol (e.g. > > IPI_RESCHEDULE). > > That sounds like a good cleanup. I took a quick stab at removing IPI_WAKEUP, and it seems simple enough; patch below. Mark. ----<8---- From 267401824576c1dd3bb6d380142c92f710098b67 Mon Sep 17 00:00:00 2001 From: Mark Rutland <mark.rutland@arm.com> Date: Mon, 7 Aug 2023 15:05:47 +0100 Subject: [PATCH] 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 <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Douglas Anderson <dianders@chromium.org> Cc: Marc Zyngier <maz@kernel.org> Cc: Sumit Garg <sumit.garg@linaro.org> Cc: Will Deacon <will@kernel.org> --- 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 9b31e6d0da174..798fd76a883a0 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(int cpu); #else -static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) +static inline void arch_send_wakeup_ipi(int cpu) { BUILD_BUG(); } diff --git a/arch/arm64/kernel/acpi_parking_protocol.c b/arch/arm64/kernel/acpi_parking_protocol.c index b1990e38aed0a..e1be29e608b71 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 edd63894d61e8..be00c8c5c1711 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(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.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-08-07 14:43 UTC|newest] Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-01 21:31 [PATCH v9 0/7] arm64: Add debug IPI for backtraces / kgdb; try to use NMI for it Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-06-01 21:31 ` [PATCH v9 1/7] irqchip/gic-v3: Enable support for SGIs to act as NMIs Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-08-07 9:50 ` Mark Rutland 2023-08-07 9:50 ` Mark Rutland 2023-08-07 11:22 ` Sumit Garg 2023-08-07 11:22 ` Sumit Garg 2023-08-07 13:25 ` Mark Rutland 2023-08-07 13:25 ` Mark Rutland 2023-06-01 21:31 ` [PATCH v9 2/7] arm64: idle: Tag the arm64 idle functions as __cpuidle Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-08-07 9:52 ` Mark Rutland 2023-08-07 9:52 ` Mark Rutland 2023-06-01 21:31 ` [PATCH v9 3/7] arm64: Add framework for a debug IPI Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-08-07 10:12 ` Mark Rutland 2023-08-07 10:12 ` Mark Rutland 2023-08-21 22:16 ` Doug Anderson 2023-08-21 22:16 ` Doug Anderson 2023-08-22 6:42 ` Mark Rutland 2023-08-22 6:42 ` Mark Rutland 2023-06-01 21:31 ` [PATCH v9 4/7] arm64: smp: Assign and setup the " Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-08-07 10:17 ` Mark Rutland 2023-08-07 10:17 ` Mark Rutland 2023-06-01 21:31 ` [PATCH v9 5/7] arm64: ipi_debug: Add support for backtrace using " Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-08-07 10:23 ` Mark Rutland 2023-08-07 10:23 ` Mark Rutland 2023-08-22 0:06 ` Doug Anderson 2023-08-22 0:06 ` Doug Anderson 2023-08-22 6:35 ` Mark Rutland 2023-08-22 6:35 ` Mark Rutland 2023-06-01 21:31 ` [PATCH v9 6/7] kgdb: Provide a stub kgdb_nmicallback() if !CONFIG_KGDB Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-06-15 18:14 ` Doug Anderson 2023-06-15 18:14 ` Doug Anderson 2023-06-26 14:30 ` Daniel Thompson 2023-06-26 14:30 ` Daniel Thompson 2023-08-07 10:27 ` Mark Rutland 2023-08-07 10:27 ` Mark Rutland 2023-08-07 10:29 ` Mark Rutland 2023-08-07 10:29 ` Mark Rutland 2023-06-01 21:31 ` [PATCH v9 7/7] arm64: kgdb: Roundup cpus using the debug IPI Douglas Anderson 2023-06-01 21:31 ` Douglas Anderson 2023-08-07 10:28 ` Mark Rutland 2023-08-07 10:28 ` Mark Rutland 2023-08-07 10:47 ` Marc Zyngier 2023-08-07 10:47 ` Marc Zyngier 2023-08-07 10:54 ` Mark Rutland 2023-08-07 10:54 ` Mark Rutland 2023-08-07 11:08 ` Marc Zyngier 2023-08-07 11:08 ` Marc Zyngier 2023-08-07 11:13 ` Mark Rutland 2023-08-07 11:13 ` Mark Rutland 2023-08-07 15:24 ` Daniel Thompson 2023-08-07 15:24 ` Daniel Thompson 2023-08-07 16:04 ` Mark Rutland 2023-08-07 16:04 ` Mark Rutland 2023-08-08 11:17 ` Daniel Thompson 2023-08-08 11:17 ` Daniel Thompson 2023-06-02 5:19 ` [PATCH v9 0/7] arm64: Add debug IPI for backtraces / kgdb; try to use NMI for it Sumit Garg 2023-06-02 5:19 ` Sumit Garg 2023-07-24 15:55 ` Doug Anderson 2023-08-07 10:41 ` Mark Rutland 2023-08-07 10:41 ` Mark Rutland 2023-08-07 12:46 ` Sumit Garg 2023-08-07 12:46 ` Sumit Garg 2023-08-07 14:43 ` Mark Rutland [this message] 2023-08-07 14:43 ` Mark Rutland
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=ZNEDIlst3OVZF7P2@FVFF77S0Q05N.cambridge.arm.com \ --to=mark.rutland@arm.com \ --cc=andreyknvl@gmail.com \ --cc=ardb@kernel.org \ --cc=ben-linux@fluff.org \ --cc=catalin.marinas@arm.com \ --cc=daniel.thompson@linaro.org \ --cc=dianders@chromium.org \ --cc=frederic@kernel.org \ --cc=gautham.shenoy@amd.com \ --cc=ito-yuichi@fujitsu.com \ --cc=jason.wessel@windriver.com \ --cc=jpoimboe@kernel.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=liwei391@huawei.com \ --cc=masahiroy@kernel.org \ --cc=maz@kernel.org \ --cc=mingo@kernel.org \ --cc=msys.mizuma@gmail.com \ --cc=peterz@infradead.org \ --cc=rafael.j.wysocki@intel.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.