* [PATCH] lapic3: various cleanups on user/kernel irqchip
@ 2007-08-10 6:17 He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1C0-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: He, Qing @ 2007-08-10 6:17 UTC (permalink / raw)
To: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]
KVM: cleanups on user/kernel irqchip checking
The patch removes the union of userspace irq_pending and kernel apic in
struct vcpu, which minimizes the impact of careless overwriting and
avoids accidentally dereferencing invalid apic pointer.
It also adds a protective checking on KVM_INTERRUPT ioctl, which should
only be valid when using userspace irqchips.
Signed-off-by: Qing He <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 87ddf73..f3f2222 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -322,19 +322,17 @@ struct kvm_vcpu {
u64 pdptrs[4]; /* pae */
u64 apic_base;
u64 shadow_efer;
- union {
- struct { /* user irqchip context */
- /*
- * bit vector: 1 per word in irq_pending
- */
- unsigned long irq_summary;
- DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
- unsigned long cr8;
- };
- struct { /* kernel irqchip context */
- struct kvm_lapic *apic;
- };
+
+ struct { /* user irqchip context */
+ /*
+ * bit vector: 1 per word in irq_pending
+ */
+ unsigned long irq_summary;
+ DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
+ unsigned long cr8;
};
+ struct kvm_lapic *apic; /* kernel irqchip context */
+
u64 ia32_misc_enable_msr;
struct kvm_mmu mmu;
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 88b0b89..fd9436e 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1079,7 +1079,7 @@ static struct kvm_io_device
*vcpu_find_pervcpu_dev(struct kvm_vcpu *vcpu,
{
struct kvm_io_device *dev;
- if (irqchip_in_kernel(vcpu->kvm) && vcpu->apic) {
+ if (vcpu->apic) {
dev = &vcpu->apic->dev;
if (dev->in_range(dev, addr))
return dev;
@@ -2394,6 +2394,8 @@ static int kvm_vcpu_ioctl_interrupt(struct
kvm_vcpu *vcpu,
{
if (irq->irq < 0 || irq->irq >= 256)
return -EINVAL;
+ if (irqchip_in_kernel(vcpu->kvm))
+ return -ENXIO;
vcpu_load(vcpu);
set_bit(irq->irq, vcpu->irq_pending);
[-- Attachment #2: apic-kern-user-cleanup.diff --]
[-- Type: application/octet-stream, Size: 1536 bytes --]
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 87ddf73..f3f2222 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -322,19 +322,17 @@ struct kvm_vcpu {
u64 pdptrs[4]; /* pae */
u64 apic_base;
u64 shadow_efer;
- union {
- struct { /* user irqchip context */
- /*
- * bit vector: 1 per word in irq_pending
- */
- unsigned long irq_summary;
- DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
- unsigned long cr8;
- };
- struct { /* kernel irqchip context */
- struct kvm_lapic *apic;
- };
+
+ struct { /* user irqchip context */
+ /*
+ * bit vector: 1 per word in irq_pending
+ */
+ unsigned long irq_summary;
+ DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
+ unsigned long cr8;
};
+ struct kvm_lapic *apic; /* kernel irqchip context */
+
u64 ia32_misc_enable_msr;
struct kvm_mmu mmu;
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 88b0b89..fd9436e 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1079,7 +1079,7 @@ static struct kvm_io_device *vcpu_find_pervcpu_dev(struct kvm_vcpu *vcpu,
{
struct kvm_io_device *dev;
- if (irqchip_in_kernel(vcpu->kvm) && vcpu->apic) {
+ if (vcpu->apic) {
dev = &vcpu->apic->dev;
if (dev->in_range(dev, addr))
return dev;
@@ -2394,6 +2394,8 @@ static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
{
if (irq->irq < 0 || irq->irq >= 256)
return -EINVAL;
+ if (irqchip_in_kernel(vcpu->kvm))
+ return -ENXIO;
vcpu_load(vcpu);
set_bit(irq->irq, vcpu->irq_pending);
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <37E52D09333DE2469A03574C88DBF40FA9C1C0-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* clean APIC_TMCCT setting in APIC timer [not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1C0-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2007-08-10 15:33 ` Dong, Eddie [not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA90-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-08-10 15:36 ` modify apic timer last_update to precisely reflect hrtimer fire point Dong, Eddie 2007-08-13 7:55 ` [PATCH] lapic3: various cleanups on user/kernel irqchip Avi Kivity 2 siblings, 1 reply; 7+ messages in thread From: Dong, Eddie @ 2007-08-10 15:33 UTC (permalink / raw) To: kvm-devel APIC_TMCCT is a dynamically running count which always need to be recalculated at the time it is read. Setting intermediate value is meaningless. Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index d59b69f..fc53e88 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c @@ -445,7 +445,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) { u32 counter_passed; ktime_t passed, now = apic->timer.dev.base->get_time(); - u32 tmcct = apic_get_reg(apic, APIC_TMCCT); + u32 tmcct = apic_get_reg(apic, APIC_TMICT); ASSERT(apic != NULL); @@ -474,9 +474,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) } while (tmcct <= 0); } - apic->timer.last_update = now; - apic_set_reg(apic, APIC_TMCCT, tmcct); - return tmcct; } @@ -633,7 +630,6 @@ static void apic_mmio_write(struct kvm_io_device *this, u32 offset; apic_set_reg(apic, APIC_TMICT, val); - apic_set_reg(apic, APIC_TMCCT, val); apic->timer.last_update = now; offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * val; @@ -815,7 +811,6 @@ static void lapic_reset(struct kvm_vcpu *vcpu) apic_set_reg(apic, APIC_ICR2, 0); apic_set_reg(apic, APIC_TDCR, 0); apic_set_reg(apic, APIC_TMICT, 0); - apic_set_reg(apic, APIC_TMCCT, 0); for (i = 0; i < 8; i++) { apic_set_reg(apic, APIC_IRR + 0x10 * i, 0); apic_set_reg(apic, APIC_ISR + 0x10 * i, 0); @@ -886,13 +881,10 @@ static int __apic_timer_fn(struct kvm_lapic *apic) u32 offset; u32 tmict = apic_get_reg(apic, APIC_TMICT); - apic_set_reg(apic, APIC_TMCCT, tmict); offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * tmict; result = 1; apic->timer.dev.expires = ktime_add_ns(now, offset); - } else { - apic_set_reg(apic, APIC_TMCCT, 0); } return result; @@ -996,7 +988,6 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu) MSR_IA32_APICBASE_BASE; apic_set_reg(apic, APIC_LVR, APIC_VERSION); val = apic_get_reg(apic, APIC_TMICT); - apic_set_reg(apic, APIC_TMCCT, val); apic_update_ppr(apic); /* TODO: following code can be in a common API */ ------------------------------------------------------------------------- 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/ ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <10EA09EFD8728347A513008B6B0DA77A01E8DA90-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: clean APIC_TMCCT setting in APIC timer [not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA90-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2007-08-10 15:34 ` Dong, Eddie 2007-08-13 11:25 ` Avi Kivity 1 sibling, 0 replies; 7+ messages in thread From: Dong, Eddie @ 2007-08-10 15:34 UTC (permalink / raw) To: Dong, Eddie, kvm-devel [-- Attachment #1: Type: text/plain, Size: 2988 bytes --] Forgot the attachment :-( kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org wrote: > APIC_TMCCT is a dynamically running count which always > need to be recalculated at the time it is read. Setting > intermediate value is meaningless. > > Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > > diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c > index d59b69f..fc53e88 100644 > --- a/drivers/kvm/lapic.c > +++ b/drivers/kvm/lapic.c > @@ -445,7 +445,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) > { u32 counter_passed; > ktime_t passed, now = apic->timer.dev.base->get_time(); > - u32 tmcct = apic_get_reg(apic, APIC_TMCCT); > + u32 tmcct = apic_get_reg(apic, APIC_TMICT); > > ASSERT(apic != NULL); > > @@ -474,9 +474,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) > } while (tmcct <= 0); } > > - apic->timer.last_update = now; > - apic_set_reg(apic, APIC_TMCCT, tmcct); > - > return tmcct; > } > > @@ -633,7 +630,6 @@ static void apic_mmio_write(struct kvm_io_device > *this, u32 offset; > > apic_set_reg(apic, APIC_TMICT, val); > - apic_set_reg(apic, APIC_TMCCT, val); > apic->timer.last_update = now; > offset = > APIC_BUS_CYCLE_NS * apic->timer.divide_count * val; > @@ -815,7 +811,6 @@ static void lapic_reset(struct kvm_vcpu *vcpu) > apic_set_reg(apic, APIC_ICR2, 0); > apic_set_reg(apic, APIC_TDCR, 0); > apic_set_reg(apic, APIC_TMICT, 0); > - apic_set_reg(apic, APIC_TMCCT, 0); > for (i = 0; i < 8; i++) { > apic_set_reg(apic, APIC_IRR + 0x10 * i, 0); > apic_set_reg(apic, APIC_ISR + 0x10 * i, 0); > @@ -886,13 +881,10 @@ static int __apic_timer_fn(struct > kvm_lapic *apic) > u32 offset; > u32 tmict = apic_get_reg(apic, APIC_TMICT); > > - apic_set_reg(apic, APIC_TMCCT, tmict); > offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * > tmict; > > result = 1; > apic->timer.dev.expires = ktime_add_ns(now, offset); > - } else { > - apic_set_reg(apic, APIC_TMCCT, 0); > } > > return result; > @@ -996,7 +988,6 @@ void kvm_apic_post_state_restore(struct kvm_vcpu > *vcpu) MSR_IA32_APICBASE_BASE; > apic_set_reg(apic, APIC_LVR, APIC_VERSION); > val = apic_get_reg(apic, APIC_TMICT); > - apic_set_reg(apic, APIC_TMCCT, val); > apic_update_ppr(apic); > > /* TODO: following code can be in a common API */ > > --------------------------------------------------------------- > ---------- > 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/ _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel [-- Attachment #2: apic-timer-tmcct.patch --] [-- Type: application/octet-stream, Size: 2281 bytes --] commit 9b1a9ad955d9ac44ee6e60b4a565edf044d3dcc7 Author: root <root@vt32-pae.(none)> Date: Fri Aug 10 22:38:59 2007 +0800 APIC_TMCCT is a dynamically running count which always need to be recalculated at the time it is read. Setting intermediate value is meaningless. Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong@intel.com> diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index d59b69f..fc53e88 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c @@ -445,7 +445,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) { u32 counter_passed; ktime_t passed, now = apic->timer.dev.base->get_time(); - u32 tmcct = apic_get_reg(apic, APIC_TMCCT); + u32 tmcct = apic_get_reg(apic, APIC_TMICT); ASSERT(apic != NULL); @@ -474,9 +474,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) } while (tmcct <= 0); } - apic->timer.last_update = now; - apic_set_reg(apic, APIC_TMCCT, tmcct); - return tmcct; } @@ -633,7 +630,6 @@ static void apic_mmio_write(struct kvm_io_device *this, u32 offset; apic_set_reg(apic, APIC_TMICT, val); - apic_set_reg(apic, APIC_TMCCT, val); apic->timer.last_update = now; offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * val; @@ -815,7 +811,6 @@ static void lapic_reset(struct kvm_vcpu *vcpu) apic_set_reg(apic, APIC_ICR2, 0); apic_set_reg(apic, APIC_TDCR, 0); apic_set_reg(apic, APIC_TMICT, 0); - apic_set_reg(apic, APIC_TMCCT, 0); for (i = 0; i < 8; i++) { apic_set_reg(apic, APIC_IRR + 0x10 * i, 0); apic_set_reg(apic, APIC_ISR + 0x10 * i, 0); @@ -886,13 +881,10 @@ static int __apic_timer_fn(struct kvm_lapic *apic) u32 offset; u32 tmict = apic_get_reg(apic, APIC_TMICT); - apic_set_reg(apic, APIC_TMCCT, tmict); offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * tmict; result = 1; apic->timer.dev.expires = ktime_add_ns(now, offset); - } else { - apic_set_reg(apic, APIC_TMCCT, 0); } return result; @@ -996,7 +988,6 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu) MSR_IA32_APICBASE_BASE; apic_set_reg(apic, APIC_LVR, APIC_VERSION); val = apic_get_reg(apic, APIC_TMICT); - apic_set_reg(apic, APIC_TMCCT, val); apic_update_ppr(apic); /* TODO: following code can be in a common API */ [-- Attachment #3: Type: text/plain, Size: 315 bytes --] ------------------------------------------------------------------------- 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/ [-- Attachment #4: Type: text/plain, Size: 186 bytes --] _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: clean APIC_TMCCT setting in APIC timer [not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA90-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-08-10 15:34 ` Dong, Eddie @ 2007-08-13 11:25 ` Avi Kivity 1 sibling, 0 replies; 7+ messages in thread From: Avi Kivity @ 2007-08-13 11:25 UTC (permalink / raw) To: Dong, Eddie; +Cc: kvm-devel Dong, Eddie wrote: > APIC_TMCCT is a dynamically running count which always > need to be recalculated at the time it is read. Setting > intermediate value is meaningless. > > Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > > Patch corrupted by your mailer, please resend as attachment. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* modify apic timer last_update to precisely reflect hrtimer fire point. [not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1C0-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-08-10 15:33 ` clean APIC_TMCCT setting in APIC timer Dong, Eddie @ 2007-08-10 15:36 ` Dong, Eddie [not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA92-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-08-13 7:55 ` [PATCH] lapic3: various cleanups on user/kernel irqchip Avi Kivity 2 siblings, 1 reply; 7+ messages in thread From: Dong, Eddie @ 2007-08-10 15:36 UTC (permalink / raw) To: kvm-devel [-- Attachment #1: Type: text/plain, Size: 2070 bytes --] cleanup: last_update should precisely reflect the time when an hrtimer is fired, and store the period of apic timer to avoid calculation each time. Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h index 44e1fa4..ed6d20a 100644 --- a/drivers/kvm/irq.h +++ b/drivers/kvm/irq.h @@ -111,6 +111,7 @@ struct kvm_lapic { struct kvm_io_device dev; struct { unsigned long pending; + s64 period; /* unit: ns */ u32 divide_count; ktime_t last_update; struct hrtimer dev; diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index fc53e88..352b8a7 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c @@ -627,11 +627,10 @@ static void apic_mmio_write(struct kvm_io_device *this, case APIC_TMICT: { ktime_t now = apic->timer.dev.base->get_time(); - u32 offset; apic_set_reg(apic, APIC_TMICT, val); apic->timer.last_update = now; - offset = + apic->timer.period = APIC_BUS_CYCLE_NS * apic->timer.divide_count * val; /* Make sure the lock ordering is coherent */ @@ -861,7 +860,6 @@ EXPORT_SYMBOL_GPL(kvm_lapic_get_regs); static int __apic_timer_fn(struct kvm_lapic *apic) { u32 vector; - ktime_t now; int result = 0; if (unlikely(!apic_enabled(apic) || @@ -872,8 +870,7 @@ static int __apic_timer_fn(struct kvm_lapic *apic) } vector = apic_lvt_vector(apic, APIC_LVTT); - now = apic->timer.dev.base->get_time(); - apic->timer.last_update = now; + apic->timer.last_update = apic->timer.dev.expires; apic->timer.pending++; __apic_accept_irq(apic, APIC_DM_FIXED, vector, 1, 0); @@ -884,7 +881,9 @@ static int __apic_timer_fn(struct kvm_lapic *apic) offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * tmict; result = 1; - apic->timer.dev.expires = ktime_add_ns(now, offset); + apic->timer.dev.expires = ktime_add_ns( + apic->timer.dev.expires, + apic->timer.period); } return result; [-- Attachment #2: apic-timer-last2.patch --] [-- Type: application/octet-stream, Size: 1969 bytes --] cleanup: last_update should precisely reflect the time when an hrtimer is fired, and store the period of apic timer to avoid calculation each time. Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong@intel.com> diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h index 44e1fa4..ed6d20a 100644 --- a/drivers/kvm/irq.h +++ b/drivers/kvm/irq.h @@ -111,6 +111,7 @@ struct kvm_lapic { struct kvm_io_device dev; struct { unsigned long pending; + s64 period; /* unit: ns */ u32 divide_count; ktime_t last_update; struct hrtimer dev; diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index fc53e88..352b8a7 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c @@ -627,11 +627,10 @@ static void apic_mmio_write(struct kvm_io_device *this, case APIC_TMICT: { ktime_t now = apic->timer.dev.base->get_time(); - u32 offset; apic_set_reg(apic, APIC_TMICT, val); apic->timer.last_update = now; - offset = + apic->timer.period = APIC_BUS_CYCLE_NS * apic->timer.divide_count * val; /* Make sure the lock ordering is coherent */ @@ -861,7 +860,6 @@ EXPORT_SYMBOL_GPL(kvm_lapic_get_regs); static int __apic_timer_fn(struct kvm_lapic *apic) { u32 vector; - ktime_t now; int result = 0; if (unlikely(!apic_enabled(apic) || @@ -872,8 +870,7 @@ static int __apic_timer_fn(struct kvm_lapic *apic) } vector = apic_lvt_vector(apic, APIC_LVTT); - now = apic->timer.dev.base->get_time(); - apic->timer.last_update = now; + apic->timer.last_update = apic->timer.dev.expires; apic->timer.pending++; __apic_accept_irq(apic, APIC_DM_FIXED, vector, 1, 0); @@ -884,7 +881,9 @@ static int __apic_timer_fn(struct kvm_lapic *apic) offset = APIC_BUS_CYCLE_NS * apic->timer.divide_count * tmict; result = 1; - apic->timer.dev.expires = ktime_add_ns(now, offset); + apic->timer.dev.expires = ktime_add_ns( + apic->timer.dev.expires, + apic->timer.period); } return result; [-- Attachment #3: Type: text/plain, Size: 315 bytes --] ------------------------------------------------------------------------- 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/ [-- Attachment #4: Type: text/plain, Size: 186 bytes --] _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <10EA09EFD8728347A513008B6B0DA77A01E8DA92-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: modify apic timer last_update to precisely reflect hrtimer fire point. [not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA92-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2007-08-13 11:22 ` Avi Kivity 0 siblings, 0 replies; 7+ messages in thread From: Avi Kivity @ 2007-08-13 11:22 UTC (permalink / raw) To: Dong, Eddie; +Cc: kvm-devel Dong, Eddie wrote: > cleanup: > last_update should precisely reflect the time > when an hrtimer is fired, and store the period > of apic timer to avoid calculation each time. > > This doesn't apply, I'm guessing it depends on the previous patch. Will wait for your comments or updated patch. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] lapic3: various cleanups on user/kernel irqchip [not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1C0-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-08-10 15:33 ` clean APIC_TMCCT setting in APIC timer Dong, Eddie 2007-08-10 15:36 ` modify apic timer last_update to precisely reflect hrtimer fire point Dong, Eddie @ 2007-08-13 7:55 ` Avi Kivity 2 siblings, 0 replies; 7+ messages in thread From: Avi Kivity @ 2007-08-13 7:55 UTC (permalink / raw) To: He, Qing; +Cc: kvm-devel He, Qing wrote: > KVM: cleanups on user/kernel irqchip checking > > The patch removes the union of userspace irq_pending and kernel apic in > struct vcpu, which minimizes the impact of careless overwriting and > avoids accidentally dereferencing invalid apic pointer. > > It also adds a protective checking on KVM_INTERRUPT ioctl, which should > only be valid when using userspace irqchips. > > Applied, thanks. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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/ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-08-13 11:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-10 6:17 [PATCH] lapic3: various cleanups on user/kernel irqchip He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1C0-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-10 15:33 ` clean APIC_TMCCT setting in APIC timer Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA90-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-10 15:34 ` Dong, Eddie
2007-08-13 11:25 ` Avi Kivity
2007-08-10 15:36 ` modify apic timer last_update to precisely reflect hrtimer fire point Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A01E8DA92-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-13 11:22 ` Avi Kivity
2007-08-13 7:55 ` [PATCH] lapic3: various cleanups on user/kernel irqchip Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox