Skip to contentSkip to conversation

Remove unused function.

PATCH In review Gleb Natapov 3 participants 9 messages Sep 13, 2009 – Sep 18, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 Remove unused function.

kvm_arch_update_regs_for_sipi() is not used anymore.

---
 qemu-kvm-ia64.c |    4 ----
 qemu-kvm-x86.c  |   10 ----------
 qemu-kvm.h      |    1 -
 3 files changed, 0 insertions(+), 15 deletions(-)
qemu-kvm-ia64.c +0 -4
index 062fbd4..d26c2a9 100644
@@ -55,10 +55,6 @@ int kvm_arch_try_push_interrupts(void *opaque)
     return 1;
 }
 
-void kvm_arch_update_regs_for_sipi(CPUState *env)
-{
-}
-
 int kvm_arch_insert_sw_breakpoint(CPUState *current_env,
                                   struct kvm_sw_breakpoint *bp)
 {
qemu-kvm-x86.c +0 -10
index f80d82b..ee678df 100644
@@ -1436,16 +1436,6 @@ void kvm_arch_push_nmi(void *opaque)
 }
 #endif /* KVM_CAP_USER_NMI */
 
-void kvm_arch_update_regs_for_sipi(CPUState *env)
-{
-    SegmentCache cs = env->segs[R_CS];
-
-    kvm_arch_save_regs(env);
-    env->segs[R_CS] = cs;
-    env->eip = 0;
-    kvm_arch_load_regs(env);
-}
-
 void kvm_arch_cpu_reset(CPUState *env)
 {
     kvm_arch_load_regs(env);
qemu-kvm.h +0 -1
index 11350f7..e79095d 100644
@@ -1010,7 +1010,6 @@ int kvm_arch_has_work(CPUState *env);
 void kvm_arch_process_irqchip_events(CPUState *env);
 int kvm_arch_try_push_interrupts(void *opaque);
 void kvm_arch_push_nmi(void *opaque);
-void kvm_arch_update_regs_for_sipi(CPUState *env);
 void kvm_arch_cpu_reset(CPUState *env);
 int kvm_set_boot_cpu_id(uint32_t id);
 
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 2/4 Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs()

---
 qemu-kvm-x86.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
qemu-kvm-x86.c +1 -2
index ee678df..6e5bcc5 100644
@@ -1671,10 +1671,9 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
 
 void kvm_arch_process_irqchip_events(CPUState *env)
 {
-    kvm_arch_save_regs(env);
+    kvm_cpu_synchronize_state(env);
     if (env->interrupt_request & CPU_INTERRUPT_INIT)
         do_cpu_init(env);
     if (env->interrupt_request & CPU_INTERRUPT_SIPI)
         do_cpu_sipi(env);
-    kvm_arch_load_regs(env);
 }
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 3/4 set correct CS seg limit and flags on sipi

In reply to Gleb Natapov

This one was sent to qemu upstream. Include it here because next patch needs it.

---
 hw/apic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/apic.c +1 -1
index 68e5de3..11d4759 100644
@@ -531,7 +531,7 @@ void apic_sipi(CPUState *env)
 
     env->eip = 0;
     cpu_x86_load_seg_cache(env, R_CS, s->sipi_vector << 8, s->sipi_vector << 12,
-                           0xffff, 0);
+                           env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
 }
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 4/4 Make cpu runnable after sipi

In reply to Gleb Natapov
---
 hw/apic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/apic.c +3 -0
index 11d4759..ac5e7ba 100644
@@ -534,6 +534,9 @@ void apic_sipi(CPUState *env)
                            env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
+#ifdef KVM_CAP_MP_STATE
+    env->mp_state = KVM_MP_STATE_RUNNABLE;
+#endif
 }
 
 static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
Signature · 1 line
1.6.3.3
#4 lore raw

Re: [PATCH 4/4] Make cpu runnable after sipi

Quoted 10 lines · Gleb Natapov
---
  hw/apic.c |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
hw/apic.c +0 -0
index 11d4759..ac5e7ba 100644

hw/apic.c void apic_sipi(CPUState *env) · line 541

Quoted 8 lines
hw/apic.c +3 -0
@@ -534,6 +534,9 @@ void apic_sipi(CPUState *env)
                             env->segs[R_CS].limit, env->segs[R_CS].flags);
      env->halted = 0;
      s->wait_for_sipi = 0;
+#ifdef KVM_CAP_MP_STATE
+    env->mp_state = KVM_MP_STATE_RUNNABLE;
+#endif
  }
 

-no-kvm-irqchip shouldn't use mp_state at all (since really old kernels don't have this ioctl).

Signature · 1 line
error compiling committee.c: too many arguments to function
#5 lore raw

Re: [PATCH 4/4] Make cpu runnable after sipi

Quoted 6 lines · Avi Kivity
Quoted 5 lines · Gleb Natapov
---
 hw/apic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 16 lines

hw/apic.c void apic_sipi(CPUState *env) · line 540

Quoted 12 lines
hw/apic.c +3 -0
index 11d4759..ac5e7ba 100644
@@ -534,6 +534,9 @@ void apic_sipi(CPUState *env)
                            env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
+#ifdef KVM_CAP_MP_STATE
+    env->mp_state = KVM_MP_STATE_RUNNABLE;
+#endif
 }

-no-kvm-irqchip shouldn't use mp_state at all (since really old kernels don't have this ioctl).

Correct. Use patch below instead. mp_state shouldn't be touched if irq chip is in userspace. I removed pu_synchronize_state() since it is done before apic_init_reset() is called.

hw/apic.c +3 -3
index 11d4759..f9fef70 100644
@@ -488,7 +488,6 @@ void apic_init_reset(CPUState *env)
     if (!s)
         return;
 
-    cpu_synchronize_state(env);
     s->tpr = 0;
     s->spurious_vec = 0xff;
     s->log_dest = 0;
@@ -509,8 +508,9 @@ void apic_init_reset(CPUState *env)
 
     env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP);
 #ifdef KVM_CAP_MP_STATE
-    env->mp_state
-        = env->halted ? KVM_MP_STATE_INIT_RECEIVED : KVM_MP_STATE_RUNNABLE;
+    if (kvm_irqchip_in_kernel(kvm_context))
+        env->mp_state
+            = env->halted ? KVM_MP_STATE_UNINITIALIZED : KVM_MP_STATE_RUNNABLE;
 #endif
 }
 

--
Gleb.

#6 lore raw

Re: [PATCH 4/4] Make cpu runnable after sipi

Quoted 33 lines · Gleb Natapov
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Gleb Natapov
---
 hw/apic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 16 lines

hw/apic.c void apic_sipi(CPUState *env) · line 540

Quoted 12 lines
hw/apic.c +3 -0
index 11d4759..ac5e7ba 100644
@@ -534,6 +534,9 @@ void apic_sipi(CPUState *env)
                            env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
+#ifdef KVM_CAP_MP_STATE
+    env->mp_state = KVM_MP_STATE_RUNNABLE;
+#endif
 }

-no-kvm-irqchip shouldn't use mp_state at all (since really old kernels don't have this ioctl).

Correct. Use patch below instead. mp_state shouldn't be touched if irq chip is in userspace. I removed pu_synchronize_state() since it is done before apic_init_reset() is called.

hw/apic.c +0 -0
index 11d4759..f9fef70 100644

hw/apic.c void apic_init_reset(CPUState *env) · line 493

Quoted 7 lines
hw/apic.c +0 -1
@@ -488,7 +488,6 @@ void apic_init_reset(CPUState *env)
     if (!s)
         return;
 
-    cpu_synchronize_state(env);
     s->tpr = 0;
     s->spurious_vec = 0xff;
     s->log_dest = 0;

Gleb,

I've dropped this cleanup hunk. Please send it separately if you like.

Applied the remaining patches too, thanks.

Quoted 11 lines
hw/apic.c +3 -2
@@ -509,8 +508,9 @@ void apic_init_reset(CPUState *env)
 
     env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP);
 #ifdef KVM_CAP_MP_STATE
-    env->mp_state
-        = env->halted ? KVM_MP_STATE_INIT_RECEIVED : KVM_MP_STATE_RUNNABLE;
+    if (kvm_irqchip_in_kernel(kvm_context))
+        env->mp_state
+            = env->halted ? KVM_MP_STATE_UNINITIALIZED : KVM_MP_STATE_RUNNABLE;
 #endif
 }
#7 lore raw

Re: [PATCH 4/4] Make cpu runnable after sipi

Quoted 37 lines · Marcelo Tosatti
Quoted 36 lines · Gleb Natapov
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Gleb Natapov
---
 hw/apic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 16 lines

hw/apic.c void apic_sipi(CPUState *env) · line 540

Quoted 12 lines
hw/apic.c +3 -0
index 11d4759..ac5e7ba 100644
@@ -534,6 +534,9 @@ void apic_sipi(CPUState *env)
                            env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
+#ifdef KVM_CAP_MP_STATE
+    env->mp_state = KVM_MP_STATE_RUNNABLE;
+#endif
 }

-no-kvm-irqchip shouldn't use mp_state at all (since really old kernels don't have this ioctl).

Correct. Use patch below instead. mp_state shouldn't be touched if irq chip is in userspace. I removed pu_synchronize_state() since it is done before apic_init_reset() is called.

hw/apic.c +0 -0
index 11d4759..f9fef70 100644
@@ -488,7 +488,6 @@ void apic_init_reset(CPUState *env)
     if (!s)
         return;
 
Quoted 9 lines

hw/apic.c void apic_init_reset(CPUState *env) · line 493

Quoted 4 lines
hw/apic.c +0 -1
-    cpu_synchronize_state(env);
     s->tpr = 0;
     s->spurious_vec = 0xff;
     s->log_dest = 0;

Gleb,

I've dropped this cleanup hunk. Please send it separately if you like.

All callers already do cpu_synchronize_state(). I'll send another path.

Quoted 4 lines

Applied the remaining patches too, thanks.

Quoted 2 lines
hw/apic.c +0 -0
@@ -509,8 +508,9 @@ void apic_init_reset(CPUState *env)
 
Quoted 9 lines

hw/apic.c void apic_init_reset(CPUState *env) · line 515

Quoted 9 lines
hw/apic.c +3 -2
     env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP);
 #ifdef KVM_CAP_MP_STATE
-    env->mp_state
-        = env->halted ? KVM_MP_STATE_INIT_RECEIVED : KVM_MP_STATE_RUNNABLE;
+    if (kvm_irqchip_in_kernel(kvm_context))
+        env->mp_state
+            = env->halted ? KVM_MP_STATE_UNINITIALIZED : KVM_MP_STATE_RUNNABLE;
 #endif
 }

--
Gleb.

#8 lore raw

Re: [PATCH 4/4] Make cpu runnable after sipi

Quoted 45 lines · Gleb Natapov
Quoted 44 lines · Marcelo Tosatti
Quoted 33 lines · Gleb Natapov
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Gleb Natapov
---
 hw/apic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 16 lines

hw/apic.c void apic_sipi(CPUState *env) · line 540

Quoted 12 lines
hw/apic.c +3 -0
index 11d4759..ac5e7ba 100644
@@ -534,6 +534,9 @@ void apic_sipi(CPUState *env)
                            env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
+#ifdef KVM_CAP_MP_STATE
+    env->mp_state = KVM_MP_STATE_RUNNABLE;
+#endif
 }

-no-kvm-irqchip shouldn't use mp_state at all (since really old kernels don't have this ioctl).

Correct. Use patch below instead. mp_state shouldn't be touched if irq chip is in userspace. I removed pu_synchronize_state() since it is done before apic_init_reset() is called.

hw/apic.c +0 -0
index 11d4759..f9fef70 100644

hw/apic.c void apic_init_reset(CPUState *env) · line 493

Quoted 7 lines
hw/apic.c +0 -1
@@ -488,7 +488,6 @@ void apic_init_reset(CPUState *env)
     if (!s)
         return;
 
-    cpu_synchronize_state(env);
     s->tpr = 0;
     s->spurious_vec = 0xff;
     s->log_dest = 0;

Gleb,

Quoted 3 lines
Quoted 2 lines

I've dropped this cleanup hunk. Please send it separately if you like.

All callers already do cpu_synchronize_state(). I'll send another path.

Send to qemu upstream please.

Quoted 21 lines
Quoted 5 lines

Applied the remaining patches too, thanks.

Quoted 2 lines
hw/apic.c +0 -0
@@ -509,8 +508,9 @@ void apic_init_reset(CPUState *env)
 
Quoted 9 lines

hw/apic.c void apic_init_reset(CPUState *env) · line 515

Quoted 9 lines
hw/apic.c +3 -2
     env->halted = !(s->apicbase & MSR_IA32_APICBASE_BSP);
 #ifdef KVM_CAP_MP_STATE
-    env->mp_state
-        = env->halted ? KVM_MP_STATE_INIT_RECEIVED : KVM_MP_STATE_RUNNABLE;
+    if (kvm_irqchip_in_kernel(kvm_context))
+        env->mp_state
+            = env->halted ? KVM_MP_STATE_UNINITIALIZED : KVM_MP_STATE_RUNNABLE;
 #endif
 }

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html