public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-userspace] new functions on_vcpu() causing segafault when trying to use breakpoints
@ 2008-05-30 19:27 Jerone Young
  2008-05-30 20:23 ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Jerone Young @ 2008-05-30 19:27 UTC (permalink / raw)
  To: kvm

New code recently added to the repository has made some modifications to
the kvm_update_debugger() function in qemu-kvm.c. Where as no longer  to
just call kvm_guest_debug...Now there is a new fuction on_vcpu() that
places things in work queues and launches them.

The problem is when kvm_invold_guest_debug() gets called, it segfaults
calling kvm_guest_debug().

What exactly is the point of complicating this? 

This code does segfault on x86 also. For now I have just placed the old
code back locally.

 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-userspace] new functions on_vcpu() causing segafault when trying to use breakpoints
  2008-05-30 19:27 [kvm-userspace] new functions on_vcpu() causing segafault when trying to use breakpoints Jerone Young
@ 2008-05-30 20:23 ` Jan Kiszka
  2008-05-30 20:55   ` Jerone Young
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2008-05-30 20:23 UTC (permalink / raw)
  To: jyoung5; +Cc: kvm

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]

Jerone Young wrote:
> New code recently added to the repository has made some modifications to
> the kvm_update_debugger() function in qemu-kvm.c. Where as no longer  to
> just call kvm_guest_debug...Now there is a new fuction on_vcpu() that
> places things in work queues and launches them.
> 
> The problem is when kvm_invold_guest_debug() gets called, it segfaults
> calling kvm_guest_debug().

I bet this piece from [1] will solve it:

Index: b/qemu/qemu-kvm.c
===================================================================
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -268,7 +268,7 @@ static void kvm_main_loop_wait(CPUState 
 	exit(1);
     }
 
-
+    cpu_single_env = env;
     flush_queued_work(env);
 
     if (vcpu_info[env->cpu_index].stop) {


I didn't bother posting it separately as I (obviously wrongly) assumed
this wouldn't trigger for the existing code.

> 
> What exactly is the point of complicating this? 

The old code quickly live-locked when you invoked kvm_guest_debug while
the target vcpu was still running. I suggested to stop the vcpu when
invoking this (and other problematic) services, Avi preferred the
on_vcpu aproach. And that, indeed, turned out to be cleaner and easier
reusable.

> 
> This code does segfault on x86 also. For now I have just placed the old
> code back locally.

I would be happy if you could give my patches a spin as well. I was
using them for kernel debugging during this week, but I guess I'm still
alone. :->

Jan

[1] http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/17968


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-userspace] new functions on_vcpu() causing segafault when trying to use breakpoints
  2008-05-30 20:23 ` Jan Kiszka
@ 2008-05-30 20:55   ` Jerone Young
  0 siblings, 0 replies; 3+ messages in thread
From: Jerone Young @ 2008-05-30 20:55 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm

On Fri, 2008-05-30 at 22:23 +0200, Jan Kiszka wrote:
> Jerone Young wrote:
> > New code recently added to the repository has made some modifications to
> > the kvm_update_debugger() function in qemu-kvm.c. Where as no longer  to
> > just call kvm_guest_debug...Now there is a new fuction on_vcpu() that
> > places things in work queues and launches them.
> > 
> > The problem is when kvm_invold_guest_debug() gets called, it segfaults
> > calling kvm_guest_debug().
> 
> I bet this piece from [1] will solve it:
> 
> Index: b/qemu/qemu-kvm.c
> ===================================================================
> --- a/qemu/qemu-kvm.c
> +++ b/qemu/qemu-kvm.c
> @@ -268,7 +268,7 @@ static void kvm_main_loop_wait(CPUState 
>  	exit(1);
>      }
>  
> -
> +    cpu_single_env = env;
>      flush_queued_work(env);
>  
>      if (vcpu_info[env->cpu_index].stop) {
> 
> 
> I didn't bother posting it separately as I (obviously wrongly) assumed
> this wouldn't trigger for the existing code.

Yeap that was it. Works fine now.  Your going to want to send this patch
out.

> 
> > 
> > What exactly is the point of complicating this? 
> 
> The old code quickly live-locked when you invoked kvm_guest_debug while
> the target vcpu was still running. I suggested to stop the vcpu when
> invoking this (and other problematic) services, Avi preferred the
> on_vcpu aproach. And that, indeed, turned out to be cleaner and easier
> reusable.

ah I see.
> 
> > 
> > This code does segfault on x86 also. For now I have just placed the old
> > code back locally.
> 
> I would be happy if you could give my patches a spin as well. I was
> using them for kernel debugging during this week, but I guess I'm still
> alone. :->

I would help, but I'm having a fun time debugging this week myself ;-)
I'll let you if/when I can help out though.

> 
> Jan
> 
> [1] http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/17968
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-30 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30 19:27 [kvm-userspace] new functions on_vcpu() causing segafault when trying to use breakpoints Jerone Young
2008-05-30 20:23 ` Jan Kiszka
2008-05-30 20:55   ` Jerone Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox