public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Exception handling between QEMU and KVM
@ 2009-07-01  3:28 Christoffer Dall
       [not found] ` <7d08b87d0906302028q4bd7c9efifd399be9529fdc5b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Christoffer Dall @ 2009-07-01  3:28 UTC (permalink / raw)
  To: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA
  Cc: Andreas Nilsson

Hi all.

We are still working on our ARM port of KVM and we are managing to let
the guest decompress the kernel image and run from relocated address
and we can support enabling MMU before this.

Howver, to debug relocated micro-hypervisor for exception handling, we
are trying to implement some NOT_IMPLEMENTED() macros and ASSERT()
macros.

What we have done so far is simply to exit QEMU roughly after
returning -EINVAL from the KVM_RUN system call, but before we start
supporting an interrupt cycle we have to improve on this. Setting
kvm_run->exit_reason = KVM_EXIT_EXCEPTION or kvm_run->exit_reason =
KVM_EXIT_SHUTDOWN just results in QEMU looping in the cpu execution
loop.

Can someone point us in the direction of what we're missing here in
order to exit the whole QEMU process from an exception occurring
inside the guest?

Thanks!

Kind regards,
Christoffer Dall
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Exception handling between QEMU and KVM
       [not found] ` <7d08b87d0906302028q4bd7c9efifd399be9529fdc5b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-07-01  6:28   ` Alexander Graf
  2009-07-01  9:00   ` Avi Kivity
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2009-07-01  6:28 UTC (permalink / raw)
  To: Christoffer Dall
  Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA,
	Andreas Nilsson


On 01.07.2009, at 05:28, Christoffer Dall wrote:

> Hi all.
>
> We are still working on our ARM port of KVM and we are managing to let
> the guest decompress the kernel image and run from relocated address
> and we can support enabling MMU before this.
>
> Howver, to debug relocated micro-hypervisor for exception handling, we
> are trying to implement some NOT_IMPLEMENTED() macros and ASSERT()
> macros.
>
> What we have done so far is simply to exit QEMU roughly after
> returning -EINVAL from the KVM_RUN system call, but before we start
> supporting an interrupt cycle we have to improve on this. Setting
> kvm_run->exit_reason = KVM_EXIT_EXCEPTION or kvm_run->exit_reason =
> KVM_EXIT_SHUTDOWN just results in QEMU looping in the cpu execution
> loop.
>
> Can someone point us in the direction of what we're missing here in
> order to exit the whole QEMU process from an exception occurring
> inside the guest?

I'm still having a hard time understanding what exactly you're trying  
to do.

If you need to have your machine quit, just set exit_reason to some  
value you want to use for that purpose and make it behave accordingly  
in target-arm/kvm.c.

But I really can't think of any scenarios where you'd need it.  
Shouldn't all exceptions be handled in the kernel module? What exactly  
are you trying to implement here?

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Exception handling between QEMU and KVM
       [not found] ` <7d08b87d0906302028q4bd7c9efifd399be9529fdc5b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2009-07-01  6:28   ` Alexander Graf
@ 2009-07-01  9:00   ` Avi Kivity
       [not found]     ` <4A4B25A0.70800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2009-07-01  9:00 UTC (permalink / raw)
  To: Christoffer Dall
  Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA,
	Andreas Nilsson

On 07/01/2009 06:28 AM, Christoffer Dall wrote:
> Hi all.
>
> We are still working on our ARM port of KVM and we are managing to let
> the guest decompress the kernel image and run from relocated address
> and we can support enabling MMU before this.
>
> Howver, to debug relocated micro-hypervisor for exception handling, we
> are trying to implement some NOT_IMPLEMENTED() macros and ASSERT()
> macros.
>
> What we have done so far is simply to exit QEMU roughly after
> returning -EINVAL from the KVM_RUN system call, but before we start
> supporting an interrupt cycle we have to improve on this. Setting
> kvm_run->exit_reason = KVM_EXIT_EXCEPTION or kvm_run->exit_reason =
> KVM_EXIT_SHUTDOWN just results in QEMU looping in the cpu execution
> loop.
>
> Can someone point us in the direction of what we're missing here in
> order to exit the whole QEMU process from an exception occurring
> inside the guest?
>    

Not sure I understand.  Can't you call exit() or abort() after kvm 
returns an error?

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Exception handling between QEMU and KVM
       [not found]     ` <4A4B25A0.70800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-01 13:59       ` Christoffer Dall
       [not found]         ` <7d08b87d0907010659v6e0efac1va906991402589ab7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Christoffer Dall @ 2009-07-01 13:59 UTC (permalink / raw)
  To: Avi Kivity
  Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA,
	Andreas Nilsson

OK, my question is this:

If I want to tell QEMU to quit from within the KVM_RUN ioctl in a way
that causes QEMU to exit gracefully (e.g. free any allocated memory
etc.) what is the way to do that?

I have tried setting EXIT_REASON to both KVM_EXIT_EXCEPTION and
KVM_EXIT_SHUTDOWN, but QEMU stays in the execution loop and
re-executes the machine over and over.

Is this some logic that has to be done architecture specifically in
kvm_arch_post_run(...) or ?

And yes, any exceptions should be handled in KVM, but in the case of
an unrecoverable error I'm left with reporting this to the user and
end the QEMU process, right?

Thanks,
Christoffer

On Wed, Jul 1, 2009 at 5:00 AM, Avi Kivity<avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On 07/01/2009 06:28 AM, Christoffer Dall wrote:
>>
>> Hi all.
>>
>> We are still working on our ARM port of KVM and we are managing to let
>> the guest decompress the kernel image and run from relocated address
>> and we can support enabling MMU before this.
>>
>> Howver, to debug relocated micro-hypervisor for exception handling, we
>> are trying to implement some NOT_IMPLEMENTED() macros and ASSERT()
>> macros.
>>
>> What we have done so far is simply to exit QEMU roughly after
>> returning -EINVAL from the KVM_RUN system call, but before we start
>> supporting an interrupt cycle we have to improve on this. Setting
>> kvm_run->exit_reason = KVM_EXIT_EXCEPTION or kvm_run->exit_reason =
>> KVM_EXIT_SHUTDOWN just results in QEMU looping in the cpu execution
>> loop.
>>
>> Can someone point us in the direction of what we're missing here in
>> order to exit the whole QEMU process from an exception occurring
>> inside the guest?
>>
>
> Not sure I understand.  Can't you call exit() or abort() after kvm returns
> an error?
>
> --
> error compiling committee.c: too many arguments to function
>
>
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Exception handling between QEMU and KVM
       [not found]         ` <7d08b87d0907010659v6e0efac1va906991402589ab7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-07-01 15:02           ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2009-07-01 15:02 UTC (permalink / raw)
  To: Christoffer Dall
  Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA, kvm-u79uwXL29TY76Z2rM5mHXA,
	Andreas Nilsson

On 07/01/2009 04:59 PM, Christoffer Dall wrote:
> OK, my question is this:
>
> If I want to tell QEMU to quit from within the KVM_RUN ioctl in a way
> that causes QEMU to exit gracefully (e.g. free any allocated memory
> etc.) what is the way to do that?
>    

Have KVM_RUN return -ESOMETHING, qemu should abort when it sees that.

> I have tried setting EXIT_REASON to both KVM_EXIT_EXCEPTION and
> KVM_EXIT_SHUTDOWN, but QEMU stays in the execution loop and
> re-executes the machine over and over.
>
> Is this some logic that has to be done architecture specifically in
> kvm_arch_post_run(...) or ?
>    

I don't remember exactly.  It also depends on what version of the source 
you're looking at.

> And yes, any exceptions should be handled in KVM, but in the case of
> an unrecoverable error I'm left with reporting this to the user and
> end the QEMU process, right?
>    

Yes.  Current sources pause the vm so you can inspect guest state via 
the monitor.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-07-01 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01  3:28 Exception handling between QEMU and KVM Christoffer Dall
     [not found] ` <7d08b87d0906302028q4bd7c9efifd399be9529fdc5b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-01  6:28   ` Alexander Graf
2009-07-01  9:00   ` Avi Kivity
     [not found]     ` <4A4B25A0.70800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-01 13:59       ` Christoffer Dall
     [not found]         ` <7d08b87d0907010659v6e0efac1va906991402589ab7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-01 15:02           ` Avi Kivity

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