All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/6] misc uq/master updates (v2)
@ 2010-03-23 16:37 Marcelo Tosatti
  2010-03-23 16:37 ` [patch 1/6] target-i386: print EFER in cpu_dump_state Marcelo Tosatti
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm

See individual patches for details.



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

* [patch 1/6] target-i386: print EFER in cpu_dump_state
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
@ 2010-03-23 16:37 ` Marcelo Tosatti
  2010-03-23 16:37 ` [patch 2/6] kvm: handle internal error Marcelo Tosatti
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm; +Cc: Marcelo Tosatti

[-- Attachment #1: print-efer --]
[-- Type: text/plain, Size: 478 bytes --]

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-uq/target-i386/helper.c
===================================================================
--- qemu-uq.orig/target-i386/helper.c
+++ qemu-uq/target-i386/helper.c
@@ -355,6 +355,7 @@ void cpu_dump_state(CPUState *env, FILE 
                         cc_op_name);
         }
     }
+    cpu_fprintf(f, "EFER=%016" PRIx64 "\n", env->efer);
     if (flags & X86_DUMP_FPU) {
         int fptag;
         fptag = 0;



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

* [patch 2/6] kvm: handle internal error
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
  2010-03-23 16:37 ` [patch 1/6] target-i386: print EFER in cpu_dump_state Marcelo Tosatti
@ 2010-03-23 16:37 ` Marcelo Tosatti
  2010-03-23 16:37 ` [patch 3/6] kvm: allow qemu to set EPT identity mapping address Marcelo Tosatti
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm; +Cc: Marcelo Tosatti

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

Port qemu-kvm's KVM_EXIT_INTERNAL_ERROR handling to upstream.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-uq/kvm-all.c
===================================================================
--- qemu-uq.orig/kvm-all.c
+++ qemu-uq/kvm-all.c
@@ -721,6 +721,32 @@ static int kvm_handle_io(uint16_t port, 
     return 1;
 }
 
+#ifdef KVM_CAP_INTERNAL_ERROR_DATA
+static void kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
+{
+
+    if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) {
+        int i;
+
+        fprintf(stderr, "KVM internal error. Suberror: %d\n",
+                run->internal.suberror);
+
+        for (i = 0; i < run->internal.ndata; ++i) {
+            fprintf(stderr, "extra data[%d]: %"PRIx64"\n",
+                    i, (uint64_t)run->internal.data[i]);
+        }
+    }
+    cpu_dump_state(env, stderr, fprintf, 0);
+    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
+        fprintf(stderr, "emulation failure\n");
+    }
+    /* FIXME: Should trigger a qmp message to let management know
+     * something went wrong.
+     */
+    vm_stop(0);
+}
+#endif
+
 void kvm_flush_coalesced_mmio_buffer(void)
 {
 #ifdef KVM_CAP_COALESCED_MMIO
@@ -836,6 +862,11 @@ int kvm_cpu_exec(CPUState *env)
         case KVM_EXIT_EXCEPTION:
             dprintf("kvm_exit_exception\n");
             break;
+#ifdef KVM_CAP_INTERNAL_ERROR_DATA
+        case KVM_EXIT_INTERNAL_ERROR:
+            kvm_handle_internal_error(env, run);
+            break;
+#endif
         case KVM_EXIT_DEBUG:
             dprintf("kvm_exit_debug\n");
 #ifdef KVM_CAP_SET_GUEST_DEBUG



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

* [patch 3/6] kvm: allow qemu to set EPT identity mapping address
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
  2010-03-23 16:37 ` [patch 1/6] target-i386: print EFER in cpu_dump_state Marcelo Tosatti
  2010-03-23 16:37 ` [patch 2/6] kvm: handle internal error Marcelo Tosatti
@ 2010-03-23 16:37 ` Marcelo Tosatti
  2010-03-23 16:37 ` [patch 4/6] kvm_init_vcpu requires global lock held Marcelo Tosatti
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm; +Cc: Marcelo Tosatti

[-- Attachment #1: identity-map --]
[-- Type: text/plain, Size: 1464 bytes --]

From: Sheng Yang <sheng@linux.intel.com>

If we use larger BIOS image than current 256KB, we would need move reserved
TSS and EPT identity mapping pages. Currently TSS support this, but not
EPT.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-uq/target-i386/kvm.c
===================================================================
--- qemu-uq.orig/target-i386/kvm.c
+++ qemu-uq/target-i386/kvm.c
@@ -326,6 +326,25 @@ static int kvm_has_msr_star(CPUState *en
     return 0;
 }
 
+static int kvm_init_identity_map_page(KVMState *s)
+{
+#ifdef KVM_CAP_SET_IDENTITY_MAP_ADDR
+    int ret;
+    uint64_t addr = 0xfffbc000;
+
+    if (!kvm_check_extension(s, KVM_CAP_SET_IDENTITY_MAP_ADDR)) {
+        return 0;
+    }
+
+    ret = kvm_vm_ioctl(s, KVM_SET_IDENTITY_MAP_ADDR, &addr);
+    if (ret < 0) {
+        fprintf(stderr, "kvm_set_identity_map_addr: %s\n", strerror(ret));
+        return ret;
+    }
+#endif
+    return 0;
+}
+
 int kvm_arch_init(KVMState *s, int smp_cpus)
 {
     int ret;
@@ -353,7 +372,12 @@ int kvm_arch_init(KVMState *s, int smp_c
         perror("e820_add_entry() table is full");
         exit(1);
     }
-    return kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);
+    ret = kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return kvm_init_identity_map_page(s);
 }
                     
 static void set_v8086_seg(struct kvm_segment *lhs, const SegmentCache *rhs)



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

* [patch 4/6] kvm_init_vcpu requires global lock held
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
                   ` (2 preceding siblings ...)
  2010-03-23 16:37 ` [patch 3/6] kvm: allow qemu to set EPT identity mapping address Marcelo Tosatti
@ 2010-03-23 16:37 ` Marcelo Tosatti
  2010-03-23 16:37 ` [patch 5/6] kvm: init mp_state Marcelo Tosatti
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: init-vcpu-inside-lock --]
[-- Type: text/plain, Size: 635 bytes --]

Since it accesses data protected by the lock.

Index: qemu-uq/vl.c
===================================================================
--- qemu-uq.orig/vl.c
+++ qemu-uq/vl.c
@@ -2447,6 +2447,7 @@ static void *kvm_cpu_thread_fn(void *arg
 {
     CPUState *env = arg;
 
+    qemu_mutex_lock(&qemu_global_mutex);
     qemu_thread_self(env->thread);
     if (kvm_enabled())
         kvm_init_vcpu(env);
@@ -2454,7 +2455,6 @@ static void *kvm_cpu_thread_fn(void *arg
     kvm_block_io_signals(env);
 
     /* signal CPU creation */
-    qemu_mutex_lock(&qemu_global_mutex);
     env->created = 1;
     qemu_cond_signal(&qemu_cpu_cond);
 



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

* [patch 5/6] kvm: init mp_state
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
                   ` (3 preceding siblings ...)
  2010-03-23 16:37 ` [patch 4/6] kvm_init_vcpu requires global lock held Marcelo Tosatti
@ 2010-03-23 16:37 ` Marcelo Tosatti
  2010-03-23 16:37 ` [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu Marcelo Tosatti
  2010-03-24 10:00 ` [patch 0/6] misc uq/master updates (v2) Avi Kivity
  6 siblings, 0 replies; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm; +Cc: Marcelo Tosatti

[-- Attachment #1: reset-mpstate --]
[-- Type: text/plain, Size: 665 bytes --]

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-uq/target-i386/kvm.c
===================================================================
--- qemu-uq.orig/target-i386/kvm.c
+++ qemu-uq/target-i386/kvm.c
@@ -279,6 +279,12 @@ void kvm_arch_reset_vcpu(CPUState *env)
     env->interrupt_injected = -1;
     env->nmi_injected = 0;
     env->nmi_pending = 0;
+    if (kvm_irqchip_in_kernel()) {
+        env->mp_state = cpu_is_bsp(env) ? KVM_MP_STATE_RUNNABLE :
+                                          KVM_MP_STATE_UNINITIALIZED;
+    } else {
+        env->mp_state = KVM_MP_STATE_RUNNABLE;
+    }
 }
 
 static int kvm_has_msr_star(CPUState *env)



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

* [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
                   ` (4 preceding siblings ...)
  2010-03-23 16:37 ` [patch 5/6] kvm: init mp_state Marcelo Tosatti
@ 2010-03-23 16:37 ` Marcelo Tosatti
  2010-06-23 12:29   ` Avi Kivity
  2010-03-24 10:00 ` [patch 0/6] misc uq/master updates (v2) Avi Kivity
  6 siblings, 1 reply; 14+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 16:37 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: remove-explicit-reset --]
[-- Type: text/plain, Size: 438 bytes --]

This is now done via the initialization's qemu_system_reset call.


Index: qemu-uq/kvm-all.c
===================================================================
--- qemu-uq.orig/kvm-all.c
+++ qemu-uq/kvm-all.c
@@ -209,7 +209,6 @@ int kvm_init_vcpu(CPUState *env)
     ret = kvm_arch_init_vcpu(env);
     if (ret == 0) {
         qemu_register_reset(kvm_reset_vcpu, env);
-        kvm_arch_reset_vcpu(env);
     }
 err:
     return ret;



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

* Re: [patch 0/6] misc uq/master updates (v2)
  2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
                   ` (5 preceding siblings ...)
  2010-03-23 16:37 ` [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu Marcelo Tosatti
@ 2010-03-24 10:00 ` Avi Kivity
  6 siblings, 0 replies; 14+ messages in thread
From: Avi Kivity @ 2010-03-24 10:00 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

On 03/23/2010 06:37 PM, Marcelo Tosatti wrote:
> See individual patches for details.
>
>
>    

Applied, thanks.

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


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

* Re: [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-03-23 16:37 ` [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu Marcelo Tosatti
@ 2010-06-23 12:29   ` Avi Kivity
  2010-06-23 12:33     ` Avi Kivity
  0 siblings, 1 reply; 14+ messages in thread
From: Avi Kivity @ 2010-06-23 12:29 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

On 03/23/2010 06:37 PM, Marcelo Tosatti wrote:
> This is now done via the initialization's qemu_system_reset call.
>
>
> Index: qemu-uq/kvm-all.c
> ===================================================================
> --- qemu-uq.orig/kvm-all.c
> +++ qemu-uq/kvm-all.c
> @@ -209,7 +209,6 @@ int kvm_init_vcpu(CPUState *env)
>       ret = kvm_arch_init_vcpu(env);
>       if (ret == 0) {
>           qemu_register_reset(kvm_reset_vcpu, env);
> -        kvm_arch_reset_vcpu(env);
>       }
>   err:
>       return ret;
>
>
>    

I'm testing uq/master, and I see this breaks it.  qemu freezes 
immediately on startup.

(might be due to a rebase?)

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


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

* Re: [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-06-23 12:29   ` Avi Kivity
@ 2010-06-23 12:33     ` Avi Kivity
  2010-06-23 13:19       ` Jan Kiszka
  0 siblings, 1 reply; 14+ messages in thread
From: Avi Kivity @ 2010-06-23 12:33 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

On 06/23/2010 03:29 PM, Avi Kivity wrote:
> On 03/23/2010 06:37 PM, Marcelo Tosatti wrote:
>> This is now done via the initialization's qemu_system_reset call.
>>
>>
>> Index: qemu-uq/kvm-all.c
>> ===================================================================
>> --- qemu-uq.orig/kvm-all.c
>> +++ qemu-uq/kvm-all.c
>> @@ -209,7 +209,6 @@ int kvm_init_vcpu(CPUState *env)
>>       ret = kvm_arch_init_vcpu(env);
>>       if (ret == 0) {
>>           qemu_register_reset(kvm_reset_vcpu, env);
>> -        kvm_arch_reset_vcpu(env);
>>       }
>>   err:
>>       return ret;
>>
>>
>
> I'm testing uq/master, and I see this breaks it.  qemu freezes 
> immediately on startup.
>
> (might be due to a rebase?)
>

The symptoms, btw, are a vcpu started from 0:0 instead of 0xf000:0xfff0.

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


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

* Re: [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-06-23 12:33     ` Avi Kivity
@ 2010-06-23 13:19       ` Jan Kiszka
  2010-06-23 13:26         ` Avi Kivity
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Kiszka @ 2010-06-23 13:19 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

Avi Kivity wrote:
> On 06/23/2010 03:29 PM, Avi Kivity wrote:
>> On 03/23/2010 06:37 PM, Marcelo Tosatti wrote:
>>> This is now done via the initialization's qemu_system_reset call.
>>>
>>>
>>> Index: qemu-uq/kvm-all.c
>>> ===================================================================
>>> --- qemu-uq.orig/kvm-all.c
>>> +++ qemu-uq/kvm-all.c
>>> @@ -209,7 +209,6 @@ int kvm_init_vcpu(CPUState *env)
>>>       ret = kvm_arch_init_vcpu(env);
>>>       if (ret == 0) {
>>>           qemu_register_reset(kvm_reset_vcpu, env);
>>> -        kvm_arch_reset_vcpu(env);
>>>       }
>>>   err:
>>>       return ret;
>>>
>>>
>>
>> I'm testing uq/master, and I see this breaks it.  qemu freezes
>> immediately on startup.
>>
>> (might be due to a rebase?)
>>
> 
> The symptoms, btw, are a vcpu started from 0:0 instead of 0xf000:0xfff0.
> 

Might be unrelated, still: Does [1] make any difference? (Upsream is a
bit hairy ATM.)

Jan

[1] http://thread.gmane.org/gmane.comp.emulators.qemu/75087

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

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

* Re: [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-06-23 13:19       ` Jan Kiszka
@ 2010-06-23 13:26         ` Avi Kivity
  2010-06-23 13:29           ` Jan Kiszka
  0 siblings, 1 reply; 14+ messages in thread
From: Avi Kivity @ 2010-06-23 13:26 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Marcelo Tosatti, kvm

On 06/23/2010 04:19 PM, Jan Kiszka wrote:
>
>>> I'm testing uq/master, and I see this breaks it.  qemu freezes
>>> immediately on startup.
>>>
>>> (might be due to a rebase?)
>>>
>>>        
>> The symptoms, btw, are a vcpu started from 0:0 instead of 0xf000:0xfff0.
>>
>>      
> Might be unrelated, still: Does [1] make any difference?

No, and this is not surprising - looks like reset is completely bypassed.

>   (Upsream is a
> bit hairy ATM.)
>    

Well, it boots at least, which uq/master doesn't with this patch.

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


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

* Re: [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-06-23 13:26         ` Avi Kivity
@ 2010-06-23 13:29           ` Jan Kiszka
  2010-06-23 13:34             ` Avi Kivity
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Kiszka @ 2010-06-23 13:29 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

Avi Kivity wrote:
> On 06/23/2010 04:19 PM, Jan Kiszka wrote:
>>>> I'm testing uq/master, and I see this breaks it.  qemu freezes
>>>> immediately on startup.
>>>>
>>>> (might be due to a rebase?)
>>>>
>>>>        
>>> The symptoms, btw, are a vcpu started from 0:0 instead of 0xf000:0xfff0.
>>>
>>>      
>> Might be unrelated, still: Does [1] make any difference?
> 
> No, and this is not surprising - looks like reset is completely bypassed.

You mean there is no system reset during init in kvm mode? Well, then...

> 
>>   (Upsream is a
>> bit hairy ATM.)
>>    
> 
> Well, it boots at least, which uq/master doesn't with this patch.
> 

Also depends on the number of CPUs.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

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

* Re: [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu
  2010-06-23 13:29           ` Jan Kiszka
@ 2010-06-23 13:34             ` Avi Kivity
  0 siblings, 0 replies; 14+ messages in thread
From: Avi Kivity @ 2010-06-23 13:34 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Marcelo Tosatti, kvm

On 06/23/2010 04:29 PM, Jan Kiszka wrote:
>
>> No, and this is not surprising - looks like reset is completely bypassed.
>>      
> You mean there is no system reset during init in kvm mode? Well, then...
>    

Yes.  The cpu executes until it hits 0xa0000, then stops.

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


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

end of thread, other threads:[~2010-06-23 13:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
2010-03-23 16:37 ` [patch 1/6] target-i386: print EFER in cpu_dump_state Marcelo Tosatti
2010-03-23 16:37 ` [patch 2/6] kvm: handle internal error Marcelo Tosatti
2010-03-23 16:37 ` [patch 3/6] kvm: allow qemu to set EPT identity mapping address Marcelo Tosatti
2010-03-23 16:37 ` [patch 4/6] kvm_init_vcpu requires global lock held Marcelo Tosatti
2010-03-23 16:37 ` [patch 5/6] kvm: init mp_state Marcelo Tosatti
2010-03-23 16:37 ` [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu Marcelo Tosatti
2010-06-23 12:29   ` Avi Kivity
2010-06-23 12:33     ` Avi Kivity
2010-06-23 13:19       ` Jan Kiszka
2010-06-23 13:26         ` Avi Kivity
2010-06-23 13:29           ` Jan Kiszka
2010-06-23 13:34             ` Avi Kivity
2010-03-24 10:00 ` [patch 0/6] misc uq/master updates (v2) Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.