From: Paolo Bonzini <pbonzini@redhat.com>
To: Nadav Amit <namit@cs.technion.ac.il>, gleb@kernel.org
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Clear apic tsc-deadline after deadline
Date: Tue, 19 Aug 2014 12:36:31 +0200 [thread overview]
Message-ID: <53F328AF.3050802@redhat.com> (raw)
In-Reply-To: <1408390933-2876-1-git-send-email-namit@cs.technion.ac.il>
Il 18/08/2014 21:42, Nadav Amit ha scritto:
> Intel SDM 10.5.4.1 says "When the timer generates an interrupt, it disarms
> itself and clears the IA32_TSC_DEADLINE MSR".
>
> This patch clears the MSR upon timer interrupt delivery which delivered on
> deadline mode. Since the MSR may be reconfigured while an interrupt is
> pending, causing the new value to be overriden, pending timer interrupts are
> checked before setting a new deadline.
>
> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
> ---
> arch/x86/kvm/lapic.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 08e8a89..666c086 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1352,6 +1352,9 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)
> return;
>
> hrtimer_cancel(&apic->lapic_timer.timer);
> + /* Inject here so clearing tscdeadline won't override new value */
> + if (apic_has_pending_timer(vcpu))
> + kvm_inject_apic_timer_irqs(vcpu);
> apic->lapic_timer.tscdeadline = data;
> start_apic_timer(apic);
> }
> @@ -1639,6 +1642,8 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
>
> if (atomic_read(&apic->lapic_timer.pending) > 0) {
> kvm_apic_local_deliver(apic, APIC_LVTT);
> + if (apic_lvtt_tscdeadline(apic))
> + apic->lapic_timer.tscdeadline = 0;
> atomic_set(&apic->lapic_timer.pending, 0);
> }
> }
>
Applied, thanks. Also applied patch 2 to kvm-unit-tests.
Paolo
prev parent reply other threads:[~2014-08-19 10:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 19:42 [PATCH] KVM: x86: Clear apic tsc-deadline after deadline Nadav Amit
2014-08-18 19:43 ` [PATCH kvm-unit-tests 1/2] x86: Use host CPU parameter for apic test Nadav Amit
2014-08-18 19:43 ` [PATCH kvm-unit-tests 2/2] x86: Check deadline counter is cleared after interrupt Nadav Amit
2014-08-19 10:06 ` Paolo Bonzini
2014-08-19 9:51 ` [PATCH kvm-unit-tests 1/2] x86: Use host CPU parameter for apic test Paolo Bonzini
2014-08-19 13:18 ` Eduardo Habkost
2014-08-19 13:23 ` Paolo Bonzini
2014-08-19 10:36 ` Paolo Bonzini [this message]
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=53F328AF.3050802@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=namit@cs.technion.ac.il \
/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.