kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: yunhong jiang <yunhong.jiang@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, mtosatti@redhat.com, rkrcmar@redhat.com,
	kernellwp@gmail.com
Subject: Re: [RFC PATCH V2 4/4] Utilize the vmx preemption timer for tsc deadline timer
Date: Mon, 6 Jun 2016 11:21:03 -0700	[thread overview]
Message-ID: <20160606112103.17f2fc08@jnakajim-build> (raw)
In-Reply-To: <6c1c1467-5b5b-85e6-7c73-f1d884135871@redhat.com>

On Mon, 6 Jun 2016 15:49:12 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> 
> 
> On 04/06/2016 02:24, yunhong jiang wrote:
> >> > 2) if possible, I would like to remove kvm_lapic_arm_hv_timer.
> >> > Instead, make switch_to_hv_lapic_timer and start_apic_timer can
> >> > call kvm_x86_ops->set_hv_timer, passing the desired *guest* TSC.
> >> > set_hv_timer can convert the guest TSC to a host TSC and save the
> >> > desired host TSC in struct vmx_vcpu.  vcpu_run checks if there
> >> > is a
> > Hi, Paolo, I mostly finished my patch, but one thing come to my
> > mind in the last minutes and hope to get your input.
> > One issue to save the host TSC on the vmx_vcpu is, if the vCPU
> > thread is migrated to another pCPU, and the TSC are not
> > synchronized between these two pCPUs, then the result is not
> > accurate. In previous patchset, it's ok because we do the
> > calculation on the vcpu_run() thus the migration does not matter.
> 
> My suggestion here is to redo the vmx_set_hv_timer in vmx_vcpu_load.
> 
> It should fix the 32-bit overflow below, too.
> 
> Paolo

Aha, good point. Will do this way. And will remove the "RFC" on next patchset.

Thanks
--jyh

> 
> > This also bring a tricky situation considering the VMX preepmtion
> > timer can only hold 32bit value. In a rare situation, the host
> > delta TSC is less than 32 bit, however, if there is a host tsc
> > backwards after the migration, then the delta TSC on the new CPU
> > may be larger than 32 bit, but we can't switch back to sw timer
> > anymore because it's too late. I add some hacky code on the
> > kvm_arch_vcpu_load(), not sure if it's ok.
> > 
> > I will send a RFC patch. I'm still looking for a
> > platform with TSC scaling support, thus not test TSC scaling
> > yet. Others has been tested.
> > 


  reply	other threads:[~2016-06-06 18:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 22:27 [RFC PATCH V2 0/4] Utilizing VMX preemption for timer virtualization Yunhong Jiang
2016-05-24 22:27 ` [RFC PATCH V2 1/4] Add the kvm sched_out hook Yunhong Jiang
2016-05-24 22:27 ` [RFC PATCH V2 2/4] Utilize the vmx preemption timer Yunhong Jiang
2016-06-14 13:23   ` Roman Kagan
2016-06-14 13:41     ` Paolo Bonzini
2016-06-14 16:46       ` yunhong jiang
2016-06-14 21:56         ` Paolo Bonzini
2016-06-15 18:03           ` yunhong jiang
2016-06-14 16:46     ` yunhong jiang
2016-05-24 22:27 ` [RFC PATCH V2 3/4] Separate the start_sw_tscdeadline Yunhong Jiang
2016-05-24 22:27 ` [RFC PATCH V2 4/4] Utilize the vmx preemption timer for tsc deadline timer Yunhong Jiang
2016-05-24 23:11   ` David Matlack
2016-05-24 23:35     ` yunhong jiang
2016-05-25 11:58       ` Paolo Bonzini
2016-05-25 22:53         ` yunhong jiang
2016-05-26  7:20           ` Paolo Bonzini
2016-05-25 10:40     ` Paolo Bonzini
2016-05-25 13:38       ` Radim Krčmář
2016-05-25 11:52   ` Paolo Bonzini
2016-05-25 22:44     ` yunhong jiang
2016-05-26 14:05       ` Alan Jenkins
2016-05-26 15:32         ` Paolo Bonzini
2016-06-04  0:24     ` yunhong jiang
2016-06-06 13:49       ` Paolo Bonzini
2016-06-06 18:21         ` yunhong jiang [this message]
2016-05-25 13:27   ` Radim Krčmář
2016-05-25 13:51     ` Paolo Bonzini
2016-05-25 14:31       ` Radim Krčmář
2016-05-25 23:13         ` yunhong jiang
2016-06-14 11:34         ` Paolo Bonzini
2016-05-25 13:45   ` Radim Krčmář
2016-05-25 22:57     ` yunhong jiang

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=20160606112103.17f2fc08@jnakajim-build \
    --to=yunhong.jiang@linux.intel.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@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).