WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] LAPIC timer accounting fix

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Gary Grebus <ggrebus@xxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] LAPIC timer accounting fix
From: Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
Date: Wed, 24 Oct 2007 17:12:55 -0400
Delivery-date: Wed, 24 Oct 2007 14:22:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.5 (X11/20070719)
Offset emulated local APIC timer so it doesn't tick during guest's
timer related processing. Otherwise, guests using the local APIC for
process accounting can see long sequences of process ticks incorrectly
charged to interrupt processing.

Signed-off-by: Ben Guthro <bguthro@xxxxxxxxxxxxxx>
Signed-off-by: Gary Grebus <ggrebus@xxxxxxxxxxxxxxx>
diff -r 68521d709355 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Tue Sep 11 15:33:54 2007 -0400
+++ b/xen/arch/x86/hvm/vlapic.c Tue Sep 11 15:33:54 2007 -0400
@@ -962,6 +962,11 @@ void vlapic_destroy(struct vcpu *v)
     free_domheap_page(vlapic->regs_page);
 }
 
+int is_lvtt_vector(struct vcpu *v, int vector)
+{
+    return (vector == vlapic_lvt_vector(vcpu_vlapic(v), APIC_LVTT));
+}
+
 int is_lvtt(struct vcpu *v, int vector)
 {
     return vcpu_vlapic(v)->pt.enabled &&
diff -r 68521d709355 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c    Tue Sep 11 15:33:54 2007 -0400
+++ b/xen/arch/x86/hvm/vpt.c    Tue Sep 11 15:33:54 2007 -0400
@@ -277,6 +277,13 @@ void create_periodic_time(
     pt->period_cycles = (u64)period * cpu_khz / 1000000L;
     pt->one_shot = one_shot;
     pt->scheduled = NOW() + period;
+    if (is_lvtt_vector(v, irq))
+    {
+        /* Try to offset local APIC ticks from timer ticks.  Otherwise, guests
+           using the local APIC for process accounting can see long sequences
+           of process ticks incorrectly charged to interrupt processing. */
+        pt->scheduled += (period >> 1);
+    }
     pt->cb = cb;
     pt->priv = data;
 
diff -r 68521d709355 xen/include/asm-x86/hvm/vlapic.h
--- a/xen/include/asm-x86/hvm/vlapic.h  Tue Sep 11 15:33:54 2007 -0400
+++ b/xen/include/asm-x86/hvm/vlapic.h  Tue Sep 11 15:33:54 2007 -0400
@@ -92,6 +92,7 @@ struct vlapic *apic_round_robin(
 
 int vlapic_match_logical_addr(struct vlapic *vlapic, uint8_t mda);
 
+int is_lvtt_vector(struct vcpu *v, int vector);
 int is_lvtt(struct vcpu *v, int vector);
 int is_lvtt_enabled(struct vcpu *v);
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>