Skip to content

Commit 8193101

Browse files
Davidlohr Buesomstsirkin
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]>
1 parent 8aeac42 commit 8193101

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tools/virtio/ringtest/main.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ static inline void busy_wait(void)
140140
#define smp_wmb() smp_release()
141141
#endif
142142

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-
149143
static __always_inline
150144
void __read_once_size(const volatile void *p, void *res, int size)
151145
{
@@ -175,13 +169,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
175169
}
176170
}
177171

172+
#ifdef __alpha__
178173
#define READ_ONCE(x) \
179174
({ \
180175
union { typeof(x) __val; char __c[1]; } __u; \
181176
__read_once_size(&(x), __u.__c, sizeof(x)); \
182-
smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
177+
smp_mb(); /* Enforce dependency ordering from x */ \
183178
__u.__val; \
184179
})
180+
#else
181+
#define READ_ONCE(x) \
182+
({ \
183+
union { typeof(x) __val; char __c[1]; } __u; \
184+
__read_once_size(&(x), __u.__c, sizeof(x)); \
185+
__u.__val; \
186+
})
187+
#endif
185188

186189
#define WRITE_ONCE(x, val) \
187190
({ \

0 commit comments

Comments
 (0)