public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Update kvm.h in qemu-kvm tree
@ 2009-08-28 14:48 Mohammed Gamal
  2009-08-28 14:48 ` [PATCH 2/2] Handle emulation failure in userspace Mohammed Gamal
  0 siblings, 1 reply; 4+ messages in thread
From: Mohammed Gamal @ 2009-08-28 14:48 UTC (permalink / raw)
  To: avi; +Cc: kvm, Mohammed Gamal

Update struct kvm_run and KVM_EXIT_* constants to match the one in the
kernel-space tree

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 kvm/include/linux/kvm.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
index ff1025d..801865d 100644
--- a/kvm/include/linux/kvm.h
+++ b/kvm/include/linux/kvm.h
@@ -135,6 +135,10 @@ struct kvm_pit_config {
 #define KVM_EXIT_S390_RESET       14
 #define KVM_EXIT_DCR              15
 #define KVM_EXIT_NMI              16
+#define KVM_EXIT_INTERNAL_ERROR   17
+
+/* For KVM_EXIT_INTERNAL_ERROR */
+#define KVM_INTERNAL_ERROR_EMULATION 1
 
 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
 struct kvm_run {
@@ -221,6 +225,9 @@ struct kvm_run {
 			__u32 data;
 			__u8  is_write;
 		} dcr;
+		struct {
+			__u32 suberror;
+		} internal;
 		/* Fix the size of the union. */
 		char padding[256];
 	};
-- 
1.6.0.4


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

* [PATCH 2/2] Handle emulation failure in userspace
  2009-08-28 14:48 [PATCH 1/2] Update kvm.h in qemu-kvm tree Mohammed Gamal
@ 2009-08-28 14:48 ` Mohammed Gamal
  2009-09-01 12:31   ` Marcelo Tosatti
  0 siblings, 1 reply; 4+ messages in thread
From: Mohammed Gamal @ 2009-08-28 14:48 UTC (permalink / raw)
  To: avi; +Cc: kvm, Mohammed Gamal

Since we return to userspace from KVM on invalid state emulation failure, let
qemu handle it.

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 qemu-kvm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index b59e403..a1648e0 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1029,6 +1029,14 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
             r = kvm_s390_handle_reset(kvm, vcpu, run);
             break;
 #endif
+	case KVM_EXIT_INTERNAL_ERROR:
+	    kvm_show_regs(vcpu);
+	    fprintf(stderr, "\nKVM internal error. Suberror: %d\n",
+		    run->internal.suberror);
+	    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
+		fprintf(stderr, "emulation failure, check dmesg for details\n");
+	    abort();
+	    break;
         default:
             if (kvm_arch_run(vcpu)) {
                 fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
-- 
1.6.0.4


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

* Re: [PATCH 2/2] Handle emulation failure in userspace
  2009-08-28 14:48 ` [PATCH 2/2] Handle emulation failure in userspace Mohammed Gamal
@ 2009-09-01 12:31   ` Marcelo Tosatti
  2009-09-01 12:56     ` Mohammed Gamal
  0 siblings, 1 reply; 4+ messages in thread
From: Marcelo Tosatti @ 2009-09-01 12:31 UTC (permalink / raw)
  To: Mohammed Gamal; +Cc: avi, kvm

On Fri, Aug 28, 2009 at 04:48:53PM +0200, Mohammed Gamal wrote:
> Since we return to userspace from KVM on invalid state emulation failure, let
> qemu handle it.
> 
> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
> ---
>  qemu-kvm.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/qemu-kvm.c b/qemu-kvm.c
> index b59e403..a1648e0 100644
> --- a/qemu-kvm.c
> +++ b/qemu-kvm.c
> @@ -1029,6 +1029,14 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
>              r = kvm_s390_handle_reset(kvm, vcpu, run);
>              break;
>  #endif
> +	case KVM_EXIT_INTERNAL_ERROR:
> +	    kvm_show_regs(vcpu);
> +	    fprintf(stderr, "\nKVM internal error. Suberror: %d\n",
> +		    run->internal.suberror);
> +	    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
> +		fprintf(stderr, "emulation failure, check dmesg for details\n");
> +	    abort();
> +	    break;
>          default:
>              if (kvm_arch_run(vcpu)) {
>                  fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
> -- 
> 1.6.0.4

The common practice is to print msg first and then kvm_show_regs?
Applied the kvm.h update, thanks.


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

* Re: [PATCH 2/2] Handle emulation failure in userspace
  2009-09-01 12:31   ` Marcelo Tosatti
@ 2009-09-01 12:56     ` Mohammed Gamal
  0 siblings, 0 replies; 4+ messages in thread
From: Mohammed Gamal @ 2009-09-01 12:56 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: avi, kvm

On Tue, Sep 1, 2009 at 2:31 PM, Marcelo Tosatti<mtosatti@redhat.com> wrote:
> On Fri, Aug 28, 2009 at 04:48:53PM +0200, Mohammed Gamal wrote:
>> Since we return to userspace from KVM on invalid state emulation failure, let
>> qemu handle it.
>>
>> Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
>> ---
>>  qemu-kvm.c |    8 ++++++++
>>  1 files changed, 8 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu-kvm.c b/qemu-kvm.c
>> index b59e403..a1648e0 100644
>> --- a/qemu-kvm.c
>> +++ b/qemu-kvm.c
>> @@ -1029,6 +1029,14 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env)
>>              r = kvm_s390_handle_reset(kvm, vcpu, run);
>>              break;
>>  #endif
>> +     case KVM_EXIT_INTERNAL_ERROR:
>> +         kvm_show_regs(vcpu);
>> +         fprintf(stderr, "\nKVM internal error. Suberror: %d\n",
>> +                 run->internal.suberror);
>> +         if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
>> +             fprintf(stderr, "emulation failure, check dmesg for details\n");
>> +         abort();
>> +         break;
>>          default:
>>              if (kvm_arch_run(vcpu)) {
>>                  fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
>> --
>> 1.6.0.4
>
> The common practice is to print msg first and then kvm_show_regs?
True. I just thought the message would be more visible this way. Will resend

> Applied the kvm.h update, thanks.
>
>

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

end of thread, other threads:[~2009-09-01 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-28 14:48 [PATCH 1/2] Update kvm.h in qemu-kvm tree Mohammed Gamal
2009-08-28 14:48 ` [PATCH 2/2] Handle emulation failure in userspace Mohammed Gamal
2009-09-01 12:31   ` Marcelo Tosatti
2009-09-01 12:56     ` Mohammed Gamal

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