xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	James Harper <james.harper@bendigoit.com.au>,
	Ian Campbell <ian.campbell@citrix.com>,
	Ian Campbell <ian.campbell@xensource.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Keir Fraser <keir.xen@gmail.com>
Subject: [PATCH 2/5] xen: events: Make last processed event channel a per-cpu variable.
Date: Thu,  3 Mar 2011 17:10:12 +0000	[thread overview]
Message-ID: <1299172215-29470-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1299172198.6552.14.camel@zakaz.uk.xensource.com>

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
[ijc: forward ported from linux-2.6.18-xen.hg 325:b2768401db94]
---
 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 75cc6f5..1fc3192 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -1026,6 +1026,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
@@ -1043,8 +1045,6 @@ static DEFINE_PER_CPU(unsigned, xed_nesting_count);
  */
 static void __xen_evtchn_do_upcall(void)
 {
-	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;
@@ -1065,8 +1065,8 @@ static void __xen_evtchn_do_upcall(void)
 #endif
 		pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
 
-		word_idx = last_word_idx;
-		bit_idx = last_bit_idx;
+		word_idx = __this_cpu_read(last_word_idx);
+		bit_idx = __this_cpu_read(last_bit_idx);
 
 		while (pending_words != 0) {
 			unsigned long pending_bits;
@@ -1121,9 +1121,8 @@ static void __xen_evtchn_do_upcall(void)
 				 * 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;
-
+				__this_cpu_write(last_word_idx, word_idx);
+				__this_cpu_write(last_bit_idx, bit_idx);
 			} while (bit_idx != BITS_PER_LONG - 1);
 
 			pending_bits = active_evtchns(cpu, s, word_idx);
-- 
1.5.6.5

  parent reply	other threads:[~2011-03-03 17:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  2:25 unfair servicing of DomU vbd requests James Harper
2011-03-03  7:29 ` Keir Fraser
2011-03-03  8:22   ` Ian Campbell
2011-03-03  8:28     ` James Harper
2011-03-03  8:30       ` Keir Fraser
2011-03-03 17:09         ` [GIT/PATCH 0/5] " Ian Campbell
2011-03-03 17:10           ` [PATCH 1/5] xen: events: Process event channels notifications in round-robin order Ian Campbell
2011-03-03 17:10           ` Ian Campbell [this message]
2011-03-09 20:32             ` [PATCH 2/5] xen: events: Make last processed event channel a per-cpu variable Konrad Rzeszutek Wilk
2011-03-09 20:40               ` Ian Campbell
2011-03-09 20:47                 ` Jeremy Fitzhardinge
2011-03-10  8:30                   ` Ian Campbell
2011-03-11 17:46                     ` Jeremy Fitzhardinge
2011-03-03 17:10           ` [PATCH 3/5] xen: events: Clean up round-robin evtchn scan Ian Campbell
2011-03-03 17:10           ` [PATCH 4/5] xen: events: Make round-robin scan fairer by snapshotting each l2 word Ian Campbell
2011-03-03 17:10           ` [PATCH 5/5] xen: events: Remove redundant clear of l2i at end of round-robin loop Ian Campbell
2011-03-04  8:40           ` [GIT/PATCH 0/5] Re: unfair servicing of DomU vbd requests John Weekes
2011-03-04  9:15             ` Ian Campbell
2011-03-07 19:33               ` John Weekes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1299172215-29470-2-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.campbell@xensource.com \
    --cc=james.harper@bendigoit.com.au \
    --cc=jeremy@goop.org \
    --cc=keir.xen@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).