diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-07-15 20:58:41 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-08-02 12:03:58 +0200 |
commit | 34506b30e4210b417aa38d1518aa2c53fb7cf39b (patch) | |
tree | eb3653db2474e880a5735baebe8c83a6d395f572 /include | |
parent | cc0100f464c94bf80ad36cd432f4a1ed58126b60 (diff) |
util/qht: Document memory ordering assumptions
It is naturally expected that some memory ordering should be provided
around qht_insert() and qht_lookup(). Document these assumptions in the
header file and put some comments in the source to denote how that
memory ordering requirements are fulfilled.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Sergey Fedorov: commit title and message provided;
comment on qht_remove() elided]
Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-Id: <20160715175852.30749-2-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/qht.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/qemu/qht.h b/include/qemu/qht.h index 70bfc68b8d..311139b85a 100644 --- a/include/qemu/qht.h +++ b/include/qemu/qht.h @@ -69,6 +69,9 @@ void qht_destroy(struct qht *ht); * Attempting to insert a NULL @p is a bug. * Inserting the same pointer @p with different @hash values is a bug. * + * In case of successful operation, smp_wmb() is implied before the pointer is + * inserted into the hash table. + * * Returns true on sucess. * Returns false if the @p-@hash pair already exists in the hash table. */ @@ -83,6 +86,8 @@ bool qht_insert(struct qht *ht, void *p, uint32_t hash); * * Needs to be called under an RCU read-critical section. * + * smp_read_barrier_depends() is implied before the call to @func. + * * The user-provided @func compares pointers in QHT against @userp. * If the function returns true, a match has been found. * |