Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 4317

kernel-2.6.18-194.11.1.el5.src.rpm

From: Tetsu Yamamoto <tyamamot@redhat.com>
Date: Tue, 12 Aug 2008 16:07:18 -0400
Subject: [xen] make last processed event channel a per-cpu var
Message-id: 20080812200718.4832.72936.sendpatchset@pq0-1.lab.bos.redhat.com
O-Subject: [RHEL5.3 PATCH 4/7] xen: Make last processed event channel a per-cpu variable
Bugzilla: 456171
RH-Acked-by: Chris Lalancette <clalance@redhat.com>
RH-Acked-by: Bill Burns <bburns@redhat.com>

bz456171
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1196671812 0
# Node ID b2768401db943e66af9d64bd610ffa225f560c0b
# Parent  7fe1c6d02a2bd8d38b6a8b529f166990e4cd1dc3
Make last processed event channel a per-cpu variable.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>

diff --git a/drivers/xen/core/evtchn.c b/drivers/xen/core/evtchn.c
index c611d94..9a860b2 100644
--- a/drivers/xen/core/evtchn.c
+++ b/drivers/xen/core/evtchn.c
@@ -208,6 +208,8 @@ void force_evtchn_callback(void)
 EXPORT_SYMBOL(force_evtchn_callback);
 
 static DEFINE_PER_CPU(unsigned int, upcall_count) = { 0 };
+static DEFINE_PER_CPU(unsigned int, last_processed_l1i) = { BITS_PER_LONG - 1 };
+static DEFINE_PER_CPU(unsigned int, last_processed_l2i) = { BITS_PER_LONG - 1 };
 
 /* NB. Interrupts are disabled on entry. */
 asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
@@ -215,7 +217,6 @@ asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
 	unsigned long       l1, l2;
 	unsigned long       masked_l1, masked_l2;
 	unsigned int        l1i, l2i, port, count;
-	static unsigned int last_processed_l1i = BITS_PER_LONG - 1, last_processed_l2i = BITS_PER_LONG - 1;
 	int                 irq, cpu = smp_processor_id();
 	shared_info_t      *s = HYPERVISOR_shared_info;
 	vcpu_info_t        *vcpu_info = &s->vcpu_info[cpu];
@@ -235,8 +236,8 @@ asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
 #endif
 		l1 = xchg(&vcpu_info->evtchn_pending_sel, 0);
 
-		l1i = last_processed_l1i;
-		l2i = last_processed_l2i;
+		l1i = per_cpu(last_processed_l1i, cpu);
+		l2i = per_cpu(last_processed_l2i, cpu);
 
 		while (l1 != 0) {
 
@@ -273,8 +274,8 @@ asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
 				}
 
 				/* if this is the final port processed, we'll pick up here+1 next time */
-				last_processed_l1i = l1i;
-				last_processed_l2i = l2i;
+				per_cpu(last_processed_l1i, cpu) = l1i;
+				per_cpu(last_processed_l2i, cpu) = l2i;
 
 			} while (l2i != BITS_PER_LONG - 1);