public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org
Cc: pbonzini@redhat.com, thuth@redhat.com
Subject: [kvm-unit-tests PATCH v2 01/13] riscv: Call abort instead of assert on unhandled exceptions
Date: Tue,  5 Mar 2024 18:09:00 +0100	[thread overview]
Message-ID: <20240305170858.395836-16-andrew.jones@linux.dev> (raw)
In-Reply-To: <20240305170858.395836-15-andrew.jones@linux.dev>

We should call abort() instead of assert() on an unhandled
exception since assert() calls abort() anyway after a useless
"assert failed: 0" message. We can also skip dumping the
exception stack and just unwind from the stack frame where
the exception occurred.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---
 lib/riscv/processor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/riscv/processor.c b/lib/riscv/processor.c
index e0904209c0da..6c868b805cf7 100644
--- a/lib/riscv/processor.c
+++ b/lib/riscv/processor.c
@@ -43,7 +43,8 @@ void do_handle_exception(struct pt_regs *regs)
 	}
 
 	show_regs(regs);
-	assert(0);
+	dump_frame_stack((void *)regs->epc, (void *)regs->s0);
+	abort();
 }
 
 void install_exception_handler(unsigned long cause, void (*handler)(struct pt_regs *))
-- 
2.44.0


  reply	other threads:[~2024-03-05 17:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 17:08 [kvm-unit-tests PATCH v2 00/13] Enable EFI support Andrew Jones
2024-03-05 17:09 ` Andrew Jones [this message]
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 02/13] riscv: show_regs: Prepare for EFI images Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 03/13] treewide: lib/stack: Fix backtrace Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 04/13] treewide: lib/stack: Make base_address arch specific Andrew Jones
2024-03-12  5:45   ` Nicholas Piggin
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 05/13] riscv: Import gnu-efi files Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 06/13] riscv: Tweak the gnu-efi imported code Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 07/13] riscv: Enable building for EFI Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 08/13] riscv: efi: Switch stack in _start Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 09/13] efi: Add support for obtaining the boot hartid Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 10/13] riscv: Refactor setup code Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 11/13] riscv: Enable EFI boot Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 12/13] riscv: efi: Add run script Andrew Jones
2024-03-05 17:09 ` [kvm-unit-tests PATCH v2 13/13] riscv: efi: Use efi-direct by default Andrew Jones
2024-03-18 17:28 ` [kvm-unit-tests PATCH v2 00/13] Enable EFI support Andrew Jones

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=20240305170858.395836-16-andrew.jones@linux.dev \
    --to=andrew.jones@linux.dev \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox