[kernel] r18375 - in dists/squeeze/linux-2.6/debian: . patches/features/all/xen patches/series

Ian Campbell ijc-guest at alioth.debian.org
Sat Dec 10 17:00:53 UTC 2011


Author: ijc-guest
Date: Sat Dec 10 17:00:46 2011
New Revision: 18375

Log:
xen: backport upstream (xen.git) fixes to event handling (Closes: #638172)

Added:
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-apic-fix-pirq_eoi_gmfn-resume.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-apic-use-handle_edge_irq-for-pirq-events.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-correct-parameter-type-for-pirq_eoi.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-do-not-try-to-allocate-the-callback-vector-again.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Clean-up-round-robin-evtchn-scan.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Make-last-processed-event-channel-a-per-c.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Make-round-robin-scan-fairer-by-snapshott.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Process-event-channels-notifications-in-r.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Remove-redundant-clear-of-l2i-at-end-of-r.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-change-to-using-fasteoi.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-only-unmask-irq-if-enabled.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-use-PHYSDEVOP_pirq_eoi_gmfn-to-get-pirq-n.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-use-locked-set-clear_bit-for-cpu_evtchn_m.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-clear-secondary-CPUs-cpu_evtchn_mask-afte.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-correction-pirq-hypercall-does-not-unmask.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-make-pirq-enable-disable-unmask-mask.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-pirq_eoi-does-unmask.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-rename-enable-disable_dynirq-unmask-mask_.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-rename-retrigger_dynirq-irq.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-improvements-to-VIRQ_DEBUG-output.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-make-pirq-interrupts-use-fasteoi.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-do-EOI-properly-for-pirq-events.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-use-eoi-as-enable.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-use-fasteoi-for-MSI-too.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-set-up-IRQ-before-binding-virq-to-evtchn.patch
   dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-use-dynamic_irq_init_keep_chip_data.patch
Modified:
   dists/squeeze/linux-2.6/debian/changelog
   dists/squeeze/linux-2.6/debian/patches/series/40-extra

Modified: dists/squeeze/linux-2.6/debian/changelog
==============================================================================
--- dists/squeeze/linux-2.6/debian/changelog	Sat Dec 10 14:46:00 2011	(r18374)
+++ dists/squeeze/linux-2.6/debian/changelog	Sat Dec 10 17:00:46 2011	(r18375)
@@ -55,6 +55,16 @@
      http://www.kernel.org/pub/linux/kernel/v2.6/longterm/ChangeLog-2.6.32.50
     and the bug report which this closes: #651367.
 
+  [ Ian Campbell ]
+  * xen: backport upstream (xen.git#xen/stable-2.6.32.y) fixes to event
+    handling:
+    - multiple fixes to PIRQ event channel handling (Closes: #638172)
+    - setup IRQ before binding VIRQ to it.
+    - correctly setup event channel mask for secondary CPUs on restore.
+    - use locked set/clear bit when manipulating event channel masks.
+    - ensure event channels are handled in a fair/round-robin order preventing
+      lower numbered event channels from starving higher.
+
  -- Ben Hutchings <ben at decadent.org.uk>  Thu, 10 Nov 2011 02:28:55 +0000
 
 linux-2.6 (2.6.32-39) stable; urgency=high

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-apic-fix-pirq_eoi_gmfn-resume.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-apic-fix-pirq_eoi_gmfn-resume.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,31 @@
+From c4eaef426c18c6f50a7d4a9e2423476314820f31 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Thu, 16 Sep 2010 17:03:53 -0700
+Subject: [PATCH 14/26] xen/apic: fix pirq_eoi_gmfn resume
+
+Only BUG if the hypercall *fails*...
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit f0d4a0552f03b52027fb2c7958a1cbbe210cf418)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 948c437..5191db7 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1365,7 +1365,7 @@ void xen_irq_resume(void)
+ 		struct physdev_pirq_eoi_gmfn eoi_gmfn;
+ 		
+ 		eoi_gmfn.gmfn = virt_to_mfn(pirq_needs_eoi_bits);
+-		if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) == 0) {
++		if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) != 0) {
+ 			/* Could recover by reverting to old method...? */
+ 			BUG();
+ 		}
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-apic-use-handle_edge_irq-for-pirq-events.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-apic-use-handle_edge_irq-for-pirq-events.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,40 @@
+From 28ef23a7a889df84da6df481249d39bb4dddb4f9 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Mon, 23 Aug 2010 15:23:43 -0700
+Subject: [PATCH 01/26] xen/apic: use handle_edge_irq for pirq events
+
+Like other events, pirq events are edge-triggered.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 29a2e2a7bd19233c62461b104c69233f15ce99ec)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 904b402..ae82e08 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -598,7 +598,7 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name)
+ 		irq = find_unbound_irq();
+ 
+ 	set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
+-				      handle_level_irq, name);
++				      handle_edge_irq, name);
+ 
+ 	irq_op.irq = gsi;
+ 	irq_op.vector = 0;
+@@ -707,7 +707,7 @@ int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
+ 		irq_info[irq].u.pirq.domid = domid;
+ 
+ 	set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
+-			handle_level_irq,
++			handle_edge_irq,
+ 			(type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
+ 
+ out:
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-correct-parameter-type-for-pirq_eoi.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-correct-parameter-type-for-pirq_eoi.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,34 @@
+From 929e7671178220e6ef29ea91e026fdcfb33d5d6b Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ian.campbell at citrix.com>
+Date: Fri, 8 Oct 2010 17:11:24 +0100
+Subject: [PATCH 16/26] xen: correct parameter type for pirq_eoi
+
+Fixes:
+  CC      drivers/xen/events.o
+/local/scratch/ianc/devel/kernels/linux-2.6/drivers/xen/events.c:1452: warning: initialization from incompatible pointer type
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix>
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 7c42097171f2e0beafa16e007a06e464b3014bea)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 1941384..1dd1f29 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -436,7 +436,7 @@ static bool identity_mapped_irq(unsigned irq)
+ 	return irq < get_nr_hw_irqs();
+ }
+ 
+-static void pirq_eoi(int irq)
++static void pirq_eoi(unsigned int irq)
+ {
+ 	struct irq_info *info = info_for_irq(irq);
+ 	struct physdev_eoi eoi = { .irq = info->u.pirq.gsi };
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-do-not-try-to-allocate-the-callback-vector-again.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-do-not-try-to-allocate-the-callback-vector-again.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,32 @@
+From 96c541aa4cb60ad3e75f0e99195fbb101509eb0e Mon Sep 17 00:00:00 2001
+From: Stefano Stabellini <stefano.stabellini at eu.citrix.com>
+Date: Fri, 11 Mar 2011 18:31:35 +0000
+Subject: [PATCH 25/26] xen: do not try to allocate the callback vector again
+ at restore time
+
+Signed-off-by: Stefano Stabellini <stefano.stabellini at eu.citrix.com>
+(cherry picked from commit ea2020837ca7dc2c9bcfc477fb4d261cf067db4f)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 9292d46..5006371 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1525,7 +1525,9 @@ void xen_callback_vector(void)
+ 		}
+ 		printk(KERN_INFO "Xen HVM callback vector for event delivery is "
+ 				"enabled\n");
+-		alloc_intr_gate(XEN_HVM_EVTCHN_CALLBACK, xen_hvm_callback_vector);
++		/* in the restore case the vector has already been allocated */
++		if (!test_bit(XEN_HVM_EVTCHN_CALLBACK, used_vectors))
++			alloc_intr_gate(XEN_HVM_EVTCHN_CALLBACK, xen_hvm_callback_vector);
+ 	}
+ }
+ 
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Clean-up-round-robin-evtchn-scan.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Clean-up-round-robin-evtchn-scan.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,115 @@
+From 25791d4cdda9b91422643f52651ce765684aa9a6 Mon Sep 17 00:00:00 2001
+From: Keir Fraser <keir.fraser at citrix.com>
+Date: Fri, 4 Mar 2011 09:07:13 +0000
+Subject: [PATCH 22/26] xen: events: Clean up round-robin evtchn scan.
+
+Also fixes a couple of boundary cases.
+
+Signed-off-by: Keir Fraser <keir.fraser at citrix.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+[ijc: forward ported from linux-2.6.18-xen.hg 988:c88a02a22a05]
+(cherry picked from commit 188449f889c6c30709c7e9e8710b9eff14fd963f)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   44 ++++++++++++++++++++------------------------
+ 1 files changed, 20 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index df70c1e..9890ecd 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1034,8 +1034,8 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
+ }
+ 
+ static DEFINE_PER_CPU(unsigned, xed_nesting_count);
+-static DEFINE_PER_CPU(unsigned int, last_word_idx) = { BITS_PER_LONG - 1 };
+-static DEFINE_PER_CPU(unsigned int, last_bit_idx) = { BITS_PER_LONG - 1 };
++static DEFINE_PER_CPU(unsigned int, current_word_idx);
++static DEFINE_PER_CPU(unsigned int, current_bit_idx);
+ 
+ /*
+  * Mask out the i least significant bits of w
+@@ -1073,23 +1073,21 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ #endif
+ 		pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
+ 
+-		word_idx = __get_cpu_var(last_word_idx);
+-		bit_idx = __get_cpu_var(last_bit_idx);
++		word_idx = __get_cpu_var(current_word_idx);
++		bit_idx = __get_cpu_var(current_bit_idx);
+ 
+ 		while (pending_words != 0) {
+ 			unsigned long pending_bits;
+ 			unsigned long words;
+ 
+-			word_idx = (word_idx + 1) % BITS_PER_LONG;
+ 			words = MASK_LSBS(pending_words, word_idx);
+ 
+ 			/*
+-			 * If we masked out all events, wrap around to the
+-			 * beginning.
++			 * If we masked out all events, wrap to beginning.
+ 			 */
+ 			if (words == 0) {
+-				word_idx = BITS_PER_LONG - 1;
+-				bit_idx = BITS_PER_LONG - 1;
++				word_idx = 0;
++				bit_idx = 0;
+ 				continue;
+ 			}
+ 			word_idx = __ffs(words);
+@@ -1101,14 +1099,11 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 
+ 				pending_bits = active_evtchns(cpu, s, word_idx);
+ 
+-				bit_idx = (bit_idx + 1) % BITS_PER_LONG;
+ 				bits = MASK_LSBS(pending_bits, bit_idx);
+ 
+ 				/* If we masked out all events, move on. */
+-				if (bits == 0) {
+-					bit_idx = BITS_PER_LONG - 1;
++				if (bits == 0)
+ 					break;
+-				}
+ 
+ 				bit_idx = __ffs(bits);
+ 
+@@ -1125,22 +1120,23 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 						generic_handle_irq_desc(irq, desc);
+ 				}
+ 
+-				/*
+-				 * If this is the final port processed, we'll
+-				 * pick up here+1 next time.
+-				 */
+-				__get_cpu_var(last_word_idx) = word_idx;
+-				__get_cpu_var(last_bit_idx) = bit_idx;
+-			} while (bit_idx != BITS_PER_LONG - 1);
++				bit_idx = (bit_idx + 1) % BITS_PER_LONG;
++
++				/* Next caller starts at last processed + 1 */
++				__get_cpu_var(current_word_idx) =
++						 bit_idx ? word_idx :
++						 (word_idx+1) % BITS_PER_LONG;
++				__get_cpu_var(current_bit_idx) = bit_idx;
++			} while (bit_idx != 0);
+ 
+ 			pending_bits = active_evtchns(cpu, s, word_idx);
+ 
+-			/*
+-			 * We handled all ports, so we can clear the
+-			 * selector bit.
+-			 */
++			/* If we handled all ports, clear the selector bit. */
+ 			if (pending_bits == 0)
+ 				pending_words &= ~(1UL << word_idx);
++
++			word_idx = (word_idx + 1) % BITS_PER_LONG;
++			bit_idx = 0;
+ 		}
+ 
+ 		BUG_ON(!irqs_disabled());
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Make-last-processed-event-channel-a-per-c.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Make-last-processed-event-channel-a-per-c.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,64 @@
+From 2045aed6dc50dfb9e07606ce99997be45bfd6026 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ian.campbell at citrix.com>
+Date: Fri, 4 Mar 2011 09:05:19 +0000
+Subject: [PATCH 21/26] xen: events: Make last processed event channel a
+ per-cpu variable.
+
+Signed-off-by: Ian Campbell <ian.campbell at xensource.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+[ijc: forward ported from linux-2.6.18-xen.hg 325:b2768401db94]
+(cherry picked from commit 1acdebd2d67f71d230f5857c28843e636b7dd92e)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   13 ++++++-------
+ 1 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index a06fe5e..df70c1e 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1034,6 +1034,8 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
+ }
+ 
+ static DEFINE_PER_CPU(unsigned, xed_nesting_count);
++static DEFINE_PER_CPU(unsigned int, last_word_idx) = { BITS_PER_LONG - 1 };
++static DEFINE_PER_CPU(unsigned int, last_bit_idx) = { BITS_PER_LONG - 1 };
+ 
+ /*
+  * Mask out the i least significant bits of w
+@@ -1051,8 +1053,6 @@ static DEFINE_PER_CPU(unsigned, xed_nesting_count);
+  */
+ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ {
+-	static unsigned int last_word_idx = BITS_PER_LONG - 1;
+-	static unsigned int last_bit_idx = BITS_PER_LONG - 1;
+ 	int word_idx, bit_idx;
+ 	int cpu = get_cpu();
+ 	struct shared_info *s = HYPERVISOR_shared_info;
+@@ -1073,8 +1073,8 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ #endif
+ 		pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
+ 
+-		word_idx = last_word_idx;
+-		bit_idx = last_bit_idx;
++		word_idx = __get_cpu_var(last_word_idx);
++		bit_idx = __get_cpu_var(last_bit_idx);
+ 
+ 		while (pending_words != 0) {
+ 			unsigned long pending_bits;
+@@ -1129,9 +1129,8 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 				 * If this is the final port processed, we'll
+ 				 * pick up here+1 next time.
+ 				 */
+-				last_word_idx = word_idx;
+-				last_bit_idx = bit_idx;
+-
++				__get_cpu_var(last_word_idx) = word_idx;
++				__get_cpu_var(last_bit_idx) = bit_idx;
+ 			} while (bit_idx != BITS_PER_LONG - 1);
+ 
+ 			pending_bits = active_evtchns(cpu, s, word_idx);
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Make-round-robin-scan-fairer-by-snapshott.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Make-round-robin-scan-fairer-by-snapshott.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,89 @@
+From 991c43e0facafcbc2712e651d9784e67bb2607db Mon Sep 17 00:00:00 2001
+From: Keir Fraser <keir.fraser at citrix.com>
+Date: Fri, 4 Mar 2011 09:08:07 +0000
+Subject: [PATCH 23/26] xen: events: Make round-robin scan fairer by
+ snapshotting each l2 word
+
+once only (except for starting l2 word, which we scan in two parts).
+Signed-off-by: Keir Fraser <keir.fraser at citrix.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+[ijc: forward ported from linux-2.6.18-xen.hg 990:427276ac595d]
+(cherry picked from commit 0e2ec1fb16f9ca84f91de3d9427a0964d679738a)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   30 +++++++++++++++++++++---------
+ 1 files changed, 21 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 9890ecd..5a34789 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1053,7 +1053,9 @@ static DEFINE_PER_CPU(unsigned int, current_bit_idx);
+  */
+ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ {
++	int start_word_idx, start_bit_idx;
+ 	int word_idx, bit_idx;
++	int i;
+ 	int cpu = get_cpu();
+ 	struct shared_info *s = HYPERVISOR_shared_info;
+ 	struct vcpu_info *vcpu_info = __get_cpu_var(xen_vcpu);
+@@ -1073,10 +1075,12 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ #endif
+ 		pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
+ 
+-		word_idx = __get_cpu_var(current_word_idx);
+-		bit_idx = __get_cpu_var(current_bit_idx);
++		start_word_idx = __get_cpu_var(current_word_idx);
++		start_bit_idx = __get_cpu_var(current_bit_idx);
++
++		word_idx = start_word_idx;
+ 
+-		while (pending_words != 0) {
++		for (i = 0; pending_words != 0; i++) {
+ 			unsigned long pending_bits;
+ 			unsigned long words;
+ 
+@@ -1092,13 +1096,23 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 			}
+ 			word_idx = __ffs(words);
+ 
++			pending_bits = active_evtchns(cpu, s, word_idx);
++			bit_idx = 0; /* usually scan entire word from start */
++			if (word_idx == start_word_idx) {
++				/* We scan the starting word in two parts */
++				if (i == 0)
++					/* 1st time: start in the middle */
++					bit_idx = start_bit_idx;
++				else
++					/* 2nd time: mask bits done already */
++					bit_idx &= (1UL << start_bit_idx) - 1;
++			}
++
+ 			do {
+ 				unsigned long bits;
+ 				int port, irq;
+ 				struct irq_desc *desc;
+ 
+-				pending_bits = active_evtchns(cpu, s, word_idx);
+-
+ 				bits = MASK_LSBS(pending_bits, bit_idx);
+ 
+ 				/* If we masked out all events, move on. */
+@@ -1129,10 +1143,8 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 				__get_cpu_var(current_bit_idx) = bit_idx;
+ 			} while (bit_idx != 0);
+ 
+-			pending_bits = active_evtchns(cpu, s, word_idx);
+-
+-			/* If we handled all ports, clear the selector bit. */
+-			if (pending_bits == 0)
++			/* Scan start_l1i twice; all others once. */
++			if ((word_idx != start_word_idx) || (i != 0))
+ 				pending_words &= ~(1UL << word_idx);
+ 
+ 			word_idx = (word_idx + 1) % BITS_PER_LONG;
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Process-event-channels-notifications-in-r.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Process-event-channels-notifications-in-r.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,139 @@
+From 224f68f24ae637903b2136f76c9be375e74e53c0 Mon Sep 17 00:00:00 2001
+From: Scott Rixner <rixner at rice.edu>
+Date: Fri, 4 Mar 2011 08:58:18 +0000
+Subject: [PATCH 20/26] xen: events: Process event channels notifications in
+ round-robin order.
+
+Avoids fairness issue resulting from domain 0 processing lowest
+numbered event channel first.
+
+Bugzilla #1115 "Event channel port scanning unfair".
+
+Signed-off-by: Ian Campbell <ian.campbell at xensource.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+[ijc: forward ported from linux-2.6.18-xen.hg 324:7fe1c6d02a2b
+ various variables have different names in this tree:
+  l1  -> pending_words
+  l2  -> pending_bits
+  l1i -> word_idx
+  l2i -> bit_idx
+]
+(cherry picked from commit 2d9c33e1b47b800e43a1444a65353fcb96e27165)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   72 +++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 files changed, 65 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 9ead93e..a06fe5e 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1036,6 +1036,11 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
+ static DEFINE_PER_CPU(unsigned, xed_nesting_count);
+ 
+ /*
++ * Mask out the i least significant bits of w
++ */
++#define MASK_LSBS(w, i) (w & ((~0UL) << i))
++
++/*
+  * Search the CPUs pending events bitmasks.  For each one found, map
+  * the event number to an irq, and feed it into do_IRQ() for
+  * handling.
+@@ -1046,6 +1051,9 @@ static DEFINE_PER_CPU(unsigned, xed_nesting_count);
+  */
+ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ {
++	static unsigned int last_word_idx = BITS_PER_LONG - 1;
++	static unsigned int last_bit_idx = BITS_PER_LONG - 1;
++	int word_idx, bit_idx;
+ 	int cpu = get_cpu();
+ 	struct shared_info *s = HYPERVISOR_shared_info;
+ 	struct vcpu_info *vcpu_info = __get_cpu_var(xen_vcpu);
+@@ -1064,17 +1072,50 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 		wmb();
+ #endif
+ 		pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
++
++		word_idx = last_word_idx;
++		bit_idx = last_bit_idx;
++
+ 		while (pending_words != 0) {
+ 			unsigned long pending_bits;
+-			int word_idx = __ffs(pending_words);
+-			pending_words &= ~(1UL << word_idx);
++			unsigned long words;
++
++			word_idx = (word_idx + 1) % BITS_PER_LONG;
++			words = MASK_LSBS(pending_words, word_idx);
++
++			/*
++			 * If we masked out all events, wrap around to the
++			 * beginning.
++			 */
++			if (words == 0) {
++				word_idx = BITS_PER_LONG - 1;
++				bit_idx = BITS_PER_LONG - 1;
++				continue;
++			}
++			word_idx = __ffs(words);
+ 
+-			while ((pending_bits = active_evtchns(cpu, s, word_idx)) != 0) {
+-				int bit_idx = __ffs(pending_bits);
+-				int port = (word_idx * BITS_PER_LONG) + bit_idx;
+-				int irq = evtchn_to_irq[port];
++			do {
++				unsigned long bits;
++				int port, irq;
+ 				struct irq_desc *desc;
+ 
++				pending_bits = active_evtchns(cpu, s, word_idx);
++
++				bit_idx = (bit_idx + 1) % BITS_PER_LONG;
++				bits = MASK_LSBS(pending_bits, bit_idx);
++
++				/* If we masked out all events, move on. */
++				if (bits == 0) {
++					bit_idx = BITS_PER_LONG - 1;
++					break;
++				}
++
++				bit_idx = __ffs(bits);
++
++				/* Process port. */
++				port = (word_idx * BITS_PER_LONG) + bit_idx;
++				irq = evtchn_to_irq[port];
++
+ 				mask_evtchn(port);
+ 				clear_evtchn(port);
+ 
+@@ -1083,7 +1124,24 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 					if (desc)
+ 						generic_handle_irq_desc(irq, desc);
+ 				}
+-			}
++
++				/*
++				 * If this is the final port processed, we'll
++				 * pick up here+1 next time.
++				 */
++				last_word_idx = word_idx;
++				last_bit_idx = bit_idx;
++
++			} while (bit_idx != BITS_PER_LONG - 1);
++
++			pending_bits = active_evtchns(cpu, s, word_idx);
++
++			/*
++			 * We handled all ports, so we can clear the
++			 * selector bit.
++			 */
++			if (pending_bits == 0)
++				pending_words &= ~(1UL << word_idx);
+ 		}
+ 
+ 		BUG_ON(!irqs_disabled());
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Remove-redundant-clear-of-l2i-at-end-of-r.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-Remove-redundant-clear-of-l2i-at-end-of-r.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,31 @@
+From ae092fbf0b97b830862afc4ae81d168f869c8b9a Mon Sep 17 00:00:00 2001
+From: Keir Fraser <keir.fraser at citrix.com>
+Date: Fri, 4 Mar 2011 08:58:17 +0000
+Subject: [PATCH 24/26] xen: events: Remove redundant clear of l2i at end of
+ round-robin loop
+
+Signed-off-by: Keir Fraser <keir.fraser at citrix.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+[ijc: forward ported from linux-2.6.18-xen.hg 991:9ba6d9f3fbc0]
+(cherry picked from commit acad13511ebe1db666aab5807117d3ac647ea58d)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 5a34789..9292d46 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1148,7 +1148,6 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 				pending_words &= ~(1UL << word_idx);
+ 
+ 			word_idx = (word_idx + 1) % BITS_PER_LONG;
+-			bit_idx = 0;
+ 		}
+ 
+ 		BUG_ON(!irqs_disabled());
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-change-to-using-fasteoi.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-change-to-using-fasteoi.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,66 @@
+From f3403af41eab991a9abbf8a6ba6e47f27dc34933 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Fri, 27 Aug 2010 17:30:24 -0700
+Subject: [PATCH 04/26] xen/events: change to using fasteoi
+
+Change event delivery to:
+ - mask+clear event in the upcall function
+ - use handle_fasteoi_irq as the handler
+ - unmask in the eoi function (and handle migration)
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 0672fb44a111dfb6386022071725c5b15c9de584)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   11 +++++++----
+ 1 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 181a254..3561d1d 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -733,7 +733,7 @@ int bind_evtchn_to_irq(unsigned int evtchn)
+ 		irq = find_unbound_irq();
+ 
+ 		set_irq_chip_and_handler_name(irq, &xen_dynamic_chip,
+-					      handle_edge_irq, "event");
++					      handle_fasteoi_irq, "event");
+ 
+ 		evtchn_to_irq[evtchn] = irq;
+ 		irq_info[irq] = mk_evtchn_info(evtchn);
+@@ -1057,6 +1057,9 @@ static void __xen_evtchn_do_upcall(struct pt_regs *regs)
+ 				int irq = evtchn_to_irq[port];
+ 				struct irq_desc *desc;
+ 
++				mask_evtchn(port);
++				clear_evtchn(port);
++
+ 				if (irq != -1) {
+ 					desc = irq_to_desc(irq);
+ 					if (desc)
+@@ -1195,10 +1198,10 @@ static void ack_dynirq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+ 
+-	move_native_irq(irq);
++	move_masked_irq(irq);
+ 
+ 	if (VALID_EVTCHN(evtchn))
+-		clear_evtchn(evtchn);
++		unmask_evtchn(evtchn);
+ }
+ 
+ static int retrigger_dynirq(unsigned int irq)
+@@ -1367,7 +1370,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ 	.mask		= disable_dynirq,
+ 	.unmask		= enable_dynirq,
+ 
+-	.ack		= ack_dynirq,
++	.eoi		= ack_dynirq,
+ 	.set_affinity	= set_affinity_irq,
+ 	.retrigger	= retrigger_dynirq,
+ };
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-only-unmask-irq-if-enabled.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-only-unmask-irq-if-enabled.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,36 @@
+From 935ded6b57d0bf6466e04946982b82c2dd3560b6 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Wed, 3 Nov 2010 16:40:48 -0400
+Subject: [PATCH 19/26] xen/events: only unmask irq if enabled
+
+A dynirq EOI is an unmask, but we should only unmask if the
+irq is logically enabled.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 2b1c9503c615f68262ae2e96ee26ee128b486287)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index e547c90..9ead93e 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1199,10 +1199,11 @@ int resend_irq_on_evtchn(unsigned int irq)
+ static void ack_dynirq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
++	struct irq_desc *desc = irq_to_desc(irq);
+ 
+ 	move_masked_irq(irq);
+ 
+-	if (VALID_EVTCHN(evtchn))
++	if (VALID_EVTCHN(evtchn) && !(desc->status & IRQ_DISABLED))
+ 		unmask_evtchn(evtchn);
+ }
+ 
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-use-PHYSDEVOP_pirq_eoi_gmfn-to-get-pirq-n.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-use-PHYSDEVOP_pirq_eoi_gmfn-to-get-pirq-n.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,160 @@
+From e3f489ab3865656743b5cb2dc1feb7cefc5f8108 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Fri, 3 Sep 2010 11:47:15 -0700
+Subject: [PATCH 11/26] xen/events: use PHYSDEVOP_pirq_eoi_gmfn to get pirq
+ need-EOI info
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 2390c371ecd32d9f06e22871636185382bf70ab7)
+
+Conflicts:
+
+	drivers/xen/events.c
+---
+ drivers/xen/events.c            |   43 +++++++++++++++++++++++++++++++++-----
+ include/xen/interface/physdev.h |   13 +++++++++++
+ 2 files changed, 50 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 220485c..7a18773 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -50,6 +50,7 @@
+ #include <xen/interface/event_channel.h>
+ #include <xen/interface/hvm/hvm_op.h>
+ #include <xen/interface/hvm/params.h>
++#include <xen/page.h>
+ 
+ #include "../pci/msi.h"
+ 
+@@ -102,9 +103,12 @@ struct irq_info
+ 		} pirq;
+ 	} u;
+ };
+-#define PIRQ_NEEDS_EOI	(1 << 0)
+ #define PIRQ_SHAREABLE	(1 << 1)
+ 
++/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */
++static bool pirq_eoi_does_unmask;
++static unsigned long *pirq_needs_eoi_bits;
++
+ static struct irq_info *irq_info;
+ 
+ static int *evtchn_to_irq;
+@@ -247,7 +251,7 @@ static bool pirq_needs_eoi(unsigned irq)
+ 
+ 	BUG_ON(info->type != IRQT_PIRQ);
+ 
+-	return info->u.pirq.flags & PIRQ_NEEDS_EOI;
++	return test_bit(info->u.pirq.gsi, pirq_needs_eoi_bits);
+ }
+ 
+ static inline unsigned long active_evtchns(unsigned int cpu,
+@@ -436,12 +440,17 @@ static void pirq_eoi(int irq)
+ {
+ 	struct irq_info *info = info_for_irq(irq);
+ 	struct physdev_eoi eoi = { .irq = info->u.pirq.gsi };
++	bool need_eoi;
++
++	need_eoi = pirq_needs_eoi(irq);
++
++	if (!need_eoi || !pirq_eoi_does_unmask)
++		unmask_evtchn(info->evtchn);
+ 
+-	if (pirq_needs_eoi(irq)) {
++	if (need_eoi) {
+ 		int rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
+ 		WARN_ON(rc);
+ 	}
+-	unmask_irq(irq);
+ }
+ 
+ static void pirq_query_unmask(int irq)
+@@ -449,15 +458,18 @@ static void pirq_query_unmask(int irq)
+ 	struct physdev_irq_status_query irq_status;
+ 	struct irq_info *info = info_for_irq(irq);
+ 
++	if (pirq_eoi_does_unmask)
++		return;
++
+ 	BUG_ON(info->type != IRQT_PIRQ);
+ 
+ 	irq_status.irq = info->u.pirq.gsi;
+ 	if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status))
+ 		irq_status.flags = 0;
+ 
+-	info->u.pirq.flags &= ~PIRQ_NEEDS_EOI;
++	clear_bit(info->u.pirq.gsi, pirq_needs_eoi_bits);
+ 	if (irq_status.flags & XENIRQSTAT_needs_eoi)
+-		info->u.pirq.flags |= PIRQ_NEEDS_EOI;
++		set_bit(info->u.pirq.gsi, pirq_needs_eoi_bits);
+ }
+ 
+ static bool probing_irq(int irq)
+@@ -1348,6 +1360,16 @@ void xen_irq_resume(void)
+ 		restore_cpu_virqs(cpu);
+ 		restore_cpu_ipis(cpu);
+ 	}
++
++	if (pirq_eoi_does_unmask) {
++		struct physdev_pirq_eoi_gmfn eoi_gmfn;
++		
++		eoi_gmfn.gmfn = virt_to_mfn(pirq_needs_eoi_bits);
++		if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) == 0) {
++			/* Could recover by reverting to old method...? */
++			BUG();
++		}
++	}
+ }
+ 
+ static struct irq_chip xen_dynamic_chip __read_mostly = {
+@@ -1442,6 +1464,8 @@ void xen_callback_vector(void)
+ void __init xen_init_IRQ(void)
+ {
+ 	int i;
++	struct physdev_pirq_eoi_gmfn eoi_gmfn;
++	int nr_pirqs = NR_IRQS;
+ 
+ 	cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s),
+ 				    GFP_KERNEL);
+@@ -1452,6 +1476,13 @@ void __init xen_init_IRQ(void)
+ 	for(i = 0; i < NR_EVENT_CHANNELS; i++)
+ 		evtchn_to_irq[i] = -1;
+ 
++	i = get_order(sizeof(unsigned long) * BITS_TO_LONGS(nr_pirqs));
++	pirq_needs_eoi_bits = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, i);
++
++ 	eoi_gmfn.gmfn = virt_to_mfn(pirq_needs_eoi_bits);
++	if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn) == 0)
++		pirq_eoi_does_unmask = true;
++
+ 	init_evtchn_cpu_bindings();
+ 
+ 	/* No event channels are 'live' right now. */
+diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
+index 66122aa..0703ef6 100644
+--- a/include/xen/interface/physdev.h
++++ b/include/xen/interface/physdev.h
+@@ -39,6 +39,19 @@ struct physdev_eoi {
+ };
+ 
+ /*
++ * Register a shared page for the hypervisor to indicate whether the guest
++ * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
++ * once the guest used this function in that the associated event channel
++ * will automatically get unmasked. The page registered is used as a bit
++ * array indexed by Xen's PIRQ value.
++ */
++#define PHYSDEVOP_pirq_eoi_gmfn         17
++struct physdev_pirq_eoi_gmfn {
++    /* IN */
++    unsigned long gmfn;
++};
++
++/*
+  * Query the status of an IRQ line.
+  * @arg == pointer to physdev_irq_status_query structure.
+  */
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-use-locked-set-clear_bit-for-cpu_evtchn_m.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-events-use-locked-set-clear_bit-for-cpu_evtchn_m.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,35 @@
+From a804dac82149db527b6c22460fa43ae4ab81a8c7 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Tue, 16 Nov 2010 14:56:47 -0800
+Subject: [PATCH 18/26] xen/events: use locked set|clear_bit() for
+ cpu_evtchn_mask
+
+The per-cpu event channel masks can be updated unlocked from multiple
+CPUs, so use the locked variant.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit b1a003a2aa9ee0d3d69237725c91839f4b6a8559)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 2664b8d..e547c90 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -272,8 +272,8 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
+ 	cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu));
+ #endif
+ 
+-	__clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq)));
+-	__set_bit(chn, cpu_evtchn_mask(cpu));
++	clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq)));
++	set_bit(chn, cpu_evtchn_mask(cpu));
+ 
+ 	irq_info[irq].cpu = cpu;
+ }
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-clear-secondary-CPUs-cpu_evtchn_mask-afte.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-clear-secondary-CPUs-cpu_evtchn_mask-afte.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,53 @@
+From 8ae869b215f04802a6805821b410ef7a6ea020a9 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich at novell.com>
+Date: Tue, 16 Nov 2010 14:55:33 -0800
+Subject: [PATCH 17/26] xen/evtchn: clear secondary CPUs' cpu_evtchn_mask[]
+ after restore
+
+To bind all event channels to CPU#0, it is not sufficient to set all
+of its cpu_evtchn_mask[] bits; all other CPUs also need to get their
+bits cleared. Otherwise, evtchn_do_upcall() will start handling
+interrupts on CPUs they're not intended to run on, which can be
+particularly bad for per-CPU ones.
+
+[ linux-2.6.18-xen.hg 7de7453dee36 ]
+
+Signed-off-by: Jan Beulich <jbeulich at novell.com>
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit cca68cf2d344eb3c4ff996e99f36cf8f8382bc2b)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 1dd1f29..2664b8d 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -280,9 +280,9 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
+ 
+ static void init_evtchn_cpu_bindings(void)
+ {
++	int i;
+ #ifdef CONFIG_SMP
+ 	struct irq_desc *desc;
+-	int i;
+ 
+ 	/* By default all event channels notify CPU#0. */
+ 	for_each_irq_desc(i, desc) {
+@@ -290,7 +290,10 @@ static void init_evtchn_cpu_bindings(void)
+ 	}
+ #endif
+ 
+-	memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s));
++	for_each_possible_cpu(i)
++		memset(cpu_evtchn_mask(i),
++		       (i == 0) ? ~0 : 0, sizeof(struct cpu_evtchn_s));
++
+ }
+ 
+ static inline void clear_evtchn(int port)
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-correction-pirq-hypercall-does-not-unmask.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-correction-pirq-hypercall-does-not-unmask.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,38 @@
+From 9fa393a287ae46785a0789086d4a3d3eda4d5059 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Fri, 3 Sep 2010 00:19:00 -0700
+Subject: [PATCH 10/26] xen/evtchn: correction, pirq hypercall does not unmask
+
+Unless one uses PHYSDEVOP_pirq_eoi_gmfn, which needs to be
+investigated.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit cb23e8d58ca35b6f9e10e1ea5682bd61f2442ebd)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 045313c..220485c 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -437,11 +437,11 @@ static void pirq_eoi(int irq)
+ 	struct irq_info *info = info_for_irq(irq);
+ 	struct physdev_eoi eoi = { .irq = info->u.pirq.gsi };
+ 
+-	if (unlikely(pirq_needs_eoi(irq))) {
++	if (pirq_needs_eoi(irq)) {
+ 		int rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
+ 		WARN_ON(rc);
+-	} else
+-		unmask_irq(irq);
++	}
++	unmask_irq(irq);
+ }
+ 
+ static void pirq_query_unmask(int irq)
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-make-pirq-enable-disable-unmask-mask.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-make-pirq-enable-disable-unmask-mask.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,54 @@
+From b8512b4c6715f0eb7ed0ce4e43ad9ef7ce4feb13 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Thu, 2 Sep 2010 21:33:07 -0700
+Subject: [PATCH 08/26] xen/evtchn: make pirq enable/disable unmask/mask
+
+PIRQ interrupts can be controlled with just mask/unmask.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit f4526f9a78ffb3d3fc9f81636c5b0357fc1beccd)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   17 ++++-------------
+ 1 files changed, 4 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 34e18a1..7241a20 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -510,15 +510,6 @@ static void shutdown_pirq(unsigned int irq)
+ 	info->evtchn = 0;
+ }
+ 
+-static void enable_pirq(unsigned int irq)
+-{
+-	startup_pirq(irq);
+-}
+-
+-static void disable_pirq(unsigned int irq)
+-{
+-}
+-
+ static void ack_pirq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+@@ -1391,11 +1382,11 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ 	.startup	= startup_pirq,
+ 	.shutdown	= shutdown_pirq,
+ 
+-	.enable		= enable_pirq,
+-	.unmask		= enable_pirq,
++	.enable		= unmask_irq,
++	.unmask		= unmask_irq,
+ 
+-	.disable	= disable_pirq,
+-	.mask		= disable_pirq,
++	.disable	= mask_irq,
++	.mask		= mask_irq,
+ 
+ 	.eoi		= ack_pirq,
+ 	.end		= end_pirq,
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-pirq_eoi-does-unmask.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-pirq_eoi-does-unmask.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,109 @@
+From a7bdd47532a8182eb9a6e46f03ff5f39d40ca4bb Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Thu, 2 Sep 2010 21:36:48 -0700
+Subject: [PATCH 09/26] xen/evtchn: pirq_eoi does unmask
+
+pirq_eoi() unmasks the event channel, so 1) there's no need to do it
+explicitly, and 2) don't do it before we're ready to unmask.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 43d8a5030a502074f3c4aafed4d6095ebd76067c)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   42 +++++++++++++++++++-----------------------
+ 1 files changed, 19 insertions(+), 23 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 7241a20..045313c 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -331,6 +331,14 @@ static void mask_evtchn(int port)
+ 	sync_set_bit(port, &s->evtchn_mask[0]);
+ }
+ 
++static void mask_irq(unsigned int irq)
++{
++	int evtchn = evtchn_from_irq(irq);
++
++	if (VALID_EVTCHN(evtchn))
++		mask_evtchn(evtchn);
++}
++
+ static void unmask_evtchn(int port)
+ {
+ 	struct shared_info *s = HYPERVISOR_shared_info;
+@@ -361,6 +369,14 @@ static void unmask_evtchn(int port)
+ 	put_cpu();
+ }
+ 
++static void unmask_irq(unsigned int irq)
++{
++	int evtchn = evtchn_from_irq(irq);
++
++	if (VALID_EVTCHN(evtchn))
++		unmask_evtchn(evtchn);
++}
++
+ static int get_nr_hw_irqs(void)
+ {
+ 	int ret = 1;
+@@ -424,7 +440,8 @@ static void pirq_eoi(int irq)
+ 	if (unlikely(pirq_needs_eoi(irq))) {
+ 		int rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
+ 		WARN_ON(rc);
+-	}
++	} else
++		unmask_irq(irq);
+ }
+ 
+ static void pirq_query_unmask(int irq)
+@@ -482,7 +499,6 @@ static unsigned int startup_pirq(unsigned int irq)
+ 	info->evtchn = evtchn;
+ 
+  out:
+-	unmask_evtchn(evtchn);
+ 	pirq_eoi(irq);
+ 
+ 	return 0;
+@@ -512,13 +528,9 @@ static void shutdown_pirq(unsigned int irq)
+ 
+ static void ack_pirq(unsigned int irq)
+ {
+-	int evtchn = evtchn_from_irq(irq);
+-
+-	pirq_eoi(irq);
+ 	move_masked_irq(irq);
+ 	
+-	if (VALID_EVTCHN(evtchn))
+-		unmask_evtchn(evtchn);
++	pirq_eoi(irq);
+ }
+ 
+ static void end_pirq(unsigned int irq)
+@@ -1169,22 +1181,6 @@ int resend_irq_on_evtchn(unsigned int irq)
+ 	return 1;
+ }
+ 
+-static void unmask_irq(unsigned int irq)
+-{
+-	int evtchn = evtchn_from_irq(irq);
+-
+-	if (VALID_EVTCHN(evtchn))
+-		unmask_evtchn(evtchn);
+-}
+-
+-static void mask_irq(unsigned int irq)
+-{
+-	int evtchn = evtchn_from_irq(irq);
+-
+-	if (VALID_EVTCHN(evtchn))
+-		mask_evtchn(evtchn);
+-}
+-
+ static void ack_dynirq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-rename-enable-disable_dynirq-unmask-mask_.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-rename-enable-disable_dynirq-unmask-mask_.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,67 @@
+From aaae59ca83940ed61563a8d9f7ba8674f72d885d Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Thu, 2 Sep 2010 21:25:10 -0700
+Subject: [PATCH 06/26] xen/evtchn: rename enable/disable_dynirq ->
+ unmask/mask_irq
+
+The functions are generic, so they may as well have generic names.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit d0936845a856816af2af48ddf019366be68e96ba)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   16 ++++++++--------
+ 1 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index d70e629..c0c69ff 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1178,7 +1178,7 @@ int resend_irq_on_evtchn(unsigned int irq)
+ 	return 1;
+ }
+ 
+-static void enable_dynirq(unsigned int irq)
++static void unmask_irq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+ 
+@@ -1186,7 +1186,7 @@ static void enable_dynirq(unsigned int irq)
+ 		unmask_evtchn(evtchn);
+ }
+ 
+-static void disable_dynirq(unsigned int irq)
++static void mask_irq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+ 
+@@ -1366,9 +1366,9 @@ void xen_irq_resume(void)
+ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ 	.name		= "xen-dyn",
+ 
+-	.disable	= disable_dynirq,
+-	.mask		= disable_dynirq,
+-	.unmask		= enable_dynirq,
++	.disable	= mask_irq,
++	.mask		= mask_irq,
++	.unmask		= unmask_irq,
+ 
+ 	.eoi		= ack_dynirq,
+ 	.set_affinity	= set_affinity_irq,
+@@ -1378,9 +1378,9 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ static struct irq_chip xen_percpu_chip __read_mostly = {
+ 	.name		= "xen-percpu",
+ 
+-	.disable	= disable_dynirq,
+-	.mask		= disable_dynirq,
+-	.unmask		= enable_dynirq,
++	.disable	= mask_irq,
++	.mask		= mask_irq,
++	.unmask		= unmask_irq,
+ 
+ 	.ack		= ack_dynirq,
+ };
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-rename-retrigger_dynirq-irq.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-evtchn-rename-retrigger_dynirq-irq.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,49 @@
+From 3acbfbcbe708a17fd0b6c20858205a6073595909 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Thu, 2 Sep 2010 21:29:34 -0700
+Subject: [PATCH 07/26] xen/evtchn: rename retrigger_dynirq -> irq
+
+It is just the generic mechanism for retriggering an event.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit c6a16a778f86699b339585ba5b9197035d77c40f)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index c0c69ff..34e18a1 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1204,7 +1204,7 @@ static void ack_dynirq(unsigned int irq)
+ 		unmask_evtchn(evtchn);
+ }
+ 
+-static int retrigger_dynirq(unsigned int irq)
++static int retrigger_irq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+ 	struct shared_info *sh = HYPERVISOR_shared_info;
+@@ -1372,7 +1372,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ 
+ 	.eoi		= ack_dynirq,
+ 	.set_affinity	= set_affinity_irq,
+-	.retrigger	= retrigger_dynirq,
++	.retrigger	= retrigger_irq,
+ };
+ 
+ static struct irq_chip xen_percpu_chip __read_mostly = {
+@@ -1402,7 +1402,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ 
+ 	.set_affinity	= set_affinity_irq,
+ 
+-	.retrigger	= retrigger_dynirq,
++	.retrigger	= retrigger_irq,
+ };
+ 
+ int xen_set_callback_via(uint64_t via)
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-improvements-to-VIRQ_DEBUG-output.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-improvements-to-VIRQ_DEBUG-output.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,126 @@
+From 349533f2ae30718f95cb210b918fae779f8abdd2 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ian.campbell at citrix.com>
+Date: Fri, 15 Oct 2010 11:52:46 +0100
+Subject: [PATCH 26/26] xen: improvements to VIRQ_DEBUG output
+
+* Fix bitmask formatting on 64 bit by specifying correct field widths.
+
+* Output both global and local masked and pending information.
+
+* Indicate in list of pending interrupts whether they are pending in
+  the L2, masked globally and/or masked locally.
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit d4283609c7504309b8b93d7582857ff4623105f3)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   78 ++++++++++++++++++++++++++++++++++++--------------
+ 1 files changed, 56 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 5006371..960a569 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -990,41 +990,75 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
+ {
+ 	struct shared_info *sh = HYPERVISOR_shared_info;
+ 	int cpu = smp_processor_id();
++	unsigned long *cpu_evtchn = cpu_evtchn_mask(cpu);
+ 	int i;
+ 	unsigned long flags;
+ 	static DEFINE_SPINLOCK(debug_lock);
++	struct vcpu_info *v;
+ 
+ 	spin_lock_irqsave(&debug_lock, flags);
+ 
+-	printk("vcpu %d\n  ", cpu);
++	printk("\nvcpu %d\n  ", cpu);
+ 
+ 	for_each_online_cpu(i) {
+-		struct vcpu_info *v = per_cpu(xen_vcpu, i);
+-		printk("%d: masked=%d pending=%d event_sel %08lx\n  ", i,
+-			(get_irq_regs() && i == cpu) ? xen_irqs_disabled(get_irq_regs()) : v->evtchn_upcall_mask,
+-			v->evtchn_upcall_pending,
+-			v->evtchn_pending_sel);
++		int pending;
++		v = per_cpu(xen_vcpu, i);
++		pending = (get_irq_regs() && i == cpu)
++			? xen_irqs_disabled(get_irq_regs())
++			: v->evtchn_upcall_mask;
++		printk("%d: masked=%d pending=%d event_sel %0*lx\n  ", i,
++		       pending, v->evtchn_upcall_pending,
++		       (int)(sizeof(v->evtchn_pending_sel)*2),
++		       v->evtchn_pending_sel);
++	}
++	v = per_cpu(xen_vcpu, cpu);
++
++	printk("\npending:\n   ");
++	for (i = ARRAY_SIZE(sh->evtchn_pending)-1; i >= 0; i--)
++		printk("%0*lx%s", (int)sizeof(sh->evtchn_pending[0])*2,
++		       sh->evtchn_pending[i],
++		       i % 8 == 0 ? "\n   " : " ");
++	printk("\nglobal mask:\n   ");
++	for (i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--)
++		printk("%0*lx%s",
++		       (int)(sizeof(sh->evtchn_mask[0])*2),
++		       sh->evtchn_mask[i],
++		       i % 8 == 0 ? "\n   " : " ");
++
++	printk("\nglobally unmasked:\n   ");
++	for (i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--)
++		printk("%0*lx%s", (int)(sizeof(sh->evtchn_mask[0])*2),
++		       sh->evtchn_pending[i] & ~sh->evtchn_mask[i],
++		       i % 8 == 0 ? "\n   " : " ");
++
++	printk("\nlocal cpu%d mask:\n   ", cpu);
++	for (i = (NR_EVENT_CHANNELS/BITS_PER_LONG)-1; i >= 0; i--)
++		printk("%0*lx%s", (int)(sizeof(cpu_evtchn[0])*2),
++		       cpu_evtchn[i],
++		       i % 8 == 0 ? "\n   " : " ");
++
++	printk("\nlocally unmasked:\n   ");
++	for (i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--) {
++		unsigned long pending = sh->evtchn_pending[i]
++			& ~sh->evtchn_mask[i]
++			& cpu_evtchn[i];
++		printk("%0*lx%s", (int)(sizeof(sh->evtchn_mask[0])*2),
++		       pending, i % 8 == 0 ? "\n   " : " ");
+ 	}
+-	printk("pending:\n   ");
+-	for(i = ARRAY_SIZE(sh->evtchn_pending)-1; i >= 0; i--)
+-		printk("%08lx%s", sh->evtchn_pending[i],
+-			i % 8 == 0 ? "\n   " : " ");
+-	printk("\nmasks:\n   ");
+-	for(i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--)
+-		printk("%08lx%s", sh->evtchn_mask[i],
+-			i % 8 == 0 ? "\n   " : " ");
+-
+-	printk("\nunmasked:\n   ");
+-	for(i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--)
+-		printk("%08lx%s", sh->evtchn_pending[i] & ~sh->evtchn_mask[i],
+-			i % 8 == 0 ? "\n   " : " ");
+ 
+ 	printk("\npending list:\n");
+-	for(i = 0; i < NR_EVENT_CHANNELS; i++) {
++	for (i = 0; i < NR_EVENT_CHANNELS; i++) {
+ 		if (sync_test_bit(i, sh->evtchn_pending)) {
+-			printk("  %d: event %d -> irq %d\n",
++			int word_idx = i / BITS_PER_LONG;
++			printk("  %d: event %d -> irq %d%s%s%s\n",
+ 			       cpu_from_evtchn(i), i,
+-			       evtchn_to_irq[i]);
++			       evtchn_to_irq[i],
++			       sync_test_bit(word_idx, &v->evtchn_pending_sel)
++					     ? "" : " l2-clear",
++			       !sync_test_bit(i, sh->evtchn_mask)
++					     ? "" : " globally-masked",
++			       sync_test_bit(i, cpu_evtchn)
++					     ? "" : " locally-masked");
+ 		}
+ 	}
+ 
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-make-pirq-interrupts-use-fasteoi.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-make-pirq-interrupts-use-fasteoi.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,57 @@
+From 64ec94ce6d00f132d27579b954777b4fafec2e57 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Mon, 30 Aug 2010 16:44:53 -0700
+Subject: [PATCH 05/26] xen: make pirq interrupts use fasteoi
+
+Use handle_fasteoi_irq for pirq interrupts to match the other Xen
+interrupts.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 2789ef00cbe2cdb38deb30ee4085b88befadb1b0)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   12 ++++++------
+ 1 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 3561d1d..d70e629 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -523,11 +523,11 @@ static void ack_pirq(unsigned int irq)
+ {
+ 	int evtchn = evtchn_from_irq(irq);
+ 
+-	move_native_irq(irq);
+-
+-	if (VALID_EVTCHN(evtchn))
+-		clear_evtchn(evtchn);
+ 	pirq_eoi(irq);
++	move_masked_irq(irq);
++	
++	if (VALID_EVTCHN(evtchn))
++		unmask_evtchn(evtchn);
+ }
+ 
+ static void end_pirq(unsigned int irq)
+@@ -592,7 +592,7 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name)
+ 		irq = find_unbound_irq();
+ 
+ 	set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
+-				      handle_edge_irq, name);
++				      handle_fasteoi_irq, name);
+ 
+ 	irq_op.irq = gsi;
+ 	irq_op.vector = 0;
+@@ -1397,7 +1397,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ 	.disable	= disable_pirq,
+ 	.mask		= disable_pirq,
+ 
+-	.ack		= ack_pirq,
++	.eoi		= ack_pirq,
+ 	.end		= end_pirq,
+ 
+ 	.set_affinity	= set_affinity_irq,
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-do-EOI-properly-for-pirq-events.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-do-EOI-properly-for-pirq-events.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,61 @@
+From ed0fe1342452354c4e81a546c2947c62ef2e6fd5 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Mon, 23 Aug 2010 21:12:03 -0700
+Subject: [PATCH 02/26] xen/pirq: do EOI properly for pirq events
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit f61692642a2a2b83a52dd7e64619ba3bb29998af)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   12 +++++-------
+ 1 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index ae82e08..f5cfa2b 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -420,7 +420,7 @@ static bool identity_mapped_irq(unsigned irq)
+ 	return irq < get_nr_hw_irqs();
+ }
+ 
+-static void pirq_unmask_notify(int irq)
++static void pirq_eoi(int irq)
+ {
+ 	struct irq_info *info = info_for_irq(irq);
+ 	struct physdev_eoi eoi = { .irq = info->u.pirq.gsi };
+@@ -487,7 +487,7 @@ static unsigned int startup_pirq(unsigned int irq)
+ 
+  out:
+ 	unmask_evtchn(evtchn);
+-	pirq_unmask_notify(irq);
++	pirq_eoi(irq);
+ 
+ 	return 0;
+ }
+@@ -529,10 +529,9 @@ static void ack_pirq(unsigned int irq)
+ 
+ 	move_native_irq(irq);
+ 
+-	if (VALID_EVTCHN(evtchn)) {
+-		mask_evtchn(evtchn);
++	if (VALID_EVTCHN(evtchn))
+ 		clear_evtchn(evtchn);
+-	}
++	pirq_eoi(irq);
+ }
+ 
+ static void end_pirq(unsigned int irq)
+@@ -547,8 +546,7 @@ static void end_pirq(unsigned int irq)
+ 	    (IRQ_DISABLED|IRQ_PENDING)) {
+ 		shutdown_pirq(irq);
+ 	} else if (VALID_EVTCHN(evtchn)) {
+-		unmask_evtchn(evtchn);
+-		pirq_unmask_notify(irq);
++		pirq_eoi(irq);
+ 	}
+ }
+ 
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-use-eoi-as-enable.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-use-eoi-as-enable.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,31 @@
+From efb773a94d4fea8ef727b26b201274831b7205d9 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Fri, 3 Sep 2010 17:05:14 -0700
+Subject: [PATCH 12/26] xen/pirq: use eoi as enable
+
+Might work...
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit 158d6550716687486000a828c601706b55322ad0)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 7a18773..0ed6d1c 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1400,7 +1400,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ 	.startup	= startup_pirq,
+ 	.shutdown	= shutdown_pirq,
+ 
+-	.enable		= unmask_irq,
++	.enable		= pirq_eoi,
+ 	.unmask		= unmask_irq,
+ 
+ 	.disable	= mask_irq,
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-use-fasteoi-for-MSI-too.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-pirq-use-fasteoi-for-MSI-too.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,31 @@
+From 4829eb44d5c9e0024297701ba8205c315989df03 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Tue, 7 Sep 2010 11:15:27 +1000
+Subject: [PATCH 13/26] xen/pirq: use fasteoi for MSI too
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit d2ea486300ca6e207ba178a425fbd023b8621bb1)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 0ed6d1c..948c437 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -716,8 +716,8 @@ int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
+ 		irq_info[irq].u.pirq.domid = domid;
+ 
+ 	set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
+-			handle_edge_irq,
+-			(type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
++				      handle_fasteoi_irq,
++				      (type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
+ 
+ out:
+ 	spin_unlock(&irq_mapping_update_lock);
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-set-up-IRQ-before-binding-virq-to-evtchn.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-set-up-IRQ-before-binding-virq-to-evtchn.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,46 @@
+From 74f58843fc7105634a7491c433bd1957768b5e87 Mon Sep 17 00:00:00 2001
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+Date: Wed, 22 Sep 2010 15:28:52 -0700
+Subject: [PATCH 15/26] xen: set up IRQ before binding virq to evtchn
+
+Make sure the irq is set up before binding a virq event channel to it.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
+(cherry picked from commit e05885b24a55db82fbdb5cbc3f31426b976d7fc1)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index 5191db7..1941384 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -821,6 +821,11 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
+ 	irq = per_cpu(virq_to_irq, cpu)[virq];
+ 
+ 	if (irq == -1) {
++		irq = find_unbound_irq();
++
++		set_irq_chip_and_handler_name(irq, &xen_percpu_chip,
++					      handle_percpu_irq, "virq");
++
+ 		bind_virq.virq = virq;
+ 		bind_virq.vcpu = cpu;
+ 		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
+@@ -828,11 +833,6 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
+ 			BUG();
+ 		evtchn = bind_virq.port;
+ 
+-		irq = find_unbound_irq();
+-
+-		set_irq_chip_and_handler_name(irq, &xen_percpu_chip,
+-					      handle_percpu_irq, "virq");
+-
+ 		evtchn_to_irq[evtchn] = irq;
+ 		irq_info[irq] = mk_virq_info(evtchn, virq);
+ 
+-- 
+1.7.5.4
+

Added: dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-use-dynamic_irq_init_keep_chip_data.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/features/all/xen/xen-use-dynamic_irq_init_keep_chip_data.patch	Sat Dec 10 17:00:46 2011	(r18375)
@@ -0,0 +1,48 @@
+From c8cca54b8e84e901ae36b0b9dd746a23dd62739e Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ian.campbell at citrix.com>
+Date: Thu, 19 Aug 2010 11:56:59 +0100
+Subject: [PATCH 03/26] xen: use dynamic_irq_init_keep_chip_data
+
+This synchronises with what went upstream in:
+commit 99ad198c4978036bb9f7ebd11618b225b77046da
+Author: Stefano Stabellini <stefano.stabellini at eu.citrix.com>
+Date:   Fri May 14 12:41:20 2010 +0100
+
+    xen: Fix find_unbound_irq in presence of ioapic irqs.
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+Cc: Stefano Stabellini <stefano.stabellini at eu.citrix.com>
+(cherry picked from commit 9fa90aa72d6af5cc2c2eddf56f9a586035e13ae7)
+
+Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
+---
+ drivers/xen/events.c |    6 +-----
+ 1 files changed, 1 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index f5cfa2b..181a254 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -377,7 +377,6 @@ static int find_unbound_irq(void)
+ 	int irq;
+ 	struct irq_desc *desc;
+ 	int start = get_nr_hw_irqs();
+-	void *chip_data;
+ 
+ 	if (start == nr_irqs)
+ 		goto no_irqs;
+@@ -403,10 +402,7 @@ static int find_unbound_irq(void)
+ 	if (WARN_ON(desc == NULL))
+ 		return -1;
+ 
+-	/* save and restore chip_data */
+-	chip_data = desc->chip_data;
+-	dynamic_irq_init(irq);
+-	desc->chip_data = chip_data;
++	dynamic_irq_init_keep_chip_data(irq);
+ 
+ 	return irq;
+ 
+-- 
+1.7.5.4
+

Modified: dists/squeeze/linux-2.6/debian/patches/series/40-extra
==============================================================================
--- dists/squeeze/linux-2.6/debian/patches/series/40-extra	Sat Dec 10 14:46:00 2011	(r18374)
+++ dists/squeeze/linux-2.6/debian/patches/series/40-extra	Sat Dec 10 17:00:46 2011	(r18375)
@@ -40,3 +40,30 @@
 + features/all/xen/x86-mm-Fix-incorrect-data-type-in-vmalloc_sync_all.patch featureset=xen
 + features/all/xen/vmalloc-eagerly-clear-ptes-on-vunmap.patch featureset=xen
 + features/all/xen/x86-mm-Fix-pgd_lock-deadlock.patch featureset=xen
+
++ features/all/xen/xen-apic-use-handle_edge_irq-for-pirq-events.patch featureset=xen
++ features/all/xen/xen-pirq-do-EOI-properly-for-pirq-events.patch featureset=xen
++ features/all/xen/xen-use-dynamic_irq_init_keep_chip_data.patch featureset=xen
++ features/all/xen/xen-events-change-to-using-fasteoi.patch featureset=xen
++ features/all/xen/xen-make-pirq-interrupts-use-fasteoi.patch featureset=xen
++ features/all/xen/xen-evtchn-rename-enable-disable_dynirq-unmask-mask_.patch featureset=xen
++ features/all/xen/xen-evtchn-rename-retrigger_dynirq-irq.patch featureset=xen
++ features/all/xen/xen-evtchn-make-pirq-enable-disable-unmask-mask.patch featureset=xen
++ features/all/xen/xen-evtchn-pirq_eoi-does-unmask.patch featureset=xen
++ features/all/xen/xen-evtchn-correction-pirq-hypercall-does-not-unmask.patch featureset=xen
++ features/all/xen/xen-events-use-PHYSDEVOP_pirq_eoi_gmfn-to-get-pirq-n.patch featureset=xen
++ features/all/xen/xen-pirq-use-eoi-as-enable.patch featureset=xen
++ features/all/xen/xen-pirq-use-fasteoi-for-MSI-too.patch featureset=xen
++ features/all/xen/xen-apic-fix-pirq_eoi_gmfn-resume.patch featureset=xen
++ features/all/xen/xen-set-up-IRQ-before-binding-virq-to-evtchn.patch featureset=xen
++ features/all/xen/xen-correct-parameter-type-for-pirq_eoi.patch featureset=xen
++ features/all/xen/xen-evtchn-clear-secondary-CPUs-cpu_evtchn_mask-afte.patch featureset=xen
++ features/all/xen/xen-events-use-locked-set-clear_bit-for-cpu_evtchn_m.patch featureset=xen
++ features/all/xen/xen-events-only-unmask-irq-if-enabled.patch featureset=xen
++ features/all/xen/xen-events-Process-event-channels-notifications-in-r.patch featureset=xen
++ features/all/xen/xen-events-Make-last-processed-event-channel-a-per-c.patch featureset=xen
++ features/all/xen/xen-events-Clean-up-round-robin-evtchn-scan.patch featureset=xen
++ features/all/xen/xen-events-Make-round-robin-scan-fairer-by-snapshott.patch featureset=xen
++ features/all/xen/xen-events-Remove-redundant-clear-of-l2i-at-end-of-r.patch featureset=xen
++ features/all/xen/xen-do-not-try-to-allocate-the-callback-vector-again.patch featureset=xen
++ features/all/xen/xen-improvements-to-VIRQ_DEBUG-output.patch featureset=xen



More information about the Kernel-svn-changes mailing list