From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "He, Qing" <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 2/3] KVM: fix apic timer save/migration when inactive
Date: Thu, 06 Sep 2007 12:15:15 +0300 [thread overview]
Message-ID: <46DFC523.7090806@qumranet.com> (raw)
In-Reply-To: <37E52D09333DE2469A03574C88DBF40FA9C208-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
He, Qing wrote:
>
> When local apic timer is inactive or is expired in oneshot mode, it
> should not be restarted in save/restore or hrtimer migration. This
> patch fixes this.
>
> diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
> index 5f97e25..68d454c 100644
> --- a/drivers/kvm/irq.h
> +++ b/drivers/kvm/irq.h
> @@ -110,6 +110,7 @@ struct kvm_lapic {
> struct kvm_io_device dev;
> struct {
> atomic_t pending;
> + atomic_t active;
>
This is atomic, but you never use read-modify-write instructions (read
and write are atomic on a simple int).
> +
> + if (atomic_read(&apic->timer.active))
>
What if the timer fires here?
> + apic_set_reg(apic, APIC_TMCCT, tmict);
> + else
> + apic_set_reg(apic, APIC_TMCCT, 0);
> +}
> +
> void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
> @@ -1036,11 +1062,14 @@ void kvm_migrate_apic_timer(struct kvm_vcpu
> *vcpu)
> struct kvm_lapic *apic = vcpu->apic;
> struct hrtimer *timer;
>
> - if (apic) {
> - timer = &apic->timer.dev;
> - hrtimer_cancel(timer);
> - hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
> - }
> + if (!apic)
> + return;
> +
> + timer = &apic->timer.dev;
> + hrtimer_cancel(timer);
> + if (atomic_read(&apic->timer.active))
>
Or here?
> + hrtimer_start(timer, timer->expires,
> + HRTIMER_MODE_ABS);
> }
> EXPORT_SYMBOL_GPL(kvm_migrate_apic_timer);
>
>
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
next prev parent reply other threads:[~2007-09-06 9:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-06 8:38 [PATCH 2/3] KVM: fix apic timer save/migration when inactive He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C208-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-06 9:15 ` Avi Kivity [this message]
[not found] ` <46DFC523.7090806-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-06 9:47 ` Avi Kivity
[not found] ` <46DFCCAE.3040507-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-07 3:26 ` He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C20B-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-09 7:39 ` Avi Kivity
[not found] ` <46E3A31E.7060107-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-10 5:58 ` He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C21C-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-10 6:01 ` [PATCH 2/3] KVM: fix apic timer save/migration wheninactive He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C21D-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-10 7:27 ` Avi Kivity
[not found] ` <46E4F1E0.8090805-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-10 7:50 ` He, Qing
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=46DFC523.7090806@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox