From: Mattias Nissler <mnissler@rivosinc.com>
To: jag.raman@oracle.com, peterx@redhat.com, stefanha@redhat.com,
qemu-devel@nongnu.org
Cc: "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
john.levon@nutanix.com, "David Hildenbrand" <david@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Mattias Nissler" <mnissler@rivosinc.com>
Subject: [PATCH v10 1/7] system/physmem: Replace qemu_mutex_lock() calls with QEMU_LOCK_GUARD
Date: Tue, 7 May 2024 07:34:25 -0700 [thread overview]
Message-ID: <20240507143431.464382-2-mnissler@rivosinc.com> (raw)
In-Reply-To: <20240507143431.464382-1-mnissler@rivosinc.com>
From: Philippe Mathieu-Daudé <philmd@linaro.org>
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Simplify cpu_[un]register_map_client() and cpu_notify_map_clients()
by replacing the pair of qemu_mutex_lock/qemu_mutex_unlock calls by
the WITH_QEMU_LOCK_GUARD() macro.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Reviewed-by: Mattias Nissler <mnissler@rivosinc.com>
---
system/physmem.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/system/physmem.c b/system/physmem.c
index d3a3d8a45c..5486014cf2 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -3086,7 +3086,7 @@ void cpu_register_map_client(QEMUBH *bh)
{
MapClient *client = g_malloc(sizeof(*client));
- qemu_mutex_lock(&map_client_list_lock);
+ QEMU_LOCK_GUARD(&map_client_list_lock);
client->bh = bh;
QLIST_INSERT_HEAD(&map_client_list, client, link);
/* Write map_client_list before reading in_use. */
@@ -3094,7 +3094,6 @@ void cpu_register_map_client(QEMUBH *bh)
if (!qatomic_read(&bounce.in_use)) {
cpu_notify_map_clients_locked();
}
- qemu_mutex_unlock(&map_client_list_lock);
}
void cpu_exec_init_all(void)
@@ -3117,21 +3116,19 @@ void cpu_unregister_map_client(QEMUBH *bh)
{
MapClient *client;
- qemu_mutex_lock(&map_client_list_lock);
+ QEMU_LOCK_GUARD(&map_client_list_lock);
QLIST_FOREACH(client, &map_client_list, link) {
if (client->bh == bh) {
cpu_unregister_map_client_do(client);
break;
}
}
- qemu_mutex_unlock(&map_client_list_lock);
}
static void cpu_notify_map_clients(void)
{
- qemu_mutex_lock(&map_client_list_lock);
+ QEMU_LOCK_GUARD(&map_client_list_lock);
cpu_notify_map_clients_locked();
- qemu_mutex_unlock(&map_client_list_lock);
}
static bool flatview_access_valid(FlatView *fv, hwaddr addr, hwaddr len,
--
2.43.2
next prev parent reply other threads:[~2024-05-07 14:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 14:34 [PATCH v10 0/7] Support message-based DMA in vfio-user server Mattias Nissler
2024-05-07 14:34 ` Mattias Nissler [this message]
2024-05-07 20:02 ` [PATCH v10 1/7] system/physmem: Replace qemu_mutex_lock() calls with QEMU_LOCK_GUARD Peter Xu
2024-05-07 14:34 ` [PATCH v10 2/7] system/physmem: Propagate AddressSpace to MapClient helpers Mattias Nissler
2024-05-07 14:34 ` [PATCH v10 3/7] system/physmem: Per-AddressSpace bounce buffering Mattias Nissler
2024-05-07 14:34 ` [PATCH v10 4/7] softmmu: Support concurrent bounce buffers Mattias Nissler
2024-05-07 20:02 ` Peter Xu
2024-05-07 14:34 ` [PATCH v10 5/7] Update subprojects/libvfio-user Mattias Nissler
2024-05-07 14:34 ` [PATCH v10 6/7] vfio-user: Message-based DMA support Mattias Nissler
2024-05-07 14:34 ` [PATCH v10 7/7] vfio-user: Fix config space access byte order Mattias Nissler
2024-05-07 20:04 ` [PATCH v10 0/7] Support message-based DMA in vfio-user server Peter Xu
2024-05-08 21:16 ` Philippe Mathieu-Daudé
2024-05-08 21:21 ` Mattias Nissler
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=20240507143431.464382-2-mnissler@rivosinc.com \
--to=mnissler@rivosinc.com \
--cc=david@redhat.com \
--cc=elena.ufimtseva@oracle.com \
--cc=jag.raman@oracle.com \
--cc=john.levon@nutanix.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
/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 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.