All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>
Cc: Avi Kivity <avi@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Tian, Kevin" <kevin.tian@intel.com>
Subject: Re: [PATCH 1/2] KVM: emulate lapic tsc deadline timer for guest
Date: Thu, 15 Sep 2011 08:45:31 -0300	[thread overview]
Message-ID: <20110915114531.GA5817@amt.cnet> (raw)
In-Reply-To: <BC00F5384FCFC9499AF06F92E8B78A9E25448A9E6B@shsmsx502.ccr.corp.intel.com>

On Thu, Sep 15, 2011 at 04:17:20PM +0800, Liu, Jinsong wrote:
> Marcelo Tosatti wrote:
> >> +	} else if (apic_lvtt_tscdeadline(apic)) {
> >> +		/* lapic timer in tsc deadline mode */
> >> +		u64 guest_tsc, guest_tsc_delta, ns = 0;
> >> +		struct kvm_vcpu *vcpu = apic->vcpu;
> >> +		unsigned long this_tsc_khz = vcpu_tsc_khz(vcpu); +		unsigned long
> >> flags; +
> >> +		if (unlikely(!apic->lapic_timer.tscdeadline || !this_tsc_khz))
> >> +			return; +
> >> +		local_irq_save(flags);
> >> +
> >> +		now = apic->lapic_timer.timer.base->get_time();
> >> +		kvm_get_msr(vcpu, MSR_IA32_TSC, &guest_tsc);
> > 
> > Use kvm_x86_ops->read_l1_tsc(vcpu) instead of direct MSR read
> > (to avoid reading L2 guest TSC in case of nested virt).
> > 
> >> +		guest_tsc_delta = apic->lapic_timer.tscdeadline - guest_tsc;
> > 
> > if (guest_tsc <= tscdeadline), the timer should start immediately.
> > 
> 
> Yes, under such case the timer does start immediately, with ns = 0

No, guest_tsc_delta is unsigned, so the "< 0" comparation fails.


WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>, Avi Kivity <avi@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/2] KVM: emulate lapic tsc deadline timer for guest
Date: Thu, 15 Sep 2011 08:45:31 -0300	[thread overview]
Message-ID: <20110915114531.GA5817@amt.cnet> (raw)
In-Reply-To: <BC00F5384FCFC9499AF06F92E8B78A9E25448A9E6B@shsmsx502.ccr.corp.intel.com>

On Thu, Sep 15, 2011 at 04:17:20PM +0800, Liu, Jinsong wrote:
> Marcelo Tosatti wrote:
> >> +	} else if (apic_lvtt_tscdeadline(apic)) {
> >> +		/* lapic timer in tsc deadline mode */
> >> +		u64 guest_tsc, guest_tsc_delta, ns = 0;
> >> +		struct kvm_vcpu *vcpu = apic->vcpu;
> >> +		unsigned long this_tsc_khz = vcpu_tsc_khz(vcpu); +		unsigned long
> >> flags; +
> >> +		if (unlikely(!apic->lapic_timer.tscdeadline || !this_tsc_khz))
> >> +			return; +
> >> +		local_irq_save(flags);
> >> +
> >> +		now = apic->lapic_timer.timer.base->get_time();
> >> +		kvm_get_msr(vcpu, MSR_IA32_TSC, &guest_tsc);
> > 
> > Use kvm_x86_ops->read_l1_tsc(vcpu) instead of direct MSR read
> > (to avoid reading L2 guest TSC in case of nested virt).
> > 
> >> +		guest_tsc_delta = apic->lapic_timer.tscdeadline - guest_tsc;
> > 
> > if (guest_tsc <= tscdeadline), the timer should start immediately.
> > 
> 
> Yes, under such case the timer does start immediately, with ns = 0

No, guest_tsc_delta is unsigned, so the "< 0" comparation fails.

  reply	other threads:[~2011-09-15 11:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 14:36 [PATCH 1/2] KVM: emulate lapic tsc deadline timer for guest Liu, Jinsong
2011-09-13 14:36 ` [Qemu-devel] " Liu, Jinsong
2011-09-14 11:45 ` Marcelo Tosatti
2011-09-14 11:45   ` [Qemu-devel] " Marcelo Tosatti
2011-09-15  6:22   ` Liu, Jinsong
2011-09-15  6:22     ` [Qemu-devel] " Liu, Jinsong
2011-09-15 12:15     ` Marcelo Tosatti
2011-09-15 12:15       ` [Qemu-devel] " Marcelo Tosatti
2011-09-15  8:17   ` Liu, Jinsong
2011-09-15  8:17     ` [Qemu-devel] " Liu, Jinsong
2011-09-15 11:45     ` Marcelo Tosatti [this message]
2011-09-15 11:45       ` 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=20110915114531.GA5817@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=jinsong.liu@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.