* [PATCH 0/2] tools/virtio: remove smp_read_barrier_depends()
@ 2022-11-28 3:43 ` Davidlohr Bueso
0 siblings, 0 replies; 10+ messages in thread
From: Davidlohr Bueso @ 2022-11-28 3:43 UTC (permalink / raw)
To: mst; +Cc: virtualization, linux-kernel, dave
Hi,
To my surprise, this call is still git-greppable in the
tree, the kernel having gotten rid of it a while back.
Thanks!
Davidlohr Bueso (2):
tools/virtio: remove stray characters
tools/virtio: remove smp_read_barrier_depends()
tools/virtio/ringtest/main.h | 37 +++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/2] tools/virtio: remove smp_read_barrier_depends()
@ 2022-11-28 3:43 ` Davidlohr Bueso
0 siblings, 0 replies; 10+ messages in thread
From: Davidlohr Bueso @ 2022-11-28 3:43 UTC (permalink / raw)
To: mst; +Cc: dave, linux-kernel, virtualization
Hi,
To my surprise, this call is still git-greppable in the
tree, the kernel having gotten rid of it a while back.
Thanks!
Davidlohr Bueso (2):
tools/virtio: remove stray characters
tools/virtio: remove smp_read_barrier_depends()
tools/virtio/ringtest/main.h | 37 +++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
--
2.38.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] tools/virtio: remove stray characters
2022-11-28 3:43 ` Davidlohr Bueso
@ 2022-11-28 3:43 ` Davidlohr Bueso
-1 siblings, 0 replies; 10+ messages in thread
From: Davidlohr Bueso @ 2022-11-28 3:43 UTC (permalink / raw)
To: mst; +Cc: virtualization, linux-kernel, dave
__read_once_size() is not a macro, remove those '/'s.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
tools/virtio/ringtest/main.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 6d1fccd3d86c..9ed09caa659e 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -149,16 +149,16 @@ static inline void busy_wait(void)
static __always_inline
void __read_once_size(const volatile void *p, void *res, int size)
{
- switch (size) { \
- case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break; \
- case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break; \
- case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break; \
- case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break; \
- default: \
- barrier(); \
- __builtin_memcpy((void *)res, (const void *)p, size); \
- barrier(); \
- } \
+ switch (size) {
+ case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break;
+ case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break;
+ case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break;
+ case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break;
+ default:
+ barrier();
+ __builtin_memcpy((void *)res, (const void *)p, size);
+ barrier();
+ }
}
static __always_inline void __write_once_size(volatile void *p, void *res, int size)
--
2.38.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/2] tools/virtio: remove stray characters
@ 2022-11-28 3:43 ` Davidlohr Bueso
0 siblings, 0 replies; 10+ messages in thread
From: Davidlohr Bueso @ 2022-11-28 3:43 UTC (permalink / raw)
To: mst; +Cc: dave, linux-kernel, virtualization
__read_once_size() is not a macro, remove those '/'s.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
tools/virtio/ringtest/main.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 6d1fccd3d86c..9ed09caa659e 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -149,16 +149,16 @@ static inline void busy_wait(void)
static __always_inline
void __read_once_size(const volatile void *p, void *res, int size)
{
- switch (size) { \
- case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break; \
- case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break; \
- case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break; \
- case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break; \
- default: \
- barrier(); \
- __builtin_memcpy((void *)res, (const void *)p, size); \
- barrier(); \
- } \
+ switch (size) {
+ case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break;
+ case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break;
+ case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break;
+ case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break;
+ default:
+ barrier();
+ __builtin_memcpy((void *)res, (const void *)p, size);
+ barrier();
+ }
}
static __always_inline void __write_once_size(volatile void *p, void *res, int size)
--
2.38.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] tools/virtio: remove smp_read_barrier_depends()
2022-11-28 3:43 ` Davidlohr Bueso
@ 2022-11-28 3:43 ` Davidlohr Bueso
-1 siblings, 0 replies; 10+ messages in thread
From: Davidlohr Bueso @ 2022-11-28 3:43 UTC (permalink / raw)
To: mst; +Cc: dave, linux-kernel, virtualization
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>
---
tools/virtio/ringtest/main.h | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 9ed09caa659e..b68920d52750 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -140,12 +140,6 @@ static inline void busy_wait(void)
#define smp_wmb() smp_release()
#endif
-#ifdef __alpha__
-#define smp_read_barrier_depends() smp_acquire()
-#else
-#define smp_read_barrier_depends() do {} while(0)
-#endif
-
static __always_inline
void __read_once_size(const volatile void *p, void *res, int size)
{
@@ -175,13 +169,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
}
}
+#ifdef __alpha__
#define READ_ONCE(x) \
({ \
union { typeof(x) __val; char __c[1]; } __u; \
__read_once_size(&(x), __u.__c, sizeof(x)); \
- smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
+ smp_mb(); /* Enforce dependency ordering from x */ \
__u.__val; \
})
+#else
+#define READ_ONCE(x) \
+({ \
+ union { typeof(x) __val; char __c[1]; } __u; \
+ __read_once_size(&(x), __u.__c, sizeof(x)); \
+ __u.__val; \
+})
+#endif
#define WRITE_ONCE(x, val) \
({ \
--
2.38.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] tools/virtio: remove smp_read_barrier_depends()
@ 2022-11-28 3:43 ` Davidlohr Bueso
0 siblings, 0 replies; 10+ messages in thread
From: Davidlohr Bueso @ 2022-11-28 3:43 UTC (permalink / raw)
To: mst; +Cc: virtualization, linux-kernel, dave
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>
---
tools/virtio/ringtest/main.h | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 9ed09caa659e..b68920d52750 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -140,12 +140,6 @@ static inline void busy_wait(void)
#define smp_wmb() smp_release()
#endif
-#ifdef __alpha__
-#define smp_read_barrier_depends() smp_acquire()
-#else
-#define smp_read_barrier_depends() do {} while(0)
-#endif
-
static __always_inline
void __read_once_size(const volatile void *p, void *res, int size)
{
@@ -175,13 +169,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
}
}
+#ifdef __alpha__
#define READ_ONCE(x) \
({ \
union { typeof(x) __val; char __c[1]; } __u; \
__read_once_size(&(x), __u.__c, sizeof(x)); \
- smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
+ smp_mb(); /* Enforce dependency ordering from x */ \
__u.__val; \
})
+#else
+#define READ_ONCE(x) \
+({ \
+ union { typeof(x) __val; char __c[1]; } __u; \
+ __read_once_size(&(x), __u.__c, sizeof(x)); \
+ __u.__val; \
+})
+#endif
#define WRITE_ONCE(x, val) \
({ \
--
2.38.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] tools/virtio: remove stray characters
2022-11-28 3:43 ` Davidlohr Bueso
@ 2022-11-28 6:16 ` Xuan Zhuo
-1 siblings, 0 replies; 10+ messages in thread
From: Xuan Zhuo @ 2022-11-28 6:16 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: dave, linux-kernel, virtualization, mst
On Sun, 27 Nov 2022 19:43:46 -0800, Davidlohr Bueso <dave@stgolabs.net> wrote:
> __read_once_size() is not a macro, remove those '/'s.
>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> ---
> tools/virtio/ringtest/main.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
> index 6d1fccd3d86c..9ed09caa659e 100644
> --- a/tools/virtio/ringtest/main.h
> +++ b/tools/virtio/ringtest/main.h
> @@ -149,16 +149,16 @@ static inline void busy_wait(void)
> static __always_inline
> void __read_once_size(const volatile void *p, void *res, int size)
> {
> - switch (size) { \
> - case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break; \
> - case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break; \
> - case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break; \
> - case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break; \
> - default: \
> - barrier(); \
> - __builtin_memcpy((void *)res, (const void *)p, size); \
> - barrier(); \
> - } \
> + switch (size) {
> + case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break;
> + case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break;
> + case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break;
> + case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break;
> + default:
> + barrier();
> + __builtin_memcpy((void *)res, (const void *)p, size);
> + barrier();
> + }
> }
>
> static __always_inline void __write_once_size(volatile void *p, void *res, int size)
> --
> 2.38.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] tools/virtio: remove stray characters
@ 2022-11-28 6:16 ` Xuan Zhuo
0 siblings, 0 replies; 10+ messages in thread
From: Xuan Zhuo @ 2022-11-28 6:16 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: dave, mst, linux-kernel, virtualization
On Sun, 27 Nov 2022 19:43:46 -0800, Davidlohr Bueso <dave@stgolabs.net> wrote:
> __read_once_size() is not a macro, remove those '/'s.
>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> ---
> tools/virtio/ringtest/main.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
> index 6d1fccd3d86c..9ed09caa659e 100644
> --- a/tools/virtio/ringtest/main.h
> +++ b/tools/virtio/ringtest/main.h
> @@ -149,16 +149,16 @@ static inline void busy_wait(void)
> static __always_inline
> void __read_once_size(const volatile void *p, void *res, int size)
> {
> - switch (size) { \
> - case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break; \
> - case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break; \
> - case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break; \
> - case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break; \
> - default: \
> - barrier(); \
> - __builtin_memcpy((void *)res, (const void *)p, size); \
> - barrier(); \
> - } \
> + switch (size) {
> + case 1: *(unsigned char *)res = *(volatile unsigned char *)p; break;
> + case 2: *(unsigned short *)res = *(volatile unsigned short *)p; break;
> + case 4: *(unsigned int *)res = *(volatile unsigned int *)p; break;
> + case 8: *(unsigned long long *)res = *(volatile unsigned long long *)p; break;
> + default:
> + barrier();
> + __builtin_memcpy((void *)res, (const void *)p, size);
> + barrier();
> + }
> }
>
> static __always_inline void __write_once_size(volatile void *p, void *res, int size)
> --
> 2.38.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] tools/virtio: remove smp_read_barrier_depends()
2022-11-28 3:43 ` Davidlohr Bueso
@ 2022-11-28 6:16 ` Xuan Zhuo
-1 siblings, 0 replies; 10+ messages in thread
From: Xuan Zhuo @ 2022-11-28 6:16 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: dave, linux-kernel, virtualization, mst
On Sun, 27 Nov 2022 19:43:47 -0800, Davidlohr Bueso <dave@stgolabs.net> wrote:
> 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>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> ---
> tools/virtio/ringtest/main.h | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
> index 9ed09caa659e..b68920d52750 100644
> --- a/tools/virtio/ringtest/main.h
> +++ b/tools/virtio/ringtest/main.h
> @@ -140,12 +140,6 @@ static inline void busy_wait(void)
> #define smp_wmb() smp_release()
> #endif
>
> -#ifdef __alpha__
> -#define smp_read_barrier_depends() smp_acquire()
> -#else
> -#define smp_read_barrier_depends() do {} while(0)
> -#endif
> -
> static __always_inline
> void __read_once_size(const volatile void *p, void *res, int size)
> {
> @@ -175,13 +169,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
> }
> }
>
> +#ifdef __alpha__
> #define READ_ONCE(x) \
> ({ \
> union { typeof(x) __val; char __c[1]; } __u; \
> __read_once_size(&(x), __u.__c, sizeof(x)); \
> - smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
> + smp_mb(); /* Enforce dependency ordering from x */ \
> __u.__val; \
> })
> +#else
> +#define READ_ONCE(x) \
> +({ \
> + union { typeof(x) __val; char __c[1]; } __u; \
> + __read_once_size(&(x), __u.__c, sizeof(x)); \
> + __u.__val; \
> +})
> +#endif
>
> #define WRITE_ONCE(x, val) \
> ({ \
> --
> 2.38.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] tools/virtio: remove smp_read_barrier_depends()
@ 2022-11-28 6:16 ` Xuan Zhuo
0 siblings, 0 replies; 10+ messages in thread
From: Xuan Zhuo @ 2022-11-28 6:16 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: dave, mst, linux-kernel, virtualization
On Sun, 27 Nov 2022 19:43:47 -0800, Davidlohr Bueso <dave@stgolabs.net> wrote:
> 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>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> ---
> tools/virtio/ringtest/main.h | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
> index 9ed09caa659e..b68920d52750 100644
> --- a/tools/virtio/ringtest/main.h
> +++ b/tools/virtio/ringtest/main.h
> @@ -140,12 +140,6 @@ static inline void busy_wait(void)
> #define smp_wmb() smp_release()
> #endif
>
> -#ifdef __alpha__
> -#define smp_read_barrier_depends() smp_acquire()
> -#else
> -#define smp_read_barrier_depends() do {} while(0)
> -#endif
> -
> static __always_inline
> void __read_once_size(const volatile void *p, void *res, int size)
> {
> @@ -175,13 +169,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
> }
> }
>
> +#ifdef __alpha__
> #define READ_ONCE(x) \
> ({ \
> union { typeof(x) __val; char __c[1]; } __u; \
> __read_once_size(&(x), __u.__c, sizeof(x)); \
> - smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
> + smp_mb(); /* Enforce dependency ordering from x */ \
> __u.__val; \
> })
> +#else
> +#define READ_ONCE(x) \
> +({ \
> + union { typeof(x) __val; char __c[1]; } __u; \
> + __read_once_size(&(x), __u.__c, sizeof(x)); \
> + __u.__val; \
> +})
> +#endif
>
> #define WRITE_ONCE(x, val) \
> ({ \
> --
> 2.38.1
>
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-11-28 6:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 3:43 [PATCH 0/2] tools/virtio: remove smp_read_barrier_depends() Davidlohr Bueso
2022-11-28 3:43 ` Davidlohr Bueso
2022-11-28 3:43 ` [PATCH 1/2] tools/virtio: remove stray characters Davidlohr Bueso
2022-11-28 3:43 ` Davidlohr Bueso
2022-11-28 6:16 ` Xuan Zhuo
2022-11-28 6:16 ` Xuan Zhuo
2022-11-28 3:43 ` [PATCH 2/2] tools/virtio: remove smp_read_barrier_depends() Davidlohr Bueso
2022-11-28 3:43 ` Davidlohr Bueso
2022-11-28 6:16 ` Xuan Zhuo
2022-11-28 6:16 ` Xuan Zhuo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.