From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, Benjamin Serebrin <benjamin.serebrin@amd.com>
Subject: Re: [patch 3/3] KVM: VMX: initialize TSC offset relative to vm creation time
Date: Wed, 10 Dec 2008 12:19:28 +0200 [thread overview]
Message-ID: <493F97B0.2060104@redhat.com> (raw)
In-Reply-To: <20081209012212.171143870@localhost.localdomain>
Marcelo Tosatti wrote:
> VMX initializes the TSC offset for each vcpu at different times, and
> also reinitializes it for vcpus other than 0 on APIC SIPI message.
>
> This bug causes the TSC's to appear unsynchronized in the guest, even if
> the host is good.
>
> Older Linux kernels don't handle the situation very well, so
> gettimeofday is likely to go backwards in time:
>
> http://www.mail-archive.com/kvm@vger.kernel.org/msg02955.html
> http://sourceforge.net/tracker/index.php?func=detail&aid=2025534&group_id=180599&atid=893831
>
> Fix it by initializating the offset of each vcpu relative to vm creation
> time, and moving it from vmx_vcpu_reset to vmx_vcpu_setup, out of the
> APIC MP init path.
>
This looks fine, but have you tested it on a host with unsync tsc? I'm
worried that we'll get regressions there even on uniprocessor guest.
I'd like to keep the current behaviour for the special case of
uniprocessor guest on unsync tsc host.
There's a further improvement possible: treating the tsc as shared among
all vcpus, so that a guest write to one will update all of them, like on
a hyperthreaded core. This will prevent the unsyncing caused by the
host trying to sync tscs, and the vcpu being scheduled away at the same
time.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-12-10 10:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 1:12 [patch 0/3] synchronized TSC between vcpu's on SMP guests Marcelo Tosatti
2008-12-09 1:12 ` [patch 1/3] QEMU/KVM: x86: separate TSC load from kvm_arch_load_regs Marcelo Tosatti
2008-12-10 10:10 ` Avi Kivity
2008-12-09 1:12 ` [patch 2/3] QEMU/KVM: BIOS: revert TSC zeroing Marcelo Tosatti
2008-12-09 1:12 ` [patch 3/3] KVM: VMX: initialize TSC offset relative to vm creation time Marcelo Tosatti
2008-12-10 10:19 ` Avi Kivity [this message]
2008-12-10 16:53 ` Marcelo Tosatti
2008-12-11 17:38 ` Avi Kivity
2008-12-11 19:45 ` Marcelo Tosatti
2008-12-28 9:26 ` Avi Kivity
2008-12-09 11:38 ` [patch 0/3] synchronized TSC between vcpu's on SMP guests Michael Tokarev
2008-12-09 10:47 ` Marcelo Tosatti
2008-12-09 22:48 ` Michael Tokarev
2008-12-22 23:16 ` David S. Ahern
2008-12-28 9:33 ` Avi Kivity
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=493F97B0.2060104@redhat.com \
--to=avi@redhat.com \
--cc=benjamin.serebrin@amd.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;
as well as URLs for NNTP newsgroup(s).