Commit f29e544
rds: ib: Simplify ib_ring and use atomic ops
The original struct rds_ib_work_ring was implemented using double set
of counters / pointers for the consumer and producer of the ring. It
is complicated and error prone, due to the compilers ability to
re-order execution of the statements and moderns CPUs ability to
re-order execution. Hence, use only a single set of free-running
counters and use only atomic ops, which do not rely on explicit memory
barriers.
Without this commit, we will encounter the following BUG_ON() running
uek7/ga (v5.15.0-0.30.9) on ARM:
kernel BUG at net/rds/ib_send.c:886!
Internal error: Oops - BUG: 0 [#1] SMP
[]
rds_ib_xmit+0xa1c/0xb70 [rds_rdma]
rds_send_xmit+0x4a0/0xd50 [rds]
rds_sendmsg+0xe7c/0xfa0 [rds]
sock_sendmsg+0x74/0x80
____sys_sendmsg+0x270/0x29c
___sys_sendmsg+0xb0/0x118
__sys_sendmsg+0x90/0x104
__arm64_sys_sendmsg+0x30/0x50
invoke_syscall+0x50/0x15c
The bug may also manifest itself as:
kernel: RDS/IB: ib_post_send to ::ffff:192.168.0.4 returned -22
or as:
kernel: RDS/IB: rds_ib_send_unmap_op: unexpected opcode 0xdead in WR!
Orabug: 34137460
Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>
Fixes: f528efe ("RDS/IB: Ring-handling code.")
Tested-by: Gerald Gibson <[email protected]>
Signed-off-by: Håkon Bugge <[email protected]>1 parent 9ffbe20 commit f29e544
3 files changed
+35
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
904 | 904 | | |
905 | 905 | | |
906 | 906 | | |
907 | | - | |
908 | | - | |
909 | | - | |
| 907 | + | |
| 908 | + | |
910 | 909 | | |
911 | 910 | | |
912 | 911 | | |
913 | 912 | | |
914 | 913 | | |
915 | 914 | | |
916 | | - | |
917 | | - | |
918 | | - | |
| 915 | + | |
| 916 | + | |
919 | 917 | | |
920 | 918 | | |
921 | 919 | | |
| |||
978 | 976 | | |
979 | 977 | | |
980 | 978 | | |
981 | | - | |
982 | | - | |
983 | | - | |
| 979 | + | |
| 980 | + | |
984 | 981 | | |
985 | 982 | | |
986 | 983 | | |
987 | 984 | | |
988 | 985 | | |
989 | 986 | | |
990 | | - | |
991 | | - | |
992 | | - | |
| 987 | + | |
| 988 | + | |
993 | 989 | | |
994 | 990 | | |
995 | 991 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 204 | + | |
| 205 | + | |
208 | 206 | | |
209 | 207 | | |
210 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 75 | + | |
81 | 76 | | |
82 | 77 | | |
83 | 78 | | |
| |||
99 | 94 | | |
100 | 95 | | |
101 | 96 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 97 | | |
106 | | - | |
107 | | - | |
| 98 | + | |
108 | 99 | | |
109 | | - | |
110 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
111 | 103 | | |
112 | 104 | | |
113 | 105 | | |
114 | 106 | | |
115 | 107 | | |
116 | 108 | | |
117 | 109 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
121 | 114 | | |
122 | 115 | | |
123 | 116 | | |
124 | 117 | | |
125 | | - | |
126 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
127 | 121 | | |
128 | 122 | | |
129 | 123 | | |
| |||
142 | 136 | | |
143 | 137 | | |
144 | 138 | | |
145 | | - | |
| 139 | + | |
146 | 140 | | |
147 | 141 | | |
148 | 142 | | |
| |||
0 commit comments