]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.27.14/sgi-xpc-ensure-flags-are-updated-before-bte_copy.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.27.14 / sgi-xpc-ensure-flags-are-updated-before-bte_copy.patch
CommitLineData
5861a31d
GKH
1From 69b3bb65fa97a1e8563518dbbc35cd57beefb2d4 Mon Sep 17 00:00:00 2001
2From: Robin Holt <holt@sgi.com>
3Date: Thu, 29 Jan 2009 14:25:06 -0800
4Subject: sgi-xpc: ensure flags are updated before bte_copy
5
6From: Robin Holt <holt@sgi.com>
7
8commit 69b3bb65fa97a1e8563518dbbc35cd57beefb2d4 upstream.
9
10The clearing of the msg->flags needs a barrier between it and the notify
11of the channel threads that the messages are cleaned and ready for use.
12
13Signed-off-by: Robin Holt <holt@sgi.com>
14Signed-off-by: Dean Nelson <dcn@sgi.com>
15Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
16Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18
19---
20 drivers/misc/sgi-xp/xpc_sn2.c | 9 +++++----
21 drivers/misc/sgi-xp/xpc_uv.c | 2 +-
22 2 files changed, 6 insertions(+), 5 deletions(-)
23
24--- a/drivers/misc/sgi-xp/xpc_sn2.c
25+++ b/drivers/misc/sgi-xp/xpc_sn2.c
26@@ -1841,6 +1841,7 @@ xpc_process_msg_chctl_flags_sn2(struct x
27 */
28 xpc_clear_remote_msgqueue_flags_sn2(ch);
29
30+ smp_wmb(); /* ensure flags have been cleared before bte_copy */
31 ch_sn2->w_remote_GP.put = ch_sn2->remote_GP.put;
32
33 dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, "
34@@ -1939,7 +1940,7 @@ xpc_get_deliverable_payload_sn2(struct x
35 break;
36
37 get = ch_sn2->w_local_GP.get;
38- rmb(); /* guarantee that .get loads before .put */
39+ smp_rmb(); /* guarantee that .get loads before .put */
40 if (get == ch_sn2->w_remote_GP.put)
41 break;
42
43@@ -2058,7 +2059,7 @@ xpc_allocate_msg_sn2(struct xpc_channel
44 while (1) {
45
46 put = ch_sn2->w_local_GP.put;
47- rmb(); /* guarantee that .put loads before .get */
48+ smp_rmb(); /* guarantee that .put loads before .get */
49 if (put - ch_sn2->w_remote_GP.get < ch->local_nentries) {
50
51 /* There are available message entries. We need to try
52@@ -2191,7 +2192,7 @@ xpc_send_payload_sn2(struct xpc_channel
53 * The preceding store of msg->flags must occur before the following
54 * load of local_GP->put.
55 */
56- mb();
57+ smp_mb();
58
59 /* see if the message is next in line to be sent, if so send it */
60
61@@ -2292,7 +2293,7 @@ xpc_received_payload_sn2(struct xpc_chan
62 * The preceding store of msg->flags must occur before the following
63 * load of local_GP->get.
64 */
65- mb();
66+ smp_mb();
67
68 /*
69 * See if this message is next in line to be acknowledged as having
70--- a/drivers/misc/sgi-xp/xpc_uv.c
71+++ b/drivers/misc/sgi-xp/xpc_uv.c
72@@ -1238,7 +1238,7 @@ xpc_send_payload_uv(struct xpc_channel *
73 atomic_inc(&ch->n_to_notify);
74
75 msg_slot->key = key;
76- wmb(); /* a non-NULL func must hit memory after the key */
77+ smp_wmb(); /* a non-NULL func must hit memory after the key */
78 msg_slot->func = func;
79
80 if (ch->flags & XPC_C_DISCONNECTING) {