The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0731b0a9f1f9e3b4ec699ec67b6eb24159fa9b05

commit 0731b0a9f1f9e3b4ec699ec67b6eb24159fa9b05
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2023-05-23 09:21:39 +0000
Commit:     Andrew Turner <and...@freebsd.org>
CommitDate: 2023-05-24 16:20:06 +0000

    Print registers on an arm64 spinlock data abort
    
    When checking if the spinlock count is correct in a data abort we can
    panic without printing the registers. These are useful to debug the
    abort, e.g. by giving the fault address register.
    
    Reviewed by:    kib
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D40228
---
 sys/arm64/arm64/trap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index 95f2bf46e18e..17bda56d806e 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -324,8 +324,14 @@ data_abort(struct thread *td, struct trapframe *frame, 
uint64_t esr,
            pmap_fault(map->pmap, esr, far) == KERN_SUCCESS)
                return;
 
-       KASSERT(td->td_md.md_spinlock_count == 0,
-           ("data abort with spinlock held"));
+#ifdef INVARIANTS
+       if (td->td_md.md_spinlock_count != 0) {
+               print_registers(frame);
+               print_gp_register("far", far);
+               printf(" esr: %.16lx\n", esr);
+               panic("data abort with spinlock held");
+       }
+#endif
        if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK |
            WARN_GIANTOK, NULL, "Kernel page fault") != 0) {
                print_registers(frame);

Reply via email to