kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix "info cpus" halted state display
@ 2010-05-13 13:17 Gleb Natapov
  2010-05-13 13:57 ` Jan Kiszka
  2010-05-20 10:16 ` Gleb Natapov
  0 siblings, 2 replies; 5+ messages in thread
From: Gleb Natapov @ 2010-05-13 13:17 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm

When in-kernel irqchip is used env->halted is never used for anything
except "info cpus" command. Halted state is synced in
kvm_arch_save_mpstate() and showed by do_info_cpus() but otherwise never
looked at. Zeroing it here breaks "info cpus" since before
do_info_cpus() outputs env->halted in io thread it is zeroed here when
vcpu thread reenters kernel.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 61d9331..0ec2881 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -922,10 +922,6 @@ void kvm_arch_load_regs(CPUState *env, int level)
         if (env->kvm_vcpu_update_vapic)
             kvm_tpr_enable_vapic(env);
     }
-    if (kvm_irqchip_in_kernel()) {
-        /* Avoid deadlock: no user space IRQ will ever clear it. */
-        env->halted = 0;
-    }
 
     kvm_put_vcpu_events(env, level);
     kvm_put_debugregs(env);
--
			Gleb.

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

* Re: [PATCH] fix "info cpus" halted state display
  2010-05-13 13:17 [PATCH] fix "info cpus" halted state display Gleb Natapov
@ 2010-05-13 13:57 ` Jan Kiszka
  2010-05-16  5:35   ` Gleb Natapov
  2010-05-20 10:16 ` Gleb Natapov
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2010-05-13 13:57 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: avi, mtosatti, kvm

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

Gleb Natapov wrote:
> When in-kernel irqchip is used env->halted is never used for anything
> except "info cpus" command.

In fact, it's used in a few more places, namely cpu_dump_state and the
gdbstub.

> Halted state is synced in
> kvm_arch_save_mpstate() and showed by do_info_cpus() but otherwise never
> looked at. Zeroing it here breaks "info cpus" since before
> do_info_cpus() outputs env->halted in io thread it is zeroed here when
> vcpu thread reenters kernel.

Looks good for current qemu-kvm.

Execution of kvm_cpu_exec once depended on env->halted, even for
in-kernel irqchip, right? Anyway, there are not such traces left here.
We will just need to look at it again when pushing in-kernel irqchips
upstream as its kvm loop looks different.

Jan

> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
> index 61d9331..0ec2881 100644
> --- a/qemu-kvm-x86.c
> +++ b/qemu-kvm-x86.c
> @@ -922,10 +922,6 @@ void kvm_arch_load_regs(CPUState *env, int level)
>          if (env->kvm_vcpu_update_vapic)
>              kvm_tpr_enable_vapic(env);
>      }
> -    if (kvm_irqchip_in_kernel()) {
> -        /* Avoid deadlock: no user space IRQ will ever clear it. */
> -        env->halted = 0;
> -    }
>  
>      kvm_put_vcpu_events(env, level);
>      kvm_put_debugregs(env);
> --
> 			Gleb.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* Re: [PATCH] fix "info cpus" halted state display
  2010-05-13 13:57 ` Jan Kiszka
@ 2010-05-16  5:35   ` Gleb Natapov
  0 siblings, 0 replies; 5+ messages in thread
From: Gleb Natapov @ 2010-05-16  5:35 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: avi, mtosatti, kvm

On Thu, May 13, 2010 at 03:57:05PM +0200, Jan Kiszka wrote:
> Gleb Natapov wrote:
> > When in-kernel irqchip is used env->halted is never used for anything
> > except "info cpus" command.
> 
> In fact, it's used in a few more places, namely cpu_dump_state and the
> gdbstub.
> 
Both of those places use env->halted the same way "info cpus" does:
print out cpu state. And the both call for cpu_synchronize_state()
before using env->halted.

> > Halted state is synced in
> > kvm_arch_save_mpstate() and showed by do_info_cpus() but otherwise never
> > looked at. Zeroing it here breaks "info cpus" since before
> > do_info_cpus() outputs env->halted in io thread it is zeroed here when
> > vcpu thread reenters kernel.
> 
> Looks good for current qemu-kvm.
> 
> Execution of kvm_cpu_exec once depended on env->halted, even for
> in-kernel irqchip, right?
Never in qemu-kvm AFAIR. May be at some point during merge between
upstream qemu and qemu-kvm such bug was introduced,

>                            Anyway, there are not such traces left here.
> We will just need to look at it again when pushing in-kernel irqchips
> upstream as its kvm loop looks different.
> 
> Jan
> 
> > 
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
> > index 61d9331..0ec2881 100644
> > --- a/qemu-kvm-x86.c
> > +++ b/qemu-kvm-x86.c
> > @@ -922,10 +922,6 @@ void kvm_arch_load_regs(CPUState *env, int level)
> >          if (env->kvm_vcpu_update_vapic)
> >              kvm_tpr_enable_vapic(env);
> >      }
> > -    if (kvm_irqchip_in_kernel()) {
> > -        /* Avoid deadlock: no user space IRQ will ever clear it. */
> > -        env->halted = 0;
> > -    }
> >  
> >      kvm_put_vcpu_events(env, level);
> >      kvm_put_debugregs(env);
> > --
> > 			Gleb.
> 
> 



--
			Gleb.

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

* Re: [PATCH] fix "info cpus" halted state display
  2010-05-13 13:17 [PATCH] fix "info cpus" halted state display Gleb Natapov
  2010-05-13 13:57 ` Jan Kiszka
@ 2010-05-20 10:16 ` Gleb Natapov
  2010-05-23 11:26   ` Avi Kivity
  1 sibling, 1 reply; 5+ messages in thread
From: Gleb Natapov @ 2010-05-20 10:16 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm

On Thu, May 13, 2010 at 04:17:14PM +0300, Gleb Natapov wrote:
> When in-kernel irqchip is used env->halted is never used for anything
> except "info cpus" command. Halted state is synced in
> kvm_arch_save_mpstate() and showed by do_info_cpus() but otherwise never
> looked at. Zeroing it here breaks "info cpus" since before
> do_info_cpus() outputs env->halted in io thread it is zeroed here when
> vcpu thread reenters kernel.
> 
Avi, what about this patch?

> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
> index 61d9331..0ec2881 100644
> --- a/qemu-kvm-x86.c
> +++ b/qemu-kvm-x86.c
> @@ -922,10 +922,6 @@ void kvm_arch_load_regs(CPUState *env, int level)
>          if (env->kvm_vcpu_update_vapic)
>              kvm_tpr_enable_vapic(env);
>      }
> -    if (kvm_irqchip_in_kernel()) {
> -        /* Avoid deadlock: no user space IRQ will ever clear it. */
> -        env->halted = 0;
> -    }
>  
>      kvm_put_vcpu_events(env, level);
>      kvm_put_debugregs(env);
> --
> 			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

--
			Gleb.

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

* Re: [PATCH] fix "info cpus" halted state display
  2010-05-20 10:16 ` Gleb Natapov
@ 2010-05-23 11:26   ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2010-05-23 11:26 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: mtosatti, kvm

On 05/20/2010 01:16 PM, Gleb Natapov wrote:
> On Thu, May 13, 2010 at 04:17:14PM +0300, Gleb Natapov wrote:
>    
>> When in-kernel irqchip is used env->halted is never used for anything
>> except "info cpus" command. Halted state is synced in
>> kvm_arch_save_mpstate() and showed by do_info_cpus() but otherwise never
>> looked at. Zeroing it here breaks "info cpus" since before
>> do_info_cpus() outputs env->halted in io thread it is zeroed here when
>> vcpu thread reenters kernel.
>>
>>      
> Avi, what about this patch?
>
>    

Sorry, missed.  Applied now.

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


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

end of thread, other threads:[~2010-05-23 11:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 13:17 [PATCH] fix "info cpus" halted state display Gleb Natapov
2010-05-13 13:57 ` Jan Kiszka
2010-05-16  5:35   ` Gleb Natapov
2010-05-20 10:16 ` Gleb Natapov
2010-05-23 11:26   ` Avi Kivity

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).