public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: kvm-devel <kvm@vger.kernel.org>
Cc: Avi Kivity <avi@qumranet.com>,
	Hollis Blanchard <hollisb@us.ibm.com>,
	Jerone Young <jyoung5@us.ibm.com>,
	Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 8/11] QEMU/KVM: Support for SMP guest debugging
Date: Tue, 27 May 2008 00:10:26 +0200	[thread overview]
Message-ID: <483B3552.4030109@web.de> (raw)
In-Reply-To: <4839B14A.3010406@web.de>

Enables debugging of SMP guests via the new KVM debug interface. It
updates the monitored CPU on breakpoints and unsures that breakpoint
changes are propagested to all virtual CPUs.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 qemu/qemu-kvm.c |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

Index: b/qemu/qemu-kvm.c
===================================================================
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -19,6 +19,7 @@ int kvm_pit = 1;
 #include "qemu-common.h"
 #include "console.h"
 #include "block.h"
+#include "monitor.h"
 
 #include "qemu-kvm.h"
 #include <libkvm.h>
@@ -58,7 +59,7 @@ pthread_t io_thread;
 static int io_thread_fd = -1;
 static int io_thread_sigfd = -1;
 
-static int kvm_debug_stop_requested;
+static CPUState *kvm_debug_cpu_requested;
 
 static inline unsigned long kvm_get_thread_id(void)
 {
@@ -534,9 +535,10 @@ int kvm_main_loop(void)
             qemu_system_powerdown();
         else if (qemu_reset_requested())
 	    qemu_kvm_system_reset();
-	else if (kvm_debug_stop_requested) {
+	else if (kvm_debug_cpu_requested) {
+	    mon_set_cpu(kvm_debug_cpu_requested);
 	    vm_stop(EXCP_DEBUG);
-	    kvm_debug_stop_requested = 0;
+	    kvm_debug_cpu_requested = NULL;
 	}
     }
 
@@ -552,7 +554,7 @@ int kvm_debug(void *opaque, int vcpu, st
     int handle = kvm_arch_debug(arch_info);
 
     if (handle) {
-	kvm_debug_stop_requested = 1;
+	kvm_debug_cpu_requested = cpu_single_env;
 	vcpu_info[vcpu].stopped = 1;
     }
     return handle;
@@ -846,7 +848,12 @@ int kvm_insert_breakpoint(CPUState *env,
 	if (err)
 	    return err;
     }
-    return kvm_update_guest_debug(env, 0);
+    foreach_cpu(env) {
+	err = kvm_update_guest_debug(env, 0);
+	if (err)
+	    break;
+    }
+    return err;
 }
 
 int kvm_remove_breakpoint(CPUState *env, target_ulong addr,
@@ -882,7 +889,12 @@ int kvm_remove_breakpoint(CPUState *env,
 	if (err)
 	    return err;
     }
-    return kvm_update_guest_debug(env, 0);
+    foreach_cpu(env) {
+	err = kvm_update_guest_debug(env, 0);
+	if (err)
+	    break;
+    }
+    return err;
 }
 
 #else /* !KVM_CAP_SET_GUEST_DEBUG */




  parent reply	other threads:[~2008-05-26 22:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26 22:05 [PATCH 0/11] Rework guest debug interface / x86 debug register support -v2 Jan Kiszka
2008-05-26 22:09 ` [PATCH 1/11] QEMU/KVM: Fix deadlocks in monitor and debugger Jan Kiszka
2008-05-27  9:36   ` Avi Kivity
2008-05-27 13:00     ` Jan Kiszka
2008-05-27 13:09       ` Avi Kivity
2008-05-26 22:09 ` [PATCH 2/11] QEMU/KVM: Cleanup and improve kvm_load/save_registers usage Jan Kiszka
2008-06-09 19:16   ` Anthony Liguori
2008-06-12 12:38     ` Avi Kivity
2008-05-26 22:09 ` [PATCH 3/11] QEMU/KVM: Proper vm_stop on debug events Jan Kiszka
2008-05-26 22:09 ` [PATCH 4/11] QEMU: Enhance cpu_break/watchpoint API and gdbstub integration Jan Kiszka
2008-05-26 22:10 ` [PATCH 5/11] QEMU: Improve SMP debugging support Jan Kiszka
2008-05-26 22:10 ` [PATCH 6/11] QEMU/KVM: Introduce single vcpu pause/resume Jan Kiszka
2008-05-26 22:10 ` [PATCH 7/11] QEMU/KVM: New guest debugging interface Jan Kiszka
2008-05-27 18:31   ` Jan Kiszka
2008-05-26 22:10 ` Jan Kiszka [this message]
2008-05-26 22:10 ` [PATCH 9/11] KVM: " Jan Kiszka
2008-05-26 22:10 ` [PATCH 10/11] KVM-x86: Properly virtualize debug registers Jan Kiszka
2008-05-26 22:10 ` [PATCH 11/11] KVM-x86: Wire up host-managed " Jan Kiszka
2008-05-27  9:50 ` [PATCH 0/11] Rework guest debug interface / x86 debug register support -v2 Avi Kivity
2008-05-27 10:44   ` Jan Kiszka
2008-05-27 18:46   ` Hollis Blanchard

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=483B3552.4030109@web.de \
    --to=jan.kiszka@web.de \
    --cc=avi@qumranet.com \
    --cc=hollisb@us.ibm.com \
    --cc=joerg.roedel@amd.com \
    --cc=jyoung5@us.ibm.com \
    --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