diff mbox series

[6/6] hw/virtio/vhost: Use RCU_READ macro

Message ID 20240124074201.8239-7-philmd@linaro.org
State New
Headers show
Series hw/accel: Use RCU_READ macros | expand

Commit Message

Philippe Mathieu-Daudé Jan. 24, 2024, 7:42 a.m. UTC
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/virtio/vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Manos Pitsidianakis Jan. 24, 2024, 9:15 a.m. UTC | #1
On Wed, 24 Jan 2024 09:42, 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/virtio/vhost.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>index 2c9ac79468..1f5ecb843e 100644
>--- a/hw/virtio/vhost.c
>+++ b/hw/virtio/vhost.c
>@@ -186,12 +186,12 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev,
>             hwaddr phys, s, offset;
> 
>             while (used_size) {
>-                rcu_read_lock();
>-                iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
>+                WITH_RCU_READ_LOCK_GUARD() {
>+                    iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
>                                                       used_phys,
>                                                       true,
>                                                       MEMTXATTRS_UNSPECIFIED);
>-                rcu_read_unlock();
>+                }
> 
>                 if (!iotlb.target_as) {
>                     qemu_log_mask(LOG_GUEST_ERROR, "translation "
>-- 
>2.41.0
>

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
diff mbox series

Patch

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 2c9ac79468..1f5ecb843e 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -186,12 +186,12 @@  static int vhost_sync_dirty_bitmap(struct vhost_dev *dev,
             hwaddr phys, s, offset;
 
             while (used_size) {
-                rcu_read_lock();
-                iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
+                WITH_RCU_READ_LOCK_GUARD() {
+                    iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
                                                       used_phys,
                                                       true,
                                                       MEMTXATTRS_UNSPECIFIED);
-                rcu_read_unlock();
+                }
 
                 if (!iotlb.target_as) {
                     qemu_log_mask(LOG_GUEST_ERROR, "translation "