kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: Zachary Amsden <zamsden@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>, Jan Kiszka <jan.kiszka@web.de>,
	Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc
Date: Tue, 19 Apr 2011 08:46:01 +0200	[thread overview]
Message-ID: <20110419064601.GM2192@amd.com> (raw)
In-Reply-To: <4DACD11B.4080200@redhat.com>

On Mon, Apr 18, 2011 at 08:02:35PM -0400, Zachary Amsden wrote:
> >
> > On Sat, Apr 16, 2011 at 06:09:17PM +0200, Jan Kiszka wrote:
> >    
> >> On 2011-03-25 09:44, Joerg Roedel wrote:
> >>      
> >    
> >>> +		tsc_delta = !vcpu->arch.last_guest_tsc ? 0 :
> >>> +			     tsc - vcpu->arch.last_guest_tsc;
> >>>        
> >    
> >> This patch appears to cause troubles to Linux guests on TSC clocksource
> >> and APIC highres timer. The first boot after qemu start is always fine,
> >> but after a reboot the guest timer appears to fire incorrectly or even
> >> not at all.
> >>
> >> Was this patch tested with a guest reboot scenario as well? Does it
> >> account for the TSC being reset to 0 on reboot?
> >>      
> > Hmm, probably the last_guest_tsc is not updated correctly in this
> > scenario. I will have a look tomorrow.
> >
> > 	Joerg
> >
> >    
> 
> To avoid this problem, when the TSC is reset, the overshoot protection 
> where last_guest_tsc is used is specifically disabled:
> 
>          /* Reset of TSC must disable overshoot protection below */
>          vcpu->arch.hv_clock.tsc_timestamp = 0;
>          vcpu->arch.last_tsc_write = data;
>          vcpu->arch.last_tsc_nsec = ns;
> 
> You can probably use the same test - last_guest_tsc is only valid if 
> tsc_timestamp above != 0.

Yes, this should also work. But the other way we get rid of
last_host_tsc which is also a good thing :)

	Joerg

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


  reply	other threads:[~2011-04-19  6:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25  8:44 [PATCH 0/6] TSC scaling support for KVM v3 Joerg Roedel
2011-03-25  8:44 ` [PATCH 1/6] KVM: SVM: Implement infrastructure for TSC_RATE_MSR Joerg Roedel
2011-03-25  8:44 ` [PATCH 2/6] KVM: X86: Let kvm-clock report the right tsc frequency Joerg Roedel
2011-03-25  8:44 ` [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Joerg Roedel
2011-03-27 10:57   ` Avi Kivity
2011-03-27 11:10     ` Joerg Roedel
2011-04-16 16:09   ` Jan Kiszka
2011-04-17 12:06     ` Joerg Roedel
2011-04-19  0:02       ` Zachary Amsden
2011-04-19  6:46         ` Roedel, Joerg [this message]
2011-04-19  6:49           ` Jan Kiszka
2011-04-19 14:15             ` Zachary Amsden
2011-04-19 14:24               ` Jan Kiszka
2011-04-18  8:03     ` Roedel, Joerg
2011-04-18  9:12       ` Jan Kiszka
2011-04-18  9:25         ` Joerg Roedel
2011-03-25  8:44 ` [PATCH 4/6] KVM: X86: Implement call-back to propagate virtual_tsc_khz Joerg Roedel
2011-03-25  8:44 ` [PATCH 5/6] KVM: X86: Delegate tsc-offset calculation to architecture code Joerg Roedel
2011-03-25  8:44 ` [PATCH 6/6] KVM: X86: Implement userspace interface to set virtual_tsc_khz Joerg Roedel
2011-03-27 10:58 ` [PATCH 0/6] TSC scaling support for KVM v3 Avi Kivity
2011-04-06  7:33 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2011-03-24  7:40 [PATCH 0/6][RESEND] TSC scaling support for KVM v2 Joerg Roedel
2011-03-24  7:40 ` [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Joerg Roedel
2011-03-15  9:36 [PATCH 0/6] TSC scaling support for KVM v2 Joerg Roedel
2011-03-15  9:36 ` [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Joerg Roedel

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=20110419064601.GM2192@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=zamsden@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).