late lapic timer interrupts for hvm guest
Hi,
When using lapic as timer source the hypervisor delivers timer interrupts late.
In the source xen/arch/x86/hvm/vpt.c function create_periodic_time creates a timer element with a "bonus" of 50% of the desired time until the interrupt:
pt->scheduled = NOW() + period;
/*
* Offset LAPIC ticks from other timer ticks. Otherwise guests which use
* LAPIC ticks for process accounting can see long sequences of process
* ticks incorrectly accounted to interrupt processing.
*/
if ( pt->source == PTSRC_lapic )
pt->scheduled += period >> 1;We have ported our mainframe OS BS2000 to x86_64/XEN and we are using the lapic timer as the main timer interrupt source (one shot mode). Finally I've found the above coding which seems to be the root cause of late interrupts.
I think the problem mentioned in the comment won't occur if the guest uses the lapic timer in one shot mode with varying timer values (like BS2000). Or am I wrong here?
Juergen
Signature · 5 lines
Juergen Gross Principal Developer IP SW OS6 Telephone: +49 (0) 89 636 47950 Fujitsu Siemens Computers e-mail: [email protected] Otto-Hahn-Ring 6 Internet: www.fujitsu-siemens.com D-81739 Muenchen Company details: www.fujitsu-siemens.com/imprint.html
Quoted 9 lines · Juergen Gross
pt->scheduled = NOW() + period;
/*
* Offset LAPIC ticks from other timer ticks. Otherwise guests which use
* LAPIC ticks for process accounting can see long sequences of process
* ticks incorrectly accounted to interrupt processing.
*/
if ( pt->source == PTSRC_lapic )
pt->scheduled += period >> 1;Quoted 7 lines
We have ported our mainframe OS BS2000 to x86_64/XEN and we are using the lapic timer as the main timer interrupt source (one shot mode). Finally I've found the above coding which seems to be the root cause of late interrupts.
I think the problem mentioned in the comment won't occur if the guest uses the lapic timer in one shot mode with varying timer values (like BS2000). Or am I wrong here?
Right. That extra code could be conditional on setting up a periodic LAPIC timer.
-- Keir
Quoted 16 lines · Keir Fraser
Quoted 13 lines · Juergen Gross
pt->scheduled = NOW() + period; /* * Offset LAPIC ticks from other timer ticks. Otherwise guests which use * LAPIC ticks for process accounting can see long sequences of process * ticks incorrectly accounted to interrupt processing. */ if ( pt->source == PTSRC_lapic ) pt->scheduled += period >> 1;We have ported our mainframe OS BS2000 to x86_64/XEN and we are using the lapic timer as the main timer interrupt source (one shot mode). Finally I've found the above coding which seems to be the root cause of late interrupts.
Quoted 6 lines
Quoted 3 lines
I think the problem mentioned in the comment won't occur if the guest uses the lapic timer in one shot mode with varying timer values (like BS2000). Or am I wrong here?
Right. That extra code could be conditional on setting up a periodic LAPIC timer.
Okay, here is the patch.
Juergen
Signature · 5 lines
Juergen Gross Principal Developer IP SW OS6 Telephone: +49 (0) 89 636 47950 Fujitsu Siemens Computers e-mail: [email protected] Otto-Hahn-Ring 6 Internet: www.fujitsu-siemens.com D-81739 Muenchen Company details: www.fujitsu-siemens.com/imprint.html
When using lapic timer in one shot mode there is no need to delay timer interrupts.
# HG changeset patch
# User [email protected]
# Date 1225183655 -3600
# Node ID 7640fba355fac233773d183077d7d01c8fd591f3 # Parent 874d0d673ecb55749cdc836942222ba684b365cb don't delay lapic timer if one shot mode
xen/arch/x86/hvm/vpt.c +2 -1
@@ -388,8 +388,9 @@* Offset LAPIC ticks from other timer ticks. Otherwise guests which use * LAPIC ticks for process accounting can see long sequences of process * ticks incorrectly accounted to interrupt processing. +* In one shot mode we assume this is no problem. */ -if ( pt->source == PTSRC_lapic ) +if ( period && (pt->source == PTSRC_lapic) ) pt->scheduled += delta >>1 ; pt->cb = cb; pt->priv = data;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel