Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/virtio: remove smp_read_barrier_depends()

This gets rid of the last references to smp_read_barrier_depends()
which for the kernel side was removed in v5.9. The serialization
required for Alpha is done inside READ_ONCE() instead of having
users deal with it. Simply use a full barrier, the architecture
does not have rmb in the first place.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Message-Id: <20221128034347.990-3-dave@stgolabs.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>

authored by

Davidlohr Bueso and committed by
Michael S. Tsirkin
81931012 8aeac42d

+10 -7
+10 -7
tools/virtio/ringtest/main.h
··· 140 140 #define smp_wmb() smp_release() 141 141 #endif 142 142 143 - #ifdef __alpha__ 144 - #define smp_read_barrier_depends() smp_acquire() 145 - #else 146 - #define smp_read_barrier_depends() do {} while(0) 147 - #endif 148 - 149 143 static __always_inline 150 144 void __read_once_size(const volatile void *p, void *res, int size) 151 145 { ··· 169 175 } 170 176 } 171 177 178 + #ifdef __alpha__ 172 179 #define READ_ONCE(x) \ 173 180 ({ \ 174 181 union { typeof(x) __val; char __c[1]; } __u; \ 175 182 __read_once_size(&(x), __u.__c, sizeof(x)); \ 176 - smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \ 183 + smp_mb(); /* Enforce dependency ordering from x */ \ 177 184 __u.__val; \ 178 185 }) 186 + #else 187 + #define READ_ONCE(x) \ 188 + ({ \ 189 + union { typeof(x) __val; char __c[1]; } __u; \ 190 + __read_once_size(&(x), __u.__c, sizeof(x)); \ 191 + __u.__val; \ 192 + }) 193 + #endif 179 194 180 195 #define WRITE_ONCE(x, val) \ 181 196 ({ \