Message ID | 20240124074201.8239-4-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/accel: Use RCU_READ macros | expand |
On Wed, 24 Jan 2024 09:41, Philippe Mathieu-Daudé <philmd@linaro.org> wrote: >Replace the manual rcu_read_(un)lock calls by the >WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba >"docs/style: call out the use of GUARD macros"). > >Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >--- > hw/display/virtio-gpu-udmabuf.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf.c >index d51184d658..0ee6685803 100644 >--- a/hw/display/virtio-gpu-udmabuf.c >+++ b/hw/display/virtio-gpu-udmabuf.c >@@ -42,9 +42,9 @@ static void virtio_gpu_create_udmabuf(struct virtio_gpu_simple_resource *res) > sizeof(struct udmabuf_create_item) * res->iov_cnt); > > for (i = 0; i < res->iov_cnt; i++) { >- rcu_read_lock(); >- rb = qemu_ram_block_from_host(res->iov[i].iov_base, false, &offset); >- rcu_read_unlock(); >+ WITH_RCU_READ_LOCK_GUARD() { >+ rb = qemu_ram_block_from_host(res->iov[i].iov_base, false, &offset); >+ } > > if (!rb || rb->fd < 0) { > g_free(list); >-- >2.41.0 Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf.c index d51184d658..0ee6685803 100644 --- a/hw/display/virtio-gpu-udmabuf.c +++ b/hw/display/virtio-gpu-udmabuf.c @@ -42,9 +42,9 @@ static void virtio_gpu_create_udmabuf(struct virtio_gpu_simple_resource *res) sizeof(struct udmabuf_create_item) * res->iov_cnt); for (i = 0; i < res->iov_cnt; i++) { - rcu_read_lock(); - rb = qemu_ram_block_from_host(res->iov[i].iov_base, false, &offset); - rcu_read_unlock(); + WITH_RCU_READ_LOCK_GUARD() { + rb = qemu_ram_block_from_host(res->iov[i].iov_base, false, &offset); + } if (!rb || rb->fd < 0) { g_free(list);
Replace the manual rcu_read_(un)lock calls by the WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba "docs/style: call out the use of GUARD macros"). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/display/virtio-gpu-udmabuf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)