From: Glauber Costa <glommer@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, Avi Kivity <avi@redhat.com>,
Glauber de Oliveira Costa <gcosta@redhat.com>,
kvm <kvm@vger.kernel.org>
Subject: Re: qemu-kvm requires apic initialized before vcpu main loop
Date: Thu, 10 Dec 2009 09:06:19 -0200 [thread overview]
Message-ID: <20091210110619.GP30411@mothafucka.localdomain> (raw)
In-Reply-To: <20091209202138.GD28264@amt.cnet>
On Wed, Dec 09, 2009 at 06:21:38PM -0200, Marcelo Tosatti wrote:
> On Wed, Dec 09, 2009 at 08:00:41PM +0100, Jan Kiszka wrote:
> > Glauber Costa wrote:
> > > On Wed, Dec 09, 2009 at 03:46:54PM -0200, Marcelo Tosatti wrote:
> > >> Otherwise a zero apic base is loaded into KVM, which results
> > >> in interrupts being lost until a proper apic base with enabled
> > >> bit set is loaded.
> > >>
> > >> Fixes WinXP migration in qemu-kvm origin/next.
> > >>
> > >> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> > >>
> > >> diff --git a/hw/apic.c b/hw/apic.c
> > >> index 627ff98..45a4d2b 100644
> > >> --- a/hw/apic.c
> > >> +++ b/hw/apic.c
> > >> @@ -1131,6 +1131,11 @@ int apic_init(CPUState *env)
> > >> vmstate_register(s->idx, &vmstate_apic, s);
> > >> qemu_register_reset(apic_reset, s);
> > >>
> > >> + /* apic_reset must be called before the vcpu threads are initialized and load
> > >> + * registers, in qemu-kvm.
> > >> + */
> > >> + apic_reset(s);
> > >> +
> > > But by doing this, the system-wide reset will re-reset the apic, possibly losing
> > > some other information.
> > >
> > > Also, system_reset happens before we signal system_ready (or at least should).
> > > This means the vcpus should not be running and producing anything useful yet.
> > > So how does it happen, in the first place?
> >
> > There is
> >
> > kvm_arch_load_regs(env);
> >
> > before qemu_cond_wait in ap_main_loop. Probably part of the reason. Why
> > is it there?
>
> Hum ... see how qemu_kvm_load_lapic depends on kvm_vcpu_inited.
>
> kvm_vcpu_ioctl_set_lapic -> kvm_apic_post_state_restore relies on
> proper apicbase set (maybe other reasons too).
Have you tried getting rid of kvm_vcpu_inited()? Now that we are doing reset after vcpu creation,
it is quite possible that it won't be needed anymore.
Btw, the whole point of this exercise is to try diminishing oportunities
for nasty things like that.
next prev parent reply other threads:[~2009-12-10 11:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-09 17:46 qemu-kvm requires apic initialized before vcpu main loop Marcelo Tosatti
2009-12-09 18:23 ` Jan Kiszka
2009-12-09 19:23 ` Gleb Natapov
2009-12-09 20:09 ` Jan Kiszka
2009-12-09 20:13 ` Marcelo Tosatti
2009-12-09 20:21 ` Jan Kiszka
2009-12-09 20:50 ` Gleb Natapov
2009-12-09 21:01 ` Jan Kiszka
2009-12-10 6:36 ` Gleb Natapov
2009-12-10 8:12 ` Jan Kiszka
2009-12-09 20:02 ` Marcelo Tosatti
2009-12-09 20:22 ` Marcelo Tosatti
2009-12-09 18:25 ` Glauber Costa
2009-12-09 19:00 ` Jan Kiszka
2009-12-09 20:21 ` Marcelo Tosatti
2009-12-10 11:06 ` Glauber Costa [this message]
2009-12-09 20:09 ` Marcelo Tosatti
2009-12-09 19:20 ` Gleb Natapov
2009-12-09 20:26 ` Marcelo Tosatti
2009-12-10 9:33 ` Avi Kivity
2009-12-10 9:45 ` Avi Kivity
2009-12-14 20:36 ` [PATCH] qemu-kvm initialize vcpu state after machine initialization Marcelo Tosatti
2009-12-15 10:16 ` Avi Kivity
2009-12-15 11:20 ` Gleb Natapov
2009-12-15 12:24 ` Marcelo Tosatti
2009-12-15 12:31 ` Avi Kivity
2009-12-15 12:51 ` Marcelo Tosatti
2009-12-15 12:33 ` Gleb Natapov
2009-12-16 14:12 ` Marcelo Tosatti
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=20091210110619.GP30411@mothafucka.localdomain \
--to=glommer@redhat.com \
--cc=avi@redhat.com \
--cc=gcosta@redhat.com \
--cc=jan.kiszka@siemens.com \
--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