[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xen/evtchn: Handle VIRQ_TIMER before any other hardirq in event loop.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1285147542 -3600
# Node ID a66a7c64b1d039fe4012a26164bbbbdc14727d61
# Parent  2146cf82c90c48ddc191728f3136a1db098b6c71
xen/evtchn: Handle VIRQ_TIMER before any other hardirq in event loop.

This avoids any other hardirq handler seeing a very stale jiffies
value immediately after wakeup from a long idle period. The one
observable symptom of this was a USB keyboard, with software keyboard
repeat, which would always repeat a key immediately that it was
pressed. This is due to the key press waking the guest, the key
handler immediately runs, sees an old jiffies value, and then that
jiffies value significantly updated, before the key is unpressed.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 drivers/xen/core/evtchn.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+)

diff -r 2146cf82c90c -r a66a7c64b1d0 drivers/xen/core/evtchn.c
--- a/drivers/xen/core/evtchn.c Wed Sep 22 08:57:21 2010 +0100
+++ b/drivers/xen/core/evtchn.c Wed Sep 22 10:25:42 2010 +0100
@@ -259,6 +259,20 @@ asmlinkage void evtchn_do_upcall(struct 
                /* Clear master flag /before/ clearing selector flag. */
                wmb();
 #endif
+
+               /*
+                * Handle timer interrupts before all others, so that all
+                * hardirq handlers see an up-to-date system time even if we
+                * have just woken from a long idle period.
+                */
+               if ((irq = __get_cpu_var(virq_to_irq)[VIRQ_TIMER]) != -1) {
+                       port = evtchn_from_irq(irq);
+                       l1i = port / BITS_PER_LONG;
+                       l2i = port % BITS_PER_LONG;
+                       if (active_evtchns(cpu, s, l1i) & (1ul<<l2i))
+                               do_IRQ(irq, regs);
+               }
+
                l1 = xchg(&vcpu_info->evtchn_pending_sel, 0);
 
                start_l1i = l1i = per_cpu(current_l1i, cpu);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.