From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] fix "info cpus" halted state display Date: Sun, 16 May 2010 08:35:51 +0300 Message-ID: <20100516053551.GA2962@redhat.com> References: <20100513131714.GC7757@redhat.com> <4BEC0531.5090604@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:63622 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751044Ab0EPFfy (ORCPT ); Sun, 16 May 2010 01:35:54 -0400 Content-Disposition: inline In-Reply-To: <4BEC0531.5090604@web.de> Sender: kvm-owner@vger.kernel.org List-ID: 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 > > 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.