From: Kouya Shimura Subject: [PATCH] linux/evtchn: Add memory barriers to evtchn ring accesses. Date: Tue, 22 Jul 2008 16:30:36 +0900 Message-ID: <7kljzu4bqb.fsf@pingu.sky.yk.fujitsu.co.jp> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Qo1QuXaweN" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --Qo1QuXaweN Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit Xenstore infrequently hangs up on IA64. Actually the xenstored is still alive but no response from xenstore-XXX commands. After tracking down, I've found that evtchn_read() infrequently returns a wrong evtchn port number and evtchn_write() never unmask the exact port. This patch fixes it. Thanks, Kouya Signed-off-by: Kouya Shimura --Qo1QuXaweN Content-Type: text/plain Content-Disposition: inline; filename="evtchn.patch" Content-Transfer-Encoding: 7bit diff -r 5644f68a7912 drivers/xen/evtchn/evtchn.c --- a/drivers/xen/evtchn/evtchn.c Wed Jul 16 13:51:36 2008 +0100 +++ b/drivers/xen/evtchn/evtchn.c Thu Jul 17 16:21:09 2008 +0900 @@ -84,6 +84,7 @@ if ((u = port_user[port]) != NULL) { if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) { u->ring[EVTCHN_RING_MASK(u->ring_prod)] = port; + wmb(); /* Ensure ring contents visible */ if (u->ring_cons == u->ring_prod++) { wake_up_interruptible(&u->evtchn_wait); kill_fasync(&u->evtchn_async_queue, @@ -180,6 +181,7 @@ } rc = -EFAULT; + rmb(); /* Ensure that we see the port before we copy it. */ if (copy_to_user(buf, &u->ring[EVTCHN_RING_MASK(c)], bytes1) || ((bytes2 != 0) && copy_to_user(&buf[bytes1], &u->ring[0], bytes2))) --Qo1QuXaweN Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Qo1QuXaweN--