lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1669616200.943005-3-xuanzhuo@linux.alibaba.com>
Date:   Mon, 28 Nov 2022 14:16:40 +0800
From:   Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To:     Davidlohr Bueso <dave@...olabs.net>
Cc:     dave@...olabs.net, linux-kernel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org, mst@...hat.com
Subject: Re: [PATCH 2/2] tools/virtio: remove smp_read_barrier_depends()

On Sun, 27 Nov 2022 19:43:47 -0800, Davidlohr Bueso <dave@...olabs.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@...olabs.net>

Reviewed-by: Xuan Zhuo <xuanzhuo@...ux.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@...ts.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ