From: Jan Kiszka <jan.kiszka@web.de>
To: kvm-devel <kvm@vger.kernel.org>
Subject: [PATCH] kvm-qemu: Proper vm_stop on debug events
Date: Fri, 23 May 2008 02:09:47 +0200 [thread overview]
Message-ID: <48360B4B.10105@web.de> (raw)
When a vcpu exits after hitting a debug exception, we have to invoke
vm_stop(EXCP_DEBUG). But this has to take place over the io-thread.
This patch introduces kvm_debug_stop_requested to signal this event, and
it takes care that the interrupted vcpu itself goes immediately into
stop state.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
qemu/qemu-kvm.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: b/qemu/qemu-kvm.c
===================================================================
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -58,6 +58,8 @@ pthread_t io_thread;
static int io_thread_fd = -1;
static int io_thread_sigfd = -1;
+static int kvm_debug_stop_requested;
+
static inline unsigned long kvm_get_thread_id(void)
{
return syscall(SYS_gettid);
@@ -517,6 +519,10 @@ int kvm_main_loop(void)
qemu_system_powerdown();
else if (qemu_reset_requested())
qemu_kvm_system_reset();
+ else if (kvm_debug_stop_requested) {
+ kvm_debug_stop_requested = 0;
+ vm_stop(EXCP_DEBUG);
+ }
}
pause_all_threads();
@@ -529,7 +535,8 @@ static int kvm_debug(void *opaque, int v
{
CPUState *env = cpu_single_env;
- env->exception_index = EXCP_DEBUG;
+ kvm_debug_stop_requested = 1;
+ vcpu_info[vcpu].stopped = 1;
return 1;
}
next reply other threads:[~2008-05-23 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 0:09 Jan Kiszka [this message]
2008-05-23 0:35 ` [PATCH] kvm-qemu: Proper vm_stop on debug events Anthony Liguori
2008-05-23 2:10 ` Jan Kiszka
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=48360B4B.10105@web.de \
--to=jan.kiszka@web.de \
--cc=kvm@vger.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: 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