public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] qemu-kvm: x86: Fix mismerge in cpu_post_load
Date: Sun, 6 Dec 2009 12:49:18 +0200	[thread overview]
Message-ID: <20091206104918.GK20102@redhat.com> (raw)
In-Reply-To: <4B1B8B18.7020803@web.de>

On Sun, Dec 06, 2009 at 11:44:40AM +0100, Jan Kiszka wrote:
> Gleb Natapov wrote:
> > On Thu, Dec 03, 2009 at 07:21:01PM +0100, Jan Kiszka wrote:
> >> Merge 8e2c5ec2f6 forgot to restore some qemu-kvm-specific hooks in
> >> cpu_post_load. mp_state was readded later on, but tsc was missing,
> >> breaking the guest timing after resume. Also, reset of halt was dropped
> >> which is obviously required for in-kernel irqchip.
> >>
> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >> ---
> >>
> >> This solves "Problem 1" on my list.
> >>
> >> BTW, this patch just made me realize that the TSC MSR belongs to the
> >> list states that should not be written back unconditionally. Upstream
> >> does this currently, qemu-kvm not (at the price one more kvm-specific
> >> hook into generic code). Unlike the other states we discussed, this one
> >> is not "fixable" in the kernel. So I tend to think there is a real need
> >> for my write-back scope abstraction - which would also be able to handle
> >> the other states cleanly, both in upstream and here.
> >>
> >>  target-i386/machine.c |   10 +++++++++-
> >>  1 files changed, 9 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/target-i386/machine.c b/target-i386/machine.c
> >> index 6bd447f..9ac477b 100644
> >> --- a/target-i386/machine.c
> >> +++ b/target-i386/machine.c
> >> @@ -366,7 +366,15 @@ static int cpu_post_load(void *opaque, int version_id)
> >>          hw_breakpoint_insert(env, i);
> >>  
> >>      tlb_flush(env, 1);
> >> -    kvm_load_mpstate(env);
> >> +
> >> +    if (kvm_enabled()) {
> >> +        /* when in-kernel irqchip is used, env->halted causes deadlock
> >> +           because no userspace IRQs will ever clear this flag */
> >> +        env->halted = 0;
> >> +
> > That is strange. env->halted should be used only for "info cpus" output
> > in case of in-kernel irqchip. Can you see where it hangs?
> 
> This line was not directly involved in the regression I saw, it was just
> the next one (load_tsc). But I simply restored qemu-kvm to the state
> before the vmstate conversion merge, dropping only obviously unneeded
> bits (namely the full register write-back).
> 
> The above line may no longer be required, but I wanted to play safe. If
> you can explain which qemu-kvm change made this obsolete, please file a
> removal patch!
> 
Ah, OK then. There was no particular patch that made in kernel irqchip
to not use env->halted. AFAIR it was always this way.

> > 
> >> +        kvm_load_tsc(env);
> >> +        kvm_load_mpstate(env);
> >> +    }
> >>  
> >>      return 0;
> >>  }
> > 
> > --
> > 			Gleb.
> 
> Jan
> 



--
			Gleb.

      reply	other threads:[~2009-12-06 10:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 18:21 [PATCH] qemu-kvm: x86: Fix mismerge in cpu_post_load Jan Kiszka
2009-12-06  9:54 ` Avi Kivity
2009-12-06 10:39   ` Jan Kiszka
2009-12-06 10:41     ` Avi Kivity
2009-12-06 10:56     ` Gleb Natapov
2009-12-06 10:33 ` Gleb Natapov
2009-12-06 10:44   ` Jan Kiszka
2009-12-06 10:49     ` Gleb Natapov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091206104918.GK20102@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox