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, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Lecopzer Chen <lecopzer.chen@mediatek.com>, Chen-Yu Tsai <wens@csie.org>, Tomohiro Misono <misono.tomohiro@fujitsu.com>, Peter Zijlstra <peterz@infradead.org>, Masayoshi Mizuma <msys.mizuma@gmail.com>, Stephane Eranian <eranian@google.com>, Ard Biesheuvel <ardb@kernel.org>, kgdb-bugreport@lists.sourceforge.net, Stephen Boyd <swboyd@chromium.org>, linux-perf-users@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>, ito-yuichi@fujitsu.com, Douglas Anderson <dianders@chromium.org>, gautham.shenoy@amd.com, jpoimboe@kernel.org, keescook@chromium.org, linux-kernel@vger.kernel.org, mingo@kernel.org, philmd@linaro.org, samitolvanen@google.com, scott@os.amperecomputing.com, vschneid@redhat.com Subject: [PATCH v13 0/7] arm64: Add IPI for backtraces / kgdb; try to use NMI for some IPIs Date: Wed, 6 Sep 2023 09:02:55 -0700 [thread overview] Message-ID: <20230906160505.2431857-1-dianders@chromium.org> (raw) This is an attempt to resurrect Sumit's old patch series [1] that allowed us to use the arm64 pseudo-NMI to get backtraces of CPUs and also to round up CPUs in kdb/kgdb. The last post from Sumit that I could find was v7, so I started my series at v8. I haven't copied all of his old changelongs here, but you can find them from the link. This patch series targets v6.6. Specifically it can't land in v6.5 since it depends on commit 8d539b84f1e3 ("nmi_backtrace: allow excluding an arbitrary CPU"). It should be noted that Mark still feels there might be some corner cases where pseudo-NMI is not production ready [2] [3], but as far as I'm aware there are no concrete/documented issues. Regardless of whether this should be enabled for production, though, this series will be invaluable to anyone trying to debug crashes on arm64 machines. v13 of this series fixes a nit with the names of two functions and collects more tags. There are no code changes other than the renames and these have no functional impact. I believe that the series is ready to land. As per the note in patch #1, I'm hoping for an Ack from Marc Zyngier on patch #1 and then the whole series can land through the arm64 tree. v12 of this series collects tags, fixes a few small nits in comments and commit messages from v11 and adds a new (and somewhat unrelated) small patch to the end of the series. There are no code changes other than the last patch, which is tiny. v11 of this series addressed Stephen Boyd's feedback on v10 and added a missing "static" that the patches robot found. v10 of this series attempted to address all of Mark's feedback on v9. As a quick summary: - It includes his patch to remove IPI_WAKEUP, freeing up an extra IPI. - It no longer combines the "kgdb" and "backtrace" IPIs. If we need another IPI these could always be recombined later. - It promotes IPI_CPU_STOP and IPI_CPU_CRASH_STOP to NMI. - It puts nearly all the code directly in smp.c. - Several of the patches are squashed together. - Patch #6 ("kgdb: Provide a stub kgdb_nmicallback() if !CONFIG_KGDB") was dropped from the series since it landed. Between v8 and v9, I had cleaned up this patch series by integrating the 10th patch from v8 [4] into the whole series. As part of this, I renamed the "NMI IPI" to the "debug IPI" since it could now be backed by a regular IPI in the case that pseudo NMIs weren't available. With the fallback, this allowed me to drop some extra patches from the series. This feels (to me) to be pretty clean and hopefully others agree. Any patch I touched significantly I removed Masayoshi and Chen-Yu's tags from. ...also in v8, I reorderd the patches a bit in a way that seemed a little cleaner to me. Since v7, I have: * Addressed the small amount of feedback that was there for v7. * Rebased. * Added a new patch that prevents us from spamming the logs with idle tasks. * Added an extra patch to gracefully fall back to regular IPIs if pseudo-NMIs aren't there. It can be noted that this patch series works very well with the recent "hardlockup" patches that have landed through Andrew Morton's tree and are currently in mainline. It works especially well with the "buddy" lockup detector. [1] https://lore.kernel.org/linux-arm-kernel/1604317487-14543-1-git-send-email-sumit.garg@linaro.org/ [2] https://lore.kernel.org/lkml/ZFvGqD%2F%2Fpm%2FlZb+p@FVFF77S0Q05N.cambridge.arm.com/ [3] https://lore.kernel.org/lkml/ZNDKVP2m-iiZCz3v@FVFF77S0Q05N.cambridge.arm.com [4] https://lore.kernel.org/r/20230419155341.v8.10.Ic3659997d6243139d0522fc3afcdfd88d7a5f030@changeid/ Changes in v13: - s/_idx/_index/ on the patch to make function names consistent. Changes in v12: - ("arm64: smp: Mark IPI globals as __ro_after_init") new for v12. - Added a comment about why we account for 16 SGIs when Linux uses 8. - Minor comment change to add "()" after nmi_trigger_cpumask_backtrace. - Updated the commit hash of the commit this depends on. Changes in v11: - Adjust comment about NR_IPI/MAX_IPI. - Don't use confusing "backed by" idiom in comment. - Made arm64_backtrace_ipi() static. - Updated commit message as per Stephen. - arch_send_wakeup_ipi() now takes an unsigned int. Changes in v10: - ("IPI_CPU_STOP and IPI_CPU_CRASH_STOP should try for NMI") new for v10. - ("arm64: smp: Remove dedicated wakeup IPI") new for v10. - Backtrace now directly supported in smp.c - Don't allocate the cpumask on the stack; just iterate. - Moved kgdb calls to smp.c to avoid needing to export IPI info. - Rewrite as needed for 5.11+ as per Mark Rutland and Sumit. - Squash backtrace into patch adding support for pseudo-NMI IPIs. - kgdb now has its own IPI. Changes in v9: - Added comments that we might not be using NMI always. - Added to commit message that this doesn't catch all cases. - Fold in v8 patch #10 ("Fallback to a regular IPI if NMI isn't enabled") - Moved header file out of "include" since it didn't need to be there. - Remove arm64_supports_nmi() - Remove fallback for when debug IPI isn't available. - Renamed "NMI IPI" to "debug IPI" since it might not be backed by NMI. - arch_trigger_cpumask_backtrace() no longer returns bool Changes in v8: - "Tag the arm64 idle functions as __cpuidle" new for v8 - Removed "#ifdef CONFIG_SMP" since arm64 is always SMP - debug_ipi_setup() and debug_ipi_teardown() no longer take cpu param Douglas Anderson (6): irqchip/gic-v3: Enable support for SGIs to act as NMIs arm64: idle: Tag the arm64 idle functions as __cpuidle arm64: smp: Add arch support for backtrace using pseudo-NMI arm64: smp: IPI_CPU_STOP and IPI_CPU_CRASH_STOP should try for NMI arm64: kgdb: Implement kgdb_roundup_cpus() to enable pseudo-NMI roundup arm64: smp: Mark IPI globals as __ro_after_init Mark Rutland (1): arm64: smp: Remove dedicated wakeup IPI arch/arm64/include/asm/irq.h | 3 + arch/arm64/include/asm/smp.h | 4 +- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- arch/arm64/kernel/idle.c | 4 +- arch/arm64/kernel/smp.c | 139 +++++++++++++++++----- drivers/irqchip/irq-gic-v3.c | 59 ++++++--- 6 files changed, 160 insertions(+), 51 deletions(-) -- 2.42.0.283.g2d96d420d3-goog
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, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Lecopzer Chen <lecopzer.chen@mediatek.com>, Chen-Yu Tsai <wens@csie.org>, Tomohiro Misono <misono.tomohiro@fujitsu.com>, Peter Zijlstra <peterz@infradead.org>, Masayoshi Mizuma <msys.mizuma@gmail.com>, Stephane Eranian <eranian@google.com>, Ard Biesheuvel <ardb@kernel.org>, kgdb-bugreport@lists.sourceforge.net, Stephen Boyd <swboyd@chromium.org>, linux-perf-users@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>, ito-yuichi@fujitsu.com, Douglas Anderson <dianders@chromium.org>, gautham.shenoy@amd.com, jpoimboe@kernel.org, keescook@chromium.org, linux-kernel@vger.kernel.org, mingo@kernel.org, philmd@linaro.org, samitolvanen@google.com, scott@os.amperecomputing.com, vschneid@redhat.com Subject: [PATCH v13 0/7] arm64: Add IPI for backtraces / kgdb; try to use NMI for some IPIs Date: Wed, 6 Sep 2023 09:02:55 -0700 [thread overview] Message-ID: <20230906160505.2431857-1-dianders@chromium.org> (raw) This is an attempt to resurrect Sumit's old patch series [1] that allowed us to use the arm64 pseudo-NMI to get backtraces of CPUs and also to round up CPUs in kdb/kgdb. The last post from Sumit that I could find was v7, so I started my series at v8. I haven't copied all of his old changelongs here, but you can find them from the link. This patch series targets v6.6. Specifically it can't land in v6.5 since it depends on commit 8d539b84f1e3 ("nmi_backtrace: allow excluding an arbitrary CPU"). It should be noted that Mark still feels there might be some corner cases where pseudo-NMI is not production ready [2] [3], but as far as I'm aware there are no concrete/documented issues. Regardless of whether this should be enabled for production, though, this series will be invaluable to anyone trying to debug crashes on arm64 machines. v13 of this series fixes a nit with the names of two functions and collects more tags. There are no code changes other than the renames and these have no functional impact. I believe that the series is ready to land. As per the note in patch #1, I'm hoping for an Ack from Marc Zyngier on patch #1 and then the whole series can land through the arm64 tree. v12 of this series collects tags, fixes a few small nits in comments and commit messages from v11 and adds a new (and somewhat unrelated) small patch to the end of the series. There are no code changes other than the last patch, which is tiny. v11 of this series addressed Stephen Boyd's feedback on v10 and added a missing "static" that the patches robot found. v10 of this series attempted to address all of Mark's feedback on v9. As a quick summary: - It includes his patch to remove IPI_WAKEUP, freeing up an extra IPI. - It no longer combines the "kgdb" and "backtrace" IPIs. If we need another IPI these could always be recombined later. - It promotes IPI_CPU_STOP and IPI_CPU_CRASH_STOP to NMI. - It puts nearly all the code directly in smp.c. - Several of the patches are squashed together. - Patch #6 ("kgdb: Provide a stub kgdb_nmicallback() if !CONFIG_KGDB") was dropped from the series since it landed. Between v8 and v9, I had cleaned up this patch series by integrating the 10th patch from v8 [4] into the whole series. As part of this, I renamed the "NMI IPI" to the "debug IPI" since it could now be backed by a regular IPI in the case that pseudo NMIs weren't available. With the fallback, this allowed me to drop some extra patches from the series. This feels (to me) to be pretty clean and hopefully others agree. Any patch I touched significantly I removed Masayoshi and Chen-Yu's tags from. ...also in v8, I reorderd the patches a bit in a way that seemed a little cleaner to me. Since v7, I have: * Addressed the small amount of feedback that was there for v7. * Rebased. * Added a new patch that prevents us from spamming the logs with idle tasks. * Added an extra patch to gracefully fall back to regular IPIs if pseudo-NMIs aren't there. It can be noted that this patch series works very well with the recent "hardlockup" patches that have landed through Andrew Morton's tree and are currently in mainline. It works especially well with the "buddy" lockup detector. [1] https://lore.kernel.org/linux-arm-kernel/1604317487-14543-1-git-send-email-sumit.garg@linaro.org/ [2] https://lore.kernel.org/lkml/ZFvGqD%2F%2Fpm%2FlZb+p@FVFF77S0Q05N.cambridge.arm.com/ [3] https://lore.kernel.org/lkml/ZNDKVP2m-iiZCz3v@FVFF77S0Q05N.cambridge.arm.com [4] https://lore.kernel.org/r/20230419155341.v8.10.Ic3659997d6243139d0522fc3afcdfd88d7a5f030@changeid/ Changes in v13: - s/_idx/_index/ on the patch to make function names consistent. Changes in v12: - ("arm64: smp: Mark IPI globals as __ro_after_init") new for v12. - Added a comment about why we account for 16 SGIs when Linux uses 8. - Minor comment change to add "()" after nmi_trigger_cpumask_backtrace. - Updated the commit hash of the commit this depends on. Changes in v11: - Adjust comment about NR_IPI/MAX_IPI. - Don't use confusing "backed by" idiom in comment. - Made arm64_backtrace_ipi() static. - Updated commit message as per Stephen. - arch_send_wakeup_ipi() now takes an unsigned int. Changes in v10: - ("IPI_CPU_STOP and IPI_CPU_CRASH_STOP should try for NMI") new for v10. - ("arm64: smp: Remove dedicated wakeup IPI") new for v10. - Backtrace now directly supported in smp.c - Don't allocate the cpumask on the stack; just iterate. - Moved kgdb calls to smp.c to avoid needing to export IPI info. - Rewrite as needed for 5.11+ as per Mark Rutland and Sumit. - Squash backtrace into patch adding support for pseudo-NMI IPIs. - kgdb now has its own IPI. Changes in v9: - Added comments that we might not be using NMI always. - Added to commit message that this doesn't catch all cases. - Fold in v8 patch #10 ("Fallback to a regular IPI if NMI isn't enabled") - Moved header file out of "include" since it didn't need to be there. - Remove arm64_supports_nmi() - Remove fallback for when debug IPI isn't available. - Renamed "NMI IPI" to "debug IPI" since it might not be backed by NMI. - arch_trigger_cpumask_backtrace() no longer returns bool Changes in v8: - "Tag the arm64 idle functions as __cpuidle" new for v8 - Removed "#ifdef CONFIG_SMP" since arm64 is always SMP - debug_ipi_setup() and debug_ipi_teardown() no longer take cpu param Douglas Anderson (6): irqchip/gic-v3: Enable support for SGIs to act as NMIs arm64: idle: Tag the arm64 idle functions as __cpuidle arm64: smp: Add arch support for backtrace using pseudo-NMI arm64: smp: IPI_CPU_STOP and IPI_CPU_CRASH_STOP should try for NMI arm64: kgdb: Implement kgdb_roundup_cpus() to enable pseudo-NMI roundup arm64: smp: Mark IPI globals as __ro_after_init Mark Rutland (1): arm64: smp: Remove dedicated wakeup IPI arch/arm64/include/asm/irq.h | 3 + arch/arm64/include/asm/smp.h | 4 +- arch/arm64/kernel/acpi_parking_protocol.c | 2 +- arch/arm64/kernel/idle.c | 4 +- arch/arm64/kernel/smp.c | 139 +++++++++++++++++----- drivers/irqchip/irq-gic-v3.c | 59 ++++++--- 6 files changed, 160 insertions(+), 51 deletions(-) -- 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
next reply other threads:[~2023-09-06 16:06 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-06 16:02 Douglas Anderson [this message] 2023-09-06 16:02 ` [PATCH v13 0/7] arm64: Add IPI for backtraces / kgdb; try to use NMI for some IPIs Douglas Anderson 2023-09-06 16:02 ` [PATCH v13 1/7] irqchip/gic-v3: Enable support for SGIs to act as NMIs Douglas Anderson 2023-09-06 16:02 ` Douglas Anderson 2023-09-12 12:43 ` Marc Zyngier 2023-09-12 12:43 ` Marc Zyngier 2023-09-06 16:02 ` [PATCH v13 2/7] arm64: idle: Tag the arm64 idle functions as __cpuidle Douglas Anderson 2023-09-06 16:02 ` Douglas Anderson 2023-09-06 16:02 ` [PATCH v13 3/7] arm64: smp: Remove dedicated wakeup IPI Douglas Anderson 2023-09-06 16:02 ` Douglas Anderson 2023-09-26 0:39 ` Doug Anderson 2023-09-26 0:39 ` Doug Anderson 2023-10-02 16:48 ` Doug Anderson 2023-10-02 16:48 ` Doug Anderson 2023-09-06 16:02 ` [PATCH v13 4/7] arm64: smp: Add arch support for backtrace using pseudo-NMI Douglas Anderson 2023-09-06 16:02 ` Douglas Anderson 2023-09-06 16:03 ` [PATCH v13 5/7] arm64: smp: IPI_CPU_STOP and IPI_CPU_CRASH_STOP should try for NMI Douglas Anderson 2023-09-06 16:03 ` Douglas Anderson 2023-09-06 16:03 ` [PATCH v13 6/7] arm64: kgdb: Implement kgdb_roundup_cpus() to enable pseudo-NMI roundup Douglas Anderson 2023-09-06 16:03 ` Douglas Anderson 2023-09-06 16:03 ` [PATCH v13 7/7] arm64: smp: Mark IPI globals as __ro_after_init Douglas Anderson 2023-09-06 16:03 ` Douglas Anderson 2023-09-06 21:45 ` Stephen Boyd 2023-09-06 21:45 ` Stephen Boyd 2023-09-25 17:10 ` [PATCH v13 0/7] arm64: Add IPI for backtraces / kgdb; try to use NMI for some IPIs Catalin Marinas 2023-09-25 17:10 ` Catalin Marinas
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=20230906160505.2431857-1-dianders@chromium.org \ --to=dianders@chromium.org \ --cc=ardb@kernel.org \ --cc=catalin.marinas@arm.com \ --cc=daniel.thompson@linaro.org \ --cc=eranian@google.com \ --cc=gautham.shenoy@amd.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=mingo@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.