[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/4] atomics: update documentation for C11
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 2/4] atomics: update documentation for C11 |
Date: |
Tue, 7 Apr 2020 10:06:04 +0100 |
On Mon, Apr 06, 2020 at 03:13:18PM -0400, Paolo Bonzini wrote:
> -The semantics of these primitives map to Java volatile variables,
> -and are strongly related to memory barriers as used in the Linux
> -kernel (see below).
> -
> -As long as you use atomic_mb_read and atomic_mb_set, accesses cannot
> -be reordered with each other, and it is also not possible to reorder
> -"normal" accesses around them.
> -
> -However, and this is the important difference between
> -atomic_mb_read/atomic_mb_set and sequential consistency, it is important
> -for both threads to access the same volatile variable. It is not the
> -case that everything visible to thread A when it writes volatile field f
> -becomes visible to thread B after it reads volatile field g. The store
> -and load have to "match" (i.e., be performed on the same volatile
> -field) to achieve the right semantics.
> -
> -
> -These operations operate on any type that is as wide as an int or smaller.
> +which however are deprecated.
Please indicate why they are deprecated and advise which alternative is
preferred. This will help readers understand the current best practices
and make a decision about whether to avoid the deprecated APIs.
signature.asc
Description: PGP signature
- [RFC PATCH 0/4] async: fix hangs on weakly-ordered architectures, Paolo Bonzini, 2020/04/06
- [PATCH 3/4] rcu: do not mention atomic_mb_read/set in documentation, Paolo Bonzini, 2020/04/06
- [PATCH 4/4] async: use explicit memory barriers and relaxed accesses, Paolo Bonzini, 2020/04/06
- [PATCH 2/4] atomics: update documentation for C11, Paolo Bonzini, 2020/04/06
- [PATCH 1/4] atomics: convert to reStructuredText, Paolo Bonzini, 2020/04/06
- Re: [RFC PATCH 0/4] async: fix hangs on weakly-ordered architectures, Stefan Hajnoczi, 2020/04/07