summaryrefslogtreecommitdiff
path: root/drivers/xen/events.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2013-03-28 10:03:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-07 12:49:34 -0700
commite3f7e71f94234a4b10265e644d5e01d5c8ff7880 (patch)
treeb02e4d46287b2fd69d662fb7eb204f8aa14376a5 /drivers/xen/events.c
parent8cfd67a3d001f8f7428c5455b69e177fa8aa31b1 (diff)
downloadlinux-3.10-e3f7e71f94234a4b10265e644d5e01d5c8ff7880.tar.gz
linux-3.10-e3f7e71f94234a4b10265e644d5e01d5c8ff7880.tar.bz2
linux-3.10-e3f7e71f94234a4b10265e644d5e01d5c8ff7880.zip
xen/events: Handle VIRQ_TIMER before any other hardirq in event loop.
commit bee980d9e9642e96351fa3ca9077b853ecf62f57 upstream. 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. Reviewed-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/xen/events.c')
-rw-r--r--drivers/xen/events.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 26c47a4c426..417c1333f6c 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -1258,7 +1258,7 @@ static void __xen_evtchn_do_upcall(void)
{
int start_word_idx, start_bit_idx;
int word_idx, bit_idx;
- int i;
+ int i, irq;
int cpu = get_cpu();
struct shared_info *s = HYPERVISOR_shared_info;
struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
@@ -1266,6 +1266,8 @@ static void __xen_evtchn_do_upcall(void)
do {
unsigned long pending_words;
+ unsigned long pending_bits;
+ struct irq_desc *desc;
vcpu_info->evtchn_upcall_pending = 0;
@@ -1276,6 +1278,17 @@ static void __xen_evtchn_do_upcall(void)
/* Clear master flag /before/ clearing selector flag. */
wmb();
#endif
+ if ((irq = per_cpu(virq_to_irq, cpu)[VIRQ_TIMER]) != -1) {
+ int evtchn = evtchn_from_irq(irq);
+ word_idx = evtchn / BITS_PER_LONG;
+ pending_bits = evtchn % BITS_PER_LONG;
+ if (active_evtchns(cpu, s, word_idx) & (1ULL << pending_bits)) {
+ desc = irq_to_desc(irq);
+ if (desc)
+ generic_handle_irq_desc(irq, desc);
+ }
+ }
+
pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
start_word_idx = __this_cpu_read(current_word_idx);
@@ -1284,7 +1297,6 @@ static void __xen_evtchn_do_upcall(void)
word_idx = start_word_idx;
for (i = 0; pending_words != 0; i++) {
- unsigned long pending_bits;
unsigned long words;
words = MASK_LSBS(pending_words, word_idx);
@@ -1313,8 +1325,7 @@ static void __xen_evtchn_do_upcall(void)
do {
unsigned long bits;
- int port, irq;
- struct irq_desc *desc;
+ int port;
bits = MASK_LSBS(pending_bits, bit_idx);