kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] Remove unused function.
@ 2009-09-13  8:30 Gleb Natapov
  2009-09-13  8:30 ` [PATCH 2/4] Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs() Gleb Natapov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Gleb Natapov @ 2009-09-13  8:30 UTC (permalink / raw)
  To: avi; +Cc: kvm

kvm_arch_update_regs_for_sipi() is not used anymore.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 qemu-kvm-ia64.c |    4 ----
 qemu-kvm-x86.c  |   10 ----------
 qemu-kvm.h      |    1 -
 3 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/qemu-kvm-ia64.c b/qemu-kvm-ia64.c
index 062fbd4..d26c2a9 100644
--- a/qemu-kvm-ia64.c
+++ b/qemu-kvm-ia64.c
@@ -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)
 {
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index f80d82b..ee678df 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -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);
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 11350f7..e79095d 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -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);
 
-- 
1.6.3.3


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

* [PATCH 2/4] Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs()
  2009-09-13  8:30 [PATCH 1/4] Remove unused function Gleb Natapov
@ 2009-09-13  8:30 ` Gleb Natapov
  2009-09-13  8:30 ` [PATCH 3/4] set correct CS seg limit and flags on sipi Gleb Natapov
  2009-09-13  8:30 ` [PATCH 4/4] Make cpu runnable after sipi Gleb Natapov
  2 siblings, 0 replies; 9+ messages in thread
From: Gleb Natapov @ 2009-09-13  8:30 UTC (permalink / raw)
  To: avi; +Cc: kvm


Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 qemu-kvm-x86.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index ee678df..6e5bcc5 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -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);
 }
-- 
1.6.3.3


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

* [PATCH 3/4] set correct CS seg limit and flags on sipi
  2009-09-13  8:30 [PATCH 1/4] Remove unused function Gleb Natapov
  2009-09-13  8:30 ` [PATCH 2/4] Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs() Gleb Natapov
@ 2009-09-13  8:30 ` Gleb Natapov
  2009-09-13  8:30 ` [PATCH 4/4] Make cpu runnable after sipi Gleb Natapov
  2 siblings, 0 replies; 9+ messages in thread
From: Gleb Natapov @ 2009-09-13  8:30 UTC (permalink / raw)
  To: avi; +Cc: kvm

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

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/apic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/apic.c b/hw/apic.c
index 68e5de3..11d4759 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -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;
 }
-- 
1.6.3.3


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

* [PATCH 4/4] Make cpu runnable after sipi
  2009-09-13  8:30 [PATCH 1/4] Remove unused function Gleb Natapov
  2009-09-13  8:30 ` [PATCH 2/4] Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs() Gleb Natapov
  2009-09-13  8:30 ` [PATCH 3/4] set correct CS seg limit and flags on sipi Gleb Natapov
@ 2009-09-13  8:30 ` Gleb Natapov
  2009-09-13 12:05   ` Avi Kivity
  2 siblings, 1 reply; 9+ messages in thread
From: Gleb Natapov @ 2009-09-13  8:30 UTC (permalink / raw)
  To: avi; +Cc: kvm


Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/apic.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/apic.c b/hw/apic.c
index 11d4759..ac5e7ba 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -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,
-- 
1.6.3.3


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

* Re: [PATCH 4/4] Make cpu runnable after sipi
  2009-09-13  8:30 ` [PATCH 4/4] Make cpu runnable after sipi Gleb Natapov
@ 2009-09-13 12:05   ` Avi Kivity
  2009-09-13 12:55     ` Gleb Natapov
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2009-09-13 12:05 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm

On 09/13/2009 11:30 AM, Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
> ---
>   hw/apic.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/hw/apic.c b/hw/apic.c
> index 11d4759..ac5e7ba 100644
> --- a/hw/apic.c
> +++ b/hw/apic.c
> @@ -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).

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


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

* Re: [PATCH 4/4] Make cpu runnable after sipi
  2009-09-13 12:05   ` Avi Kivity
@ 2009-09-13 12:55     ` Gleb Natapov
  2009-09-18 16:18       ` Marcelo Tosatti
  0 siblings, 1 reply; 9+ messages in thread
From: Gleb Natapov @ 2009-09-13 12:55 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On Sun, Sep 13, 2009 at 03:05:21PM +0300, Avi Kivity wrote:
> On 09/13/2009 11:30 AM, Gleb Natapov wrote:
> >Signed-off-by: Gleb Natapov<gleb@redhat.com>
> >---
> >  hw/apic.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> >diff --git a/hw/apic.c b/hw/apic.c
> >index 11d4759..ac5e7ba 100644
> >--- a/hw/apic.c
> >+++ b/hw/apic.c
> >@@ -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.

Signed-off-by: Gleb Natapov<gleb@redhat.com>
diff --git a/hw/apic.c b/hw/apic.c
index 11d4759..f9fef70 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -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.

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

* Re: [PATCH 4/4] Make cpu runnable after sipi
  2009-09-13 12:55     ` Gleb Natapov
@ 2009-09-18 16:18       ` Marcelo Tosatti
  2009-09-18 16:22         ` Gleb Natapov
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 16:18 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Avi Kivity, kvm

On Sun, Sep 13, 2009 at 03:55:21PM +0300, Gleb Natapov wrote:
> On Sun, Sep 13, 2009 at 03:05:21PM +0300, Avi Kivity wrote:
> > On 09/13/2009 11:30 AM, Gleb Natapov wrote:
> > >Signed-off-by: Gleb Natapov<gleb@redhat.com>
> > >---
> > >  hw/apic.c |    3 +++
> > >  1 files changed, 3 insertions(+), 0 deletions(-)
> > >
> > >diff --git a/hw/apic.c b/hw/apic.c
> > >index 11d4759..ac5e7ba 100644
> > >--- a/hw/apic.c
> > >+++ b/hw/apic.c
> > >@@ -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.
> 
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
> diff --git a/hw/apic.c b/hw/apic.c
> index 11d4759..f9fef70 100644
> --- a/hw/apic.c
> +++ b/hw/apic.c
> @@ -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.

> @@ -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
>  }


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

* Re: [PATCH 4/4] Make cpu runnable after sipi
  2009-09-18 16:18       ` Marcelo Tosatti
@ 2009-09-18 16:22         ` Gleb Natapov
  2009-09-18 16:23           ` Marcelo Tosatti
  0 siblings, 1 reply; 9+ messages in thread
From: Gleb Natapov @ 2009-09-18 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Avi Kivity, kvm

On Fri, Sep 18, 2009 at 01:18:18PM -0300, Marcelo Tosatti wrote:
> On Sun, Sep 13, 2009 at 03:55:21PM +0300, Gleb Natapov wrote:
> > On Sun, Sep 13, 2009 at 03:05:21PM +0300, Avi Kivity wrote:
> > > On 09/13/2009 11:30 AM, Gleb Natapov wrote:
> > > >Signed-off-by: Gleb Natapov<gleb@redhat.com>
> > > >---
> > > >  hw/apic.c |    3 +++
> > > >  1 files changed, 3 insertions(+), 0 deletions(-)
> > > >
> > > >diff --git a/hw/apic.c b/hw/apic.c
> > > >index 11d4759..ac5e7ba 100644
> > > >--- a/hw/apic.c
> > > >+++ b/hw/apic.c
> > > >@@ -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.
> > 
> > Signed-off-by: Gleb Natapov<gleb@redhat.com>
> > diff --git a/hw/apic.c b/hw/apic.c
> > index 11d4759..f9fef70 100644
> > --- a/hw/apic.c
> > +++ b/hw/apic.c
> > @@ -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.
> 
All callers already do cpu_synchronize_state(). I'll send another path.

> Applied the remaining patches too, thanks.
> 
> > @@ -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.

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

* Re: [PATCH 4/4] Make cpu runnable after sipi
  2009-09-18 16:22         ` Gleb Natapov
@ 2009-09-18 16:23           ` Marcelo Tosatti
  0 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2009-09-18 16:23 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Avi Kivity, kvm

On Fri, Sep 18, 2009 at 07:22:22PM +0300, Gleb Natapov wrote:
> On Fri, Sep 18, 2009 at 01:18:18PM -0300, Marcelo Tosatti wrote:
> > On Sun, Sep 13, 2009 at 03:55:21PM +0300, Gleb Natapov wrote:
> > > On Sun, Sep 13, 2009 at 03:05:21PM +0300, Avi Kivity wrote:
> > > > On 09/13/2009 11:30 AM, Gleb Natapov wrote:
> > > > >Signed-off-by: Gleb Natapov<gleb@redhat.com>
> > > > >---
> > > > >  hw/apic.c |    3 +++
> > > > >  1 files changed, 3 insertions(+), 0 deletions(-)
> > > > >
> > > > >diff --git a/hw/apic.c b/hw/apic.c
> > > > >index 11d4759..ac5e7ba 100644
> > > > >--- a/hw/apic.c
> > > > >+++ b/hw/apic.c
> > > > >@@ -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.
> > > 
> > > Signed-off-by: Gleb Natapov<gleb@redhat.com>
> > > diff --git a/hw/apic.c b/hw/apic.c
> > > index 11d4759..f9fef70 100644
> > > --- a/hw/apic.c
> > > +++ b/hw/apic.c
> > > @@ -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.
> > 
> All callers already do cpu_synchronize_state(). I'll send another path.

Send to qemu upstream please.

> 
> > Applied the remaining patches too, thanks.
> > 
> > > @@ -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.
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-09-18 16:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-13  8:30 [PATCH 1/4] Remove unused function Gleb Natapov
2009-09-13  8:30 ` [PATCH 2/4] Use kvm_cpu_synchronize_state() instead of kvm_arch_(save|load)_regs() Gleb Natapov
2009-09-13  8:30 ` [PATCH 3/4] set correct CS seg limit and flags on sipi Gleb Natapov
2009-09-13  8:30 ` [PATCH 4/4] Make cpu runnable after sipi Gleb Natapov
2009-09-13 12:05   ` Avi Kivity
2009-09-13 12:55     ` Gleb Natapov
2009-09-18 16:18       ` Marcelo Tosatti
2009-09-18 16:22         ` Gleb Natapov
2009-09-18 16:23           ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).