]>
Commit | Line | Data |
---|---|---|
5861a31d GKH |
1 | From 69b3bb65fa97a1e8563518dbbc35cd57beefb2d4 Mon Sep 17 00:00:00 2001 |
2 | From: Robin Holt <holt@sgi.com> | |
3 | Date: Thu, 29 Jan 2009 14:25:06 -0800 | |
4 | Subject: sgi-xpc: ensure flags are updated before bte_copy | |
5 | ||
6 | From: Robin Holt <holt@sgi.com> | |
7 | ||
8 | commit 69b3bb65fa97a1e8563518dbbc35cd57beefb2d4 upstream. | |
9 | ||
10 | The clearing of the msg->flags needs a barrier between it and the notify | |
11 | of the channel threads that the messages are cleaned and ready for use. | |
12 | ||
13 | Signed-off-by: Robin Holt <holt@sgi.com> | |
14 | Signed-off-by: Dean Nelson <dcn@sgi.com> | |
15 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
16 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
17 | Signed-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) { |