From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 17/17] cpus-common: stop using mb_set/mb_read
Date: Sat, 29 Apr 2023 14:16:36 +0200 [thread overview]
Message-ID: <20230429121636.230934-18-pbonzini@redhat.com> (raw)
In-Reply-To: <20230429121636.230934-1-pbonzini@redhat.com>
Use a store-release at the end of the work item, and a load-acquire when
waiting for the item to be completed. This is the standard message passing
pattern and is both enough and clearer than mb_read/mb_set.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
cpus-common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpus-common.c b/cpus-common.c
index b0047e456f93..a53716deb437 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -157,7 +157,7 @@ void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data,
wi.exclusive = false;
queue_work_on_cpu(cpu, &wi);
- while (!qatomic_mb_read(&wi.done)) {
+ while (!qatomic_load_acquire(&wi.done)) {
CPUState *self_cpu = current_cpu;
qemu_cond_wait(&qemu_work_cond, mutex);
@@ -363,7 +363,7 @@ void process_queued_cpu_work(CPUState *cpu)
if (wi->free) {
g_free(wi);
} else {
- qatomic_mb_set(&wi->done, true);
+ qatomic_store_release(&wi->done, true);
}
}
qemu_mutex_unlock(&cpu->work_mutex);
--
2.40.0
prev parent reply other threads:[~2023-04-29 12:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-29 12:16 [PULL 00/17] Misc patches for 2023-04-29 Paolo Bonzini
2023-04-29 12:16 ` [PULL 01/17] qapi, i386/sev: Change the reduced-phys-bits value from 5 to 1 Paolo Bonzini
2023-04-29 12:16 ` [PULL 02/17] qemu-options.hx: Update the reduced-phys-bits documentation Paolo Bonzini
2023-04-29 12:16 ` [PULL 03/17] i386/sev: Update checks and information related to reduced-phys-bits Paolo Bonzini
2023-04-29 12:16 ` [PULL 04/17] i386/cpu: Update how the EBX register of CPUID 0x8000001F is set Paolo Bonzini
2023-04-29 12:16 ` [PULL 05/17] target/i386: Add support for CMPCCXADD in CPUID enumeration Paolo Bonzini
2023-04-29 12:16 ` [PULL 06/17] target/i386: Add support for AMX-FP16 " Paolo Bonzini
2023-04-29 12:16 ` [PULL 07/17] target/i386: Add support for AVX-IFMA " Paolo Bonzini
2023-04-29 12:16 ` [PULL 08/17] target/i386: Add support for AVX-VNNI-INT8 " Paolo Bonzini
2023-04-29 12:16 ` [PULL 09/17] target/i386: Add support for AVX-NE-CONVERT " Paolo Bonzini
2023-04-29 12:16 ` [PULL 10/17] target/i386: Add support for PREFETCHIT0/1 " Paolo Bonzini
2023-04-29 12:16 ` [PULL 11/17] Fix libvhost-user.c compilation Paolo Bonzini
2023-04-29 12:16 ` [PULL 12/17] update-linux-headers.sh: Add missing kernel headers Paolo Bonzini
2023-04-29 12:16 ` [PULL 13/17] Update linux headers to v6.3rc5 Paolo Bonzini
2023-04-29 12:16 ` [PULL 14/17] tests: vhost-user-test: release mutex on protocol violation Paolo Bonzini
2023-04-29 12:16 ` [PULL 15/17] target/hexagon: fix = vs. == mishap Paolo Bonzini
2023-04-29 12:16 ` [PULL 16/17] async: Suppress GCC13 false positive in aio_bh_poll() Paolo Bonzini
2023-04-29 12:16 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230429121636.230934-18-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).